Trouble with PUT/GET in Riak testing - riak
I'm working on a little e2 application that needs to put/get data
to/from riak. I apparently have a misunderstanding
about some things.
I can successfully put and get key-value pairs to a bucket using the
erlang client. However, when I try to curl the
data out, I get nothing. In fact, doing:
curl -X GET
"http://riak1:8098/riak?buckets=true" returns '{"buckets":[]}'.
Ditto for curl -X GET "http://192.168.29.11:8098/buckets?buckets=true"
In my application, though, I can do this:
8> Object = riakc_obj:new(<<"testbucket">>, <<"testkey">>,
<<"testdata">>). {riakc_obj,<<"testbucket">>,<<"testkey">>,undefined,[],
undefined,<<"testdata">>}
9> riakc_pb_socket:put(Pid, Object).
ok
10> riakc_pb_socket:get(Pid, <<"testbucket">>, <<"testkey">>).
{ok,{riakc_obj,<<"testbucket">>,<<"testkey">>,
<<107,206,97,96,96,96,204,96,202,5,82,28,202,156,255,126,
238,185,94,62,53,131,41,...>>,
[{{dict,2,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],...},
{{[],[],[],[],[],[],[],[],[],[],...}}},
<<"testdata">>}],
undefined,undefined}}
11> riakc_pb_socket:list_buckets(Pid).
{ok,[<<"tb1">>,<<"testbucket">>]}
So what is the difference between the two? How can I use curl (or any
other client) to see the buckets, and retrieve
data?
--
Note that this was also sent to the riak-user mailing list
I figured out what the problem was. I had another instance of Riak running on the machine where my application was running, and the app was defaulting to "localhost" when connecting to Riak, rather than connecting to my test cluster.
The data was written correctly, just to the wrong instance.
Related
Azure Dev Ops REST Api Get Agent.MachineName or ComputerName from Server 2019 or 5.0 for a Unix machine
I am trying to get a list of the agents with the machines they are running on. I have successfully used the agents includeCapabilities option and have pulled the computer names of every other machine that is not UNIX with $org/_apis/distributedtask/pools/$PoolId/agents?includeCapabilities=true&api-version=5.0 $results = Invoke-RestMethod -Method Get -uri $url -Headers $headers (I am using PowerShell to call the API) I am however running into a problem where Unix machines do not have Agent.ComputerNames returned. The names do show up in Azure Dev Ops, so I know they exist. I ran into the idea of getting the preset variable Agent.MachineName, but I can't find any documentation on getting access to the preset variables from the REST API. (A list of variables that are defined as useful to have access to, so I find it odd that you can't seem get them.) Thank you for your time!
I found that Unix servers provide a NAME under systemCapabilities, while other servers provided a COMPUTERNAME. I had the issue since I was only looking for COMPUTERNAME. I found that it is better to grab the agent.systemCapabilities.Agent.ComputerName property. In PowerShell $agent.systemCapabilities."Agent.ComputerName" the quotations are important to tell PowerShell that it is a one string not nested farther.
R mongolite: correct format for connecting with a Mogodb on a remote server?
I'm writing some R code that queries a MongoDB database, imports records matching the query criteria into R, performs record linkage with another data source, and then pushes the updated records back into MongoDB. The code needs to work with any instance of the MongoDB database. Some people have it installed as standalone on their own computers, while others have it installed on their organisational servers. Note that these are servers specific to individual organisations and not the public mongo server. To test my code, I have access to both scenarios - one instance is set up on my own computer, and I have several remote server instances as well. The MongoDB database has some APIs, but I was struggling with the adapting the APIs to include the correct syntax to form my query, so I thought I would try the mongolite package instead. I was able to create a successful connection string for the MongoDB instance on my local computer, using my user ID (which I retrieve first with an API and save as the R object myids), password, the localhost and port number as below: # Load library: library(mongolite) # Create connection: con <- mongolite::mongo(collection = "person", db = "go-data", url = paste0("mongodb://localhost:3000", myids$userid, ":", rawToChar(password))) I understood from reading the mongolite user manual that to create the connection string / URI, you skip the http or https part of the address and preface it with either mongodb:// when the Mongodb database is on a local computer, or mongodb+srv:// when the Mongodb database is on a remote server. However, when I try just changing the prefix and login details for the remote server version, the connection fails. Say the URL for my remote server is https://mydb-r21.orgname.org/ which opens a web page where you can log in to the Mongodb database and interact with it via a graphical user interface. Just swapping localhost:3000 for the web address mydb-r21.orgname.org/ and supplying the relevant login credentials for that server doesn't work: # Load library: library(mongolite) # Create connection: con <- mongolite::mongo(collection = "person", db = "go-data", url = paste0("mongodb+srv://mydb-r21.orgname.org/", myids$userid, ":", rawToChar(password))) When I try, this is the error I get: Warning: [ERROR] Failed to look up SRV record "_mongodb._tcp.mydb-r21.orgname.org": DNS name does not exist. Error: Invalid uri_string. Try mongodb://localhost If I try changing to mongodb::// (not localhost because it isn't hosted locally) I get this: Error: No suitable servers found (`serverSelectionTryOnce` set): [connection timeout calling hello on 'mydb-r21.orgname.org:27017'] Interestingly, the port that is suffixed in the error message is the correct one that I was expecting, but that still doesn't help me. The documentation in the mongolite user manual and other places I've found online seem to add some read/write specifications to the connection string, but as I'm not very familiar with how connection strings are constructed, I don't know if these are specific to the databases they are using in their examples. I can't find any clear explanation of what the extra bits that are not part of the URL mean, e.g. as shown in this blog. All the prefixes seem to be a bit different too, so I am not even sure what would be appropriate to try in my case. Can anyone explain why the connection string works fine with localhost:port number for the local instance, but doesn't work with the URL for the remote server / online instance? Also what do I need to do to make the URI for the remote server valid?
How to fetch data of a a vertex or an edge from JanusGraph using its Java driver?
I'm connecting to a remote JanusGraph server. There is no problem with the connection but I can't understand the Java API. I'm running a Java Spring HTTP server. Inside the HTTP response method, I'm creating a graph traversal source like GraphTraversalSource g = traversal().withRemote("conf/remote-graph.properties"); It seems fine. But When I want to get data about a Vertex I can not with the below code. g.V(28712).next().keys() IT GIVES AN EMPTY RESPONSE! WHY? If I do the same with gremlin shell, I see it. See the below picture If I do g.V(28712).valueMap(true).unfold().toList(); in Java, I see some results. I just want to fetch data for a vertex or edge with Java. How should I do that? thanks
By default, when you connect to a Gremlin Server using one of the Gremlin clients and you ask for a vertex, what you get back is a reference vertex. A reference vertex just contains the ID and the label. To get some properties you need to include them using valueMap, elementMap, project etc. Alternatively you can configure the Gremlin Server to return all properties. The default is set this way to reduce the amount of data that gets sent back to a client. Please see the documentation for further details. https://tinkerpop.apache.org/docs/current/reference/#gremlin-applications https://tinkerpop.apache.org/docs/current/reference/#_properties_of_elements There is a link in that documentation to a post about why the decisions were made. For convenience, I am including that link here as well. https://lists.apache.org/thread.html/e959e85d4f8b3d46d281f2742a6e574c7d27c54bfc52f802f7c04af3%40%3Cdev.tinkerpop.apache.org%3E
Freeswitch Guide how to get CDR UUID from client side
My system contain: - Freeswitch server - Sip Client: Web using sipjs , mobile react-native using https://github.com/datso/react-native-pjsip to receive call. My problem is when call done i need to know the uuid of CDR recently add to Postgres DB of that call to attach some info to that call I try many way but can not success ex: write http request to select into postgres DB, but can not find exactly which uuid because one extension can make many call one time. Can anyone help me solve this case?
Mark each call with custom variable like callid Send that to your app via any method, as sipheader, as sip message, using http post etc. But you also can just search cdr by start date.
communicate to a client/server application in R
Is it possible to communicate to a client/server application by calling the command System in R? I use BaseX for storing xml databases and I want to call a Basex client from R by using the "system"command after have launching the basexserver manually setwd("C:/Program Files/BaseX/bin/") system("basexclient -U admin -P admin",wait = TRUE) BaseX 8.1 [Client] Try help to get more information. The problem is that R can't communicate with the BaseX Client, and as consequence i get this error : Child process not responding.R will terminate it. I tried to change wait parameter to wait=FALSE and then execute a command BaseX but it seems that it can't communicate to the client also. system("OPEN mydatabse",wait = FALSE) object "mydatabse" not found Any suggestions you can provide will be appreciated. N.B : The same problem occurs with Java