forked from apache/cassandra-cpp-driver
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
In master of cpp-driver and in 0.3.0 and later of cpp-rust-driver, the driver supports rack-awareness.
Perhaps we could add some examples to the documentation.
It looks like there are two primary methods to use that we could document.
- Set directly on a
CassClusterobject:
/* Setup and connect to cluster */
CassFuture* connect_future = NULL;
CassCluster* cluster = cass_cluster_new();
CassSession* session = cass_session_new();
cass_cluster_set_contact_points(cluster, "192.168.1.1,192.168.1.2,192.168.1.3");
cass_cluster_set_load_balance_rack_aware(cluster,
"AWS_US_EAST_1",
"us-east-1a");
connect_future = cass_session_connect(session, cluster);
if (cass_future_error_code(connect_future) == CASS_OK) {
//do work
} else {
/* Handle connection error */
const char* message;
size_t message_length;
cass_future_error_message(connect_future, &message, &message_length);
fprintf(stderr, "Unable to connect: '%.*s'\n", (int)message_length, message);
}
cass_future_free(connect_future);
cass_cluster_free(cluster);
cass_session_free(session);
- Set on a
CassExecProfileobject:
//FIXME: fill in example
We might also want to include a disclaimer about AWS specifically, where AZs do not have consistent names between different AWS accounts. Maybe the documentation can provide more detailed guidance about this or refer to the AWS documentation that mentions how to obtain the internal AZ IDs. Here's the corresponding AWS Documentation page: Availability Zone IDs for your AWS resources
Metadata
Metadata
Assignees
Labels
No labels