cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Pieters <mjpiet...@fb.com>
Subject IPv6-only host, can't seem to get Cassandra to bind to a public port
Date Tue, 11 Apr 2017 10:37:19 GMT
I’m having issues getting a single-node Cassandra cluster to run on a Ubuntu 16.04 VM with
only IPv6 available. I’m running Oracle Java 8 (8u121-1~webupd8~2), Cassandra 3.10 (installed
via the Cassandra http://www.apache.org/dist/cassandra/debian packages.)

I consistently get a “Protocol family unavailable” exception:

ERROR [main] 2017-04-11 09:54:23,991 CassandraDaemon.java:752 - Exception encountered during
startup
java.lang.RuntimeException: java.net.SocketException: Protocol family unavailable
        at org.apache.cassandra.net.MessagingService.getServerSockets(MessagingService.java:730)
~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.net.MessagingService.listen(MessagingService.java:664) ~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.net.MessagingService.listen(MessagingService.java:648) ~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:773)
~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:666)
~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:612)
~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:394) [apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:601)
[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:735) [apache-cassandra-3.10.jar:3.10]
Caused by: java.net.SocketException: Protocol family unavailable
        at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_121]
        at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_121]
        at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_121]
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_121]
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_121]
        at org.apache.cassandra.net.MessagingService.getServerSockets(MessagingService.java:714)
~[apache-cassandra-3.10.jar:3.10]
        ... 8 common frames omitted

`lo` (loopback) has both `inet` and `inet6` addresses, but `eth0` has no `inet` addresses,
so only inet6 addr entries (both a local and a global scope address are configured).

My configuration changes:

listen_address: <local or global scope IPv6 address>
listen_interface_prefer_ipv6: true

Tracing through the source code the exception shows that it is the listen_address value above
that throws the exception, changing it back to 127.0.0.1 makes the server work again (but
then I don’t get to use it on my local network). I tried both the local and the global scope
IPv6 address.

I tried changing the JVM configuration to prefer IPv6 by editing /etc/cassandra/cassandra-env.sh:

--- etc/cassandra/cassandra-env.sh      2017-01-31 16:29:32.000000000 +0000
+++ /etc/cassandra/cassandra-env.sh     2017-04-11 09:52:51.456000000 +0000
@@ -290,6 +290,9 @@
# to the location of the native libraries.
JVM_OPTS="$JVM_OPTS -Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"

+#JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
+JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv6Addresses=true"
+
JVM_OPTS="$JVM_OPTS $MX4J_ADDRESS"
JVM_OPTS="$JVM_OPTS $MX4J_PORT"
JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"

But this makes no difference

I also tried using `listen_interface` instead, but that only changes the error message to:

    ERROR [main] 2017-04-11 10:35:16,426 CassandraDaemon.java:752 - Exception encountered
during startup: Configured listen_interface "eth0" could not be found

What else can I do?

Martijn Pieters
Mime
View raw message