2009/12/7 Ramzi Rabah <email@example.com>
TSocket socket = new TSocket(hostName, port);
TBinaryProtocol binaryProtocol = new
TBinaryProtocol(socket, false, false);
Cassandra.Client client = new Cassandra.Client(binaryProtocol);
Map<String,String> tokenToHostMap = (Map<String,String>)
this will return a list of servers in the cluster (both up or down).
You will obviously need to connect to a live node in the cluster to be
able to run this.
Right, and an application could connect to a known live node (seed node, etc) periodically and store the result (retaining the previous values if it was unable to connect).
That wouldn't solve the problem of being able to connect to a node which is available, *right now*. To do that reliably and with minimal latency you'd need something which Cassandra doesn't easily have, a load-balancer/ high availability setup.
Personally I'd like to see Cassandra implement a "Front-end-only" node, which could run as a thrift protocol server but not join the ring itself hence not requiring persistent storage. This would mean that app servers could run a local front-end-only server and just talk to that.