Node_names in as_cluster_get_node_names()


#1

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.


#2

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

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

#3

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


#4

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