DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

nik avatar image
nik asked ·

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
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 127.0.0.1 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 CassandraDaemon.java:822 - Port already in use: 7199; nested exception is: 
java.net.BindException: Address already in use (Bind failed)
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
    at java.net.ServerSocket.bind(ServerSocket.java:390)
    at java.net.ServerSocket.<init>(ServerSocket.java:252)
    at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
    at org.apache.cassandra.utils.RMIServerSocketFactoryImpl.createServerSocket(RMIServerSocketFactoryImpl.java:42)
    at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
    at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
    at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:254)
    at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
    at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
    at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:237)
    at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:213)
    at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:173)
    at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:144)
    at org.apache.cassandra.utils.JMXServerUtils$JmxRegistry.<init>(JMXServerUtils.java:336)
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.java:94)
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.java:149)
    at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.java:171)
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:230)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:676)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:800)

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

ds201add nodes
1 comment
10 |1000 characters needed characters left characters exceeded

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

Updates: I changed node 2 cassandra-env.sh with

JMX_PORT="7299"

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 CassandraDaemon.java:822 - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: localhost/127.0.0.1:7000 is in use by another process.  Change listen_address:storage_port in cassandra.yaml to values that do not conflict with other services
at org.apache.cassandra.net.InboundConnectionInitiator.bind(InboundConnectionInitiator.java:156)
at org.apache.cassandra.net.InboundConnectionInitiator.bind(InboundConnectionInitiator.java:178)
at org.apache.cassandra.net.InboundSockets$InboundSocket.open(InboundSockets.java:98)
at org.apache.cassandra.net.InboundSockets$InboundSocket.open(InboundSockets.java:85)
at org.apache.cassandra.net.InboundSockets$InboundSocket.access$200(InboundSockets.java:48

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!

Share
10 |1000 characters needed characters left characters exceeded

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