Can I use different ports for nodes in a Cassandra cluster?

We programmatically create Cassandra nodes (automatically generate yaml and use CassandraDaemon ). Ideally, we could use different ports on different hosts due to configuration needs. Is this possible (via seed specification or custom class implementation)? It seems that the seed list can only accept IP addresses, not ports.

+6
source share
2 answers

After looking at the appropriate source in the Cassandra network code, it is obvious that this is not supported. In the newSocket() method, the port for the remote node is obtained from the static DatabaseDescriptor.getSSLStoragePort() (excerpt below). This does not give another value for each host or any hook for this:

 public Socket newSocket() throws IOException { // zero means 'bind on any available port.' if (isEncryptedChannel()) { return SSLFactory.getSocket(DatabaseDescriptor.getEncryptionOptions(), endPoint(), DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0); } else { return new Socket(endPoint(), DatabaseDescriptor.getStoragePort(), FBUtilities.getLocalAddress(), 0); } } 
+3
source

look at https://github.com/pcmanus/ccm , they use instances of multipe cassandra on the same node. you can see how they do it.

+2
source

Source: https://habr.com/ru/post/946722/


All Articles