Search code examples
aerospike

Aerospike: count all objects in a namespace?


So I've been going through Aerospike's documentations, and I still fail to understand how to get the number of master (not-replicated) records in a names-space via the Java API (not AQL).. any help?


Solution

  • I tried this with a server running on localhost, port 3000. You can explore the Info class further and use better constructs. I have 10,000 objects in a namespace called 'test'.

    String output = Info.request("127.0.0.1", 3000, "namespace/test");
    String[] mp = output.split(";") ; 
    console.printf(mp[0]);
    

    I got the following output on my console:

    objects=10000