We are programmatically creating Cassandra nodes (auto-generating yaml and using CassandraDaemon
). Ideally we would be able to use different ports on different hosts due to configuration needs. Is this possible (via seed specification or implementation of a custom class)? It seems that the seeds list can only take IP addresses and not ports.
What ports does Cassandra use? By default, Cassandra uses 7000 for cluster communication (7001 if SSL is enabled), 9042 for native protocol clients, and 7199 for JMX.
As we said earlier, each instance of Cassandra has evolved to contain 256 virtual nodes. The Cassandra server runs core processes. For example, processes like spreading replicas around nodes or routing requests.
Cassandra uses a protocol called gossip to discover location and state information about the other nodes participating in a Cassandra cluster. Gossip is a peer-to-peer communication protocol in which nodes periodically exchange state information about themselves and about other nodes they know about.
After looking at the relevant source in the Cassandra network code, it is apparent 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 provide a different value per host or any hook to do so:
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);
}
}
take a look at https://github.com/pcmanus/ccm , they are using multipe cassandra instances on the same node. you can see how they are doing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With