nik avatar image
nik asked Erick Ramirez answered

Not able to add node, getting "BindException: Address already in use"

I'm studying DS201, and I stucked at adding second node to the DC. The problem is that I have a bit different leptop setup for cassandra. I've already had installed cassandra on my mashine with Ubuntu OS at /etc/cassandra.And I treat it as node1 from exercise.

Problem 1: step 2 from exercise said that cassandra node should be deleted:

Delete the /home/ubuntu/node folder by executing the following commands:
cd /home/ubuntu
rm -rf node

But in video lecture it was said that we may add nodes without stopping server. And because I don't have this /home/ubuntu/node I didn't delete it. And I don't want to delete /etc/cassandra installation (my node1).

Problem 2: I can't find resources with:

tar -xf dse-6.0.0-bin.tar.gz

In order to look what cassandra.yaml properties it has.

Problem 3: I have free version of cassandra, not dse (but it should not be a problem).

Steps I did:

1)I downloaded apache-cassandra-4.0-beta and unzip it in my home folder (it will be my node 2)

2) I did by instruction: edited node 2 cassandra.yaml and added

initial_token: 9223372036854775807
num_tokens: 1

3) restarted node 1 and run nodetool status:

but here I have differencies: I don't have "Token" = 0. Instead of it I have "Tokens" = 16.

nik@dell-xps:~$ nodetool status
Datacenter: datacenter1
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 11.9 MiB 16 ? 6c6987d2-50b4-4b4b-bd78-a96ba00aab7e rack1

4) Trying to run node 2:

nik@dell-xps:~/cassandra_node2/apache-cassandra-4.0-beta4/bin$ /home/nik/cassandra_node2/apache-cassandra-4.0-beta4/bin/cassandra

ERROR [main] 2021-04-12 22:06:51,450 - Port already in use: 7199; nested exception is: Address already in use (Bind failed)
    at Method)
    at org.apache.cassandra.utils.RMIServerSocketFactoryImpl.createServerSocket(
    at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(
    at sun.rmi.transport.tcp.TCPTransport.listen(
    at sun.rmi.transport.tcp.TCPTransport.exportObject(
    at sun.rmi.transport.tcp.TCPEndpoint.exportObject(
    at sun.rmi.transport.LiveRef.exportObject(
    at sun.rmi.server.UnicastServerRef.exportObject(
    at sun.rmi.registry.RegistryImpl.setup(
    at sun.rmi.registry.RegistryImpl.<init>(
    at sun.rmi.registry.RegistryImpl.<init>(
    at org.apache.cassandra.utils.JMXServerUtils$JmxRegistry.<init>(
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(
    at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(
    at org.apache.cassandra.service.CassandraDaemon.setup(
    at org.apache.cassandra.service.CassandraDaemon.activate(
    at org.apache.cassandra.service.CassandraDaemon.main(

I've read that nodes should use different ports. But don't know how to do this.

ds201add nodes
1 comment
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

nik avatar image nik commented ·

Updates: I changed node 2 with


and now there is another error:

Fatal configuration error; unable to start server.  See log for stacktrace.
ERROR [main] 2021-04-12 22:28:03,001 - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: localhost/ is in use by another process.  Change listen_address:storage_port in cassandra.yaml to values that do not conflict with other services

how to handle this?

0 Likes 0 ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

As the error suggests, you tried to start another process that is configured with the same ports as another process which already has the ports bound.

This isn't strictly a Cassandra issue -- this happens for any application since it is not possible to have multiple app/processes/daemons to share the same ports. You will need to configure the second instance to use completely different ports.

It appears you don't have Linux experience and are new to Cassandra. My recommendation is to download the VM image for the DS201 course. It is not possible to follow the course instructions without using the VM image since the configuration for the course is specific to the VM image.

You will only be able to do it on your own if you are an experienced Linux admin and Cassandra operator which defeats the purpose of doing the course. The whole idea with DS201 is to teach you how to configure Cassandra nodes bit-by-bit in a guided fashion. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.