Node_names in as_cluster_get_node_names()

Although the descritpion says “Get all node names in cluster” but I got only 1 node name.

        int n;
        char * node_name;
        as_cluster_get_node_names(RtDbConnection::ms_aerospikeIns.cluster,&n,&node_name);

        cout<<endl<<"n: "<<n<<endl;
        
        cout<<"node_names: "<<node_name<<endl;

In the above code, n = 2 yet node_name stores only 1 name which is the name of the node whose IP I had provided during the initialisation of the aerospike object.

node_name is an array of (char*), not a single node_name.

for (int i = 0; i < n; i++) {
  cout << node_name[i] << endl;
}
1 Like

Oops! Should have understood that! Thank you so much for pointing that out.

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