How to get list of sets from Aerospike Client?

Hi,

Is there any way I can get the list of sets available in a namespace using AerospikeClient in C#? Any particular set having DB schema from where I can get the list of sets?

Thanks in advance, Jithin

asinfo tool gives you list of all sets in the cluster by namespace and set name plus all other set level params.

$ asinfo -v "sets" -l

ns=test:set=users:objects=0:tombstones=0:memory_data_bytes=0:device_data_bytes=0:truncate_lut=0:sindexes=1:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0

ns=test:set=setn:objects=0:tombstones=0:memory_data_bytes=0:device_data_bytes=0:truncate_lut=0:sindexes=0:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0

ns=test:set=testset:objects=10:tombstones=0:memory_data_bytes=0:device_data_bytes=816:truncate_lut=402599212758:sindexes=0:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0

ns=test:set=cdt-indexing:objects=0:tombstones=0:memory_data_bytes=0:device_data_bytes=0:truncate_lut=0:sindexes=11:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0

ns=test:set=accts:objects=1000:tombstones=0:memory_data_bytes=0:device_data_bytes=445456:truncate_lut=0:sindexes=0:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0

In C# client, you have Info class available where you can issue a Request/Response pair request for this asinfo command and parse the response. See C# client API docs, Aerospike - Table of Content and look at Info class.

1 Like

Thanks for the response gupta. Tried below one, but getting name and value as ‘0’. new Info(new Connection(new IPEndPoint(new IPAddress(_ipAddress),_portNo),_timeout),“sets”).GetNameValueParser()

Not a C# expert but I quickly tried this in our DeveloperHub C# sandbox.
I first go through “Setup” “Create” “Read” … and in the “Read” example, I added the following code:

Console.Write("Sets\n");
Node node = client.Nodes[0];
Console.Write(Info.Request(node, "sets"));

and I see the following output… my namespace is sandbox and set name is ufodata.

Sets
ns=sandbox:set=ufodata:objects=5001:tombstones=0:memory_data_bytes=4861227:device_data_bytes=5051776:truncate_lut=0:sindexes=0:index_populating=false:disable-eviction=false:enable-index=false:stop-writes-count=0;
[Execution complete]

Here is screen shot of the C# developer hub on developer.aerospike.com

Also, the C# client library code should have public access I believe. See other examples here: aerospike-client-csharp/ServerInfo.cs at master · aerospike/aerospike-client-csharp · GitHub

2 Likes

It worked!!. Awesome. Thanks. The second parameter in Info.Request - name was a little confusing. Thought it was name of the node, my bad. I think it needs to be renamed as command instead of name .?

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.