Search code examples
cassandradatastax

Can't start Cassandra server with public IP(Port 7000 error)


I'm seting up cassandra server on centos 6.8 and change to public IP by using https://stackoverflow.com/a/17164723/10206109 method but it stuck when start server with cassandra -f -R and I got this error:

ERROR [main] 2019-09-10 11:42:31,684 CassandraDaemon.java:749 - Fatal 
configuration error
org.apache.cassandra.exceptions.ConfigurationException: Unable to bind to 
address /<public ip>:7000. Set listen_address in cassandra.yaml to an 
interface you can bind to, e.g., your private IP address on EC2
    at org.apache.cassandra.net.MessagingService.getServerSockets(MessagingService.java:739) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.net.MessagingService.listen(MessagingService.java:681) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.net.MessagingService.listen(MessagingService.java:665) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:796) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:683) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:632) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:388) [apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:620) [apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:732) [apache-cassandra-3.11.4.jar:3.11.4]

I try to change in /cassandra.yaml

rpc_address: 0.0.0.0
listen_address: <public ip>
broadcast_rpc_address: <public ip>

but it still stuck in this point


Solution

  • rpc_address and broadcast_rpc_address are the addresses for clients, but you need to configure internode communication instead.

    The DataStax documentation says (same for OSS Cassandra):

    1. In the cassandra.yaml, set the listen_address to the private IP address of the node, and the broadcast_address to the public IP address of the node. This allows DataStax Enterprise nodes in one EC2 region to bind to nodes in another region, thus enabling multiple datacenter support. For intra-region traffic, DataStax Enterprise switches to the private IP after establishing a connection.

    2. Set the addresses of the seed nodes in the cassandra.yaml file to that of the public IP. Private IP are not routable between networks. For example: