Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 5 Materials and Homework.

Registrations still open!


question

thahirmohamad_192940 avatar image
thahirmohamad_192940 asked ·

Why does starting node2 in exercise 7 of DS201 Academy return "BindException: Can't assign requested address"?

I am following the instruction on course DS201 - section 07 Ring and created two nodes and while starting node2 I get the following error:

RemoteMessageServer.java:76 - Starting internode-messaging internal message server on [/127.0.0.2]:8609
Exception (java.net.BindException) encountered during startup: Can't assign requested address
java.net.BindException: Can't assign requested address
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:479)
    at java.base/sun.nio.ch.Net.bind(Net.java:468)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:575)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358)
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019)
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:271)
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:465)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:832)
ERROR [DSE main thread] 2020-07-12 17:11:17,930 CassandraDaemon.java:901 - Exception encountered during startup
java.net.BindException: Can't assign requested address
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:479)
    at java.base/sun.nio.ch.Net.bind(Net.java:468)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:575)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358)
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019)
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:271)
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:465)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:832)
academyds201
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.

Erick Ramirez avatar image
Erick Ramirez answered ·

I've tried this on various machines with no success on replicating it:

  • Macbook Pro 16" running macOS Catalina
  • Macbook 12" running macOS High Sierra
  • Surface Pro 7 running Windows 10
  • Surface Laptop 3 running Windows 10

In multiple tests that I ran with VirtualBox using the Academy VM image for DS201 and following the instructions in exercise 7, I was able to successfully get both node1 and node2 running. In all instances, I can see that the internode port 8609 is bound to 127.0.0.2:

$ sudo lsof -nPi -sTCP:LISTEN
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd     789   root    3u  IPv4  14038      0t0  TCP *:22 (LISTEN)
sshd     789   root    4u  IPv6  14051      0t0  TCP *:22 (LISTEN)
java    2177 ubuntu  489u  IPv4  19693      0t0  TCP 127.0.0.1:8609 (LISTEN)
java    2177 ubuntu  491u  IPv4  19698      0t0  TCP 127.0.0.1:42913 (LISTEN)
java    2177 ubuntu  492u  IPv4  19699      0t0  TCP *:7199 (LISTEN)
java    2177 ubuntu  496u  IPv4  20981      0t0  TCP 127.0.0.1:9041 (LISTEN)
java    2177 ubuntu  500u  IPv4  20202      0t0  TCP 127.0.0.1:7000 (LISTEN)
java    2816 ubuntu  489u  IPv4  25732      0t0  TCP 127.0.0.2:8609 (LISTEN)
java    2816 ubuntu  491u  IPv4  25744      0t0  TCP 127.0.0.1:39882 (LISTEN)
java    2816 ubuntu  492u  IPv4  25747      0t0  TCP *:7299 (LISTEN)
java    2816 ubuntu  496u  IPv4  27026      0t0  TCP 127.0.0.1:9042 (LISTEN)
java    2816 ubuntu  500u  IPv4  26326      0t0  TCP 127.0.0.2:7000 (LISTEN)

Specifically:

java    2816 ubuntu  489u  IPv4  25732      0t0  TCP 127.0.0.2:8609 (LISTEN)

The only other time I've seen this happen is when VirtualBox itself (not DSE) is not configured correctly and is suffering from a networking issue.

From inside the VM itself, try running the following command:

$ ping localhost

If VirtualBox is working correctly, it should hit IP address 127.0.0.1. If it's hitting some other IP address like 192.x.x.x then the problem is with your PC and your PC's networking setup.

My suggestion is to:

  1. Shutdown VirtualBox.
  2. Reboot your PC.
  3. Start VirtualBox and reload the VM again.

Once the DS201 VM is up and running, run the ping test above to confirm that VirtualBox is configured correctly. 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.

bettina.swynnerton avatar image
bettina.swynnerton answered ·

Hi @thahirmohamad_192940,

there have been a few reports of issues with the multi-node setup on the VM.

Please understand that this is a compromise setup to give users a multi-node experience on a single host, and the shared ip addresses and ports seemingly can cause issues in several places.

Outside of this narrow exercise and practice scope, we do not recommend to configure a multi-node cluster in this way.

For the purpose of the ring exercise, and in the context of the exercises in DS201, I would recommend the rather blunt step of starting over: Kill all Cassandra processes on the VM, remove the node1 and node2 directories, and follow the setup instructions again, hopefully it shouldn't take that long and gets you in the right place to continue with your practice.

You can read more about the multi-node setup and the shared addresses in the answer to this post.

I hope this gets you over this hurdle and you can continue with your exercise.

Thanks for studying!

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.