You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Dikang Gu <di...@gmail.com> on 2015/11/04 18:17:45 UTC
Does datastax java driver works with ipv6 address?
Hi there,
I have ipv6 only cassandra cluster, and I'm trying to connect to it using
java driver, like:
Inet6Address inet6 = (Inet6Address)
InetAddress.getByName("2401:db00:0011:60ed:face:0000:0031:0000");
cluster = Cluster.builder().addContactPointsWithPorts(Arrays.asList(new
InetSocketAddress(inet6, 9042))).build();
session = cluster.connect(CASSANDRA_KEYSPACE);
But it failed to connect to the cassandra, looks like the java driver does
not parse the ipv6 address correctly, exceptions are:
337 [cluster1-nio-worker-0] DEBUG com.datastax.driver.core.Connection -
Connection[/2401:db00:11:60ed:face:0:31:0:9042-1, inFlight=0, closed=true]
closing connection
339 [main] DEBUG com.datastax.driver.core.ControlConnection - [Control
connection] error on /2401:db00:11:60ed:face:0:31:0:9042 connection, no
more host to try
com.datastax.driver.core.TransportException:
[/2401:db00:11:60ed:face:0:31:0:9042] Cannot connect
at
com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156)
at
com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139)
at
io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
at
io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603)
at
io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563)
at
io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424)
at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268)
at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284)
at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.net.ConnectException: Connection refused:
/2401:db00:11:60ed:face:0:31:0:9042
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:735)
at
io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
at
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281)
... 6 more
342 [main] DEBUG com.datastax.driver.core.AbstractReconnectionHandler -
First reconnection scheduled in 1000ms
342 [main] DEBUG com.datastax.driver.core.AbstractReconnectionHandler -
Becoming the active handler
342 [main] DEBUG com.datastax.driver.core.Cluster - Shutting down
Exception in thread "main"
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s)
tried for query failed (tried: /2401:db00:11:60ed:face:0:31:0:9042
(com.datastax.driver.core.TransportException:
[/2401:db00:11:60ed:face:0:31:0:9042] Cannot connect))
at
com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:223)
at
com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1272)
at com.datastax.driver.core.Cluster.init(Cluster.java:158)
at com.datastax.driver.core.Cluster.connect(Cluster.java:248)
at com.datastax.driver.core.Cluster.connect(Cluster.java:281)
--
Dikang
Re: Does datastax java driver works with ipv6 address?
Posted by Eric Stevens <mi...@gmail.com>.
The server is binding to the IPv4 "all addresses" reserved address
(0.0.0.0), but binding it as IPv4 over IPv6 (::ffff:0.0.0.0), which does
not have the same meaning as the IPv6 all addresses reserved IP (being ::,
aka 0:0:0:0:0:0:0:0).
My guess is you have an IPv4 address of 0.0.0.0 in rpc_address, and the
server is binding as instructed. Probably you just need to set rpc_address
to either :: or the node's actual IPv6 address.
On Wed, Nov 4, 2015 at 10:36 PM Dikang Gu <di...@gmail.com> wrote:
> Thanks Michael,
>
> Actually I find the problem is with the sever setup, I put "rpc_address:
> 0.0.0.0" in the config, and I find the sever bind to the address like this:
>
> tcp 0 0 :::9160 :::*
> LISTEN 2411582/java
> tcp 0 0 ::ffff:0.0.0.0:9042 :::*
> LISTEN 2411582/java
>
> So using the sever ip "2401:db00:11:60ed:face:0:31:0", I can connect to
> the thrift port 9160, but not the native port 9042. Do you know the reason
> for this?
>
> Thanks
> Dikang.
>
>
> On Wed, Nov 4, 2015 at 12:29 PM, Michael Shuler <mi...@pbandjelly.org>
> wrote:
>
>> On 11/04/2015 11:17 AM, Dikang Gu wrote:
>>
>>> I have ipv6 only cassandra cluster, and I'm trying to connect to it
>>> using java driver, like:
>>>
>>> Inet6Address inet6 = (Inet6Address)
>>> InetAddress.getByName("2401:db00:0011:60ed:face:0000:0031:0000");
>>> cluster = Cluster.builder().addContactPointsWithPorts(Arrays.asList(new
>>> InetSocketAddress(inet6,9042))).build();
>>> session =cluster.connect(CASSANDRA_KEYSPACE);
>>>
>>> But it failed to connect to the cassandra, looks like the java driver
>>> does not parse the ipv6 address correctly, exceptions are:
>>>
>>> <snip>
>>
>> Open a JIRA bug report for the java driver at:
>>
>> https://datastax-oss.atlassian.net/browse/JAVA
>>
>> As for IPv6 testing for Cassandra in general, it has been brought up, but
>> little testing is done at this time. If you have some contributions to be
>> made in this area, I'm sure they would be greatly appreciated. You are in a
>> relatively unique position with an IPv6-only cluster, so your input is
>> valuable.
>>
>>
>>
>> https://issues.apache.org/jira/issues/?jql=project%20%3D%20CASSANDRA%20AND%20text%20~%20ipv6%20AND%20status%20!%3D%20Resolved
>>
>> --
>> Kind regards,
>> Michael
>>
>>
>
>
> --
> Dikang
>
>
Re: Does datastax java driver works with ipv6 address?
Posted by Dikang Gu <di...@gmail.com>.
Thanks Michael,
Actually I find the problem is with the sever setup, I put "rpc_address:
0.0.0.0" in the config, and I find the sever bind to the address like this:
tcp 0 0 :::9160 :::*
LISTEN 2411582/java
tcp 0 0 ::ffff:0.0.0.0:9042 :::*
LISTEN 2411582/java
So using the sever ip "2401:db00:11:60ed:face:0:31:0", I can connect to the
thrift port 9160, but not the native port 9042. Do you know the reason for
this?
Thanks
Dikang.
On Wed, Nov 4, 2015 at 12:29 PM, Michael Shuler <mi...@pbandjelly.org>
wrote:
> On 11/04/2015 11:17 AM, Dikang Gu wrote:
>
>> I have ipv6 only cassandra cluster, and I'm trying to connect to it
>> using java driver, like:
>>
>> Inet6Address inet6 = (Inet6Address)
>> InetAddress.getByName("2401:db00:0011:60ed:face:0000:0031:0000");
>> cluster = Cluster.builder().addContactPointsWithPorts(Arrays.asList(new
>> InetSocketAddress(inet6,9042))).build();
>> session =cluster.connect(CASSANDRA_KEYSPACE);
>>
>> But it failed to connect to the cassandra, looks like the java driver
>> does not parse the ipv6 address correctly, exceptions are:
>>
>> <snip>
>
> Open a JIRA bug report for the java driver at:
>
> https://datastax-oss.atlassian.net/browse/JAVA
>
> As for IPv6 testing for Cassandra in general, it has been brought up, but
> little testing is done at this time. If you have some contributions to be
> made in this area, I'm sure they would be greatly appreciated. You are in a
> relatively unique position with an IPv6-only cluster, so your input is
> valuable.
>
>
>
> https://issues.apache.org/jira/issues/?jql=project%20%3D%20CASSANDRA%20AND%20text%20~%20ipv6%20AND%20status%20!%3D%20Resolved
>
> --
> Kind regards,
> Michael
>
>
--
Dikang
Re: Does datastax java driver works with ipv6 address?
Posted by Michael Shuler <mi...@pbandjelly.org>.
On 11/04/2015 11:17 AM, Dikang Gu wrote:
> I have ipv6 only cassandra cluster, and I'm trying to connect to it
> using java driver, like:
>
> Inet6Address inet6 = (Inet6Address) InetAddress.getByName("2401:db00:0011:60ed:face:0000:0031:0000");
> cluster = Cluster.builder().addContactPointsWithPorts(Arrays.asList(new InetSocketAddress(inet6,9042))).build();
> session =cluster.connect(CASSANDRA_KEYSPACE);
>
> But it failed to connect to the cassandra, looks like the java driver
> does not parse the ipv6 address correctly, exceptions are:
>
<snip>
Open a JIRA bug report for the java driver at:
https://datastax-oss.atlassian.net/browse/JAVA
As for IPv6 testing for Cassandra in general, it has been brought up,
but little testing is done at this time. If you have some contributions
to be made in this area, I'm sure they would be greatly appreciated. You
are in a relatively unique position with an IPv6-only cluster, so your
input is valuable.
https://issues.apache.org/jira/issues/?jql=project%20%3D%20CASSANDRA%20AND%20text%20~%20ipv6%20AND%20status%20!%3D%20Resolved
--
Kind regards,
Michael