Reputation: 900
I want to connect to Cassandra which is running as a service in Mesosphere DC/OS. Is there any programmatic way(any api exposed) to get the Cassandra port and ip details ?
From Command I can connect like below... same thing I want to do it programmatically may be with REST api... or Java client to connect to these services.
As per this doc https://github.com/mesosphere/dcos-cassandra-service/blob/master/docs/connecting-clients.md
$ dcos cassandra --name=<service-name> connection
{
"address": [
"10.0.0.47:9042",
"10.0.0.50:9042",
"10.0.0.49:9042"
],
"dns": [
"node-0.cassandra.mesos:9042",
"node-1.cassandra.mesos:9042",
"node-2.cassandra.mesos:9042"
]
}
Note : The reason for doing this is every time cassandra IP and port changing. I have to manually adjust in my property file to get the latest details. If its through program its very easy to set the property with out manual interaction.
Upvotes: 0
Views: 43
Reputation: 149
If you use the entries from the DNS section (shown below) they would not change even if the task relocated to another node
"node-0.cassandra.mesos:9042",
"node-1.cassandra.mesos:9042",
"node-2.cassandra.mesos:9042"
Upvotes: 1