Jet Li
unread,Dec 3, 2015, 4:43:11 AM12/3/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hi,
I have three cassandra node, 100.142.31.176,100.142.31.177,100.142.31.178, 100.142.31.176 is the seed node, I have a demo code that will do some task on all node, when I stop one cassandra and run all task again, all task in all node failed with Unavailable, the error code is: CASS_ERROR_SERVER_UNAVAILABLE
To neil: you can reply on this post, thanks
below is some describe of my Demo code and cassandra.yaml file
void OpenSession()
{
if(m_session != NULL)
{
sessionNum ++;
return;
}
cluster = cass_cluster_new api();
cass_cluster_set_request_timeout(50000);
cass_cluster_set_latency_aware_routing api(cluster, cass_true);
cass_cluster_set_load_balance_round_robin(cluster);
m_seesion = cass_cass_session_new(cluster);
//contact point like "100.142.31.177,100.142.31.176"
const char* cintact_point = GetPointFromConfigFile();
cass_cluster_set_contact_points(cluster, cintact_point );
cass_session_connect(m_seesion, m_cluster);
...
//some other error process operator
...
}
void OpenDB(const string& path)
{
OpenSession();
//get the base keyspace name:
string keyspace_base = SetBaseName();
string keyspace_rep2 = keyspace_base+"_rep2";
string keyspace_rep3 = keyspace_base+"_rep3";
...
//create key space...
create_key_space = "CREATE KEYSPACE IF NOT EXISTS " + keyspace_rep2
+ "WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '2'} "";";
Future result = cass_session_execute(m_seesion, create_key_space );
cass_future_wait(result);
//check result and do error process;
....
//create other key space and table
....
}
in cassandra.yaml, I set some paramerter and other parameter never set:
1. cluster name
2. seeds ip; 100.142.31.176
3. listen_adress: use the local machine ip of each node,like 100.142.31.177
4. rpc_adress: use the local machine ip of each node,like 100.142.31.177
5. commit log, cache and data path
result:
1. all task can success when all cassandra node is up
2. all task will failed after write some data if one cassandra node down
Best wishes
Liwei