com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] 无法连接
com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] Cannot connect
我在 Cassandra 集群中有 2 个节点 IP:Port aa.aaa.a.aaa:9043(node) 和 xx.xxx.x.xxx:9043。当我尝试使用以下配置进行连接时 **PoolingOptions poolingOptions = new PoolingOptions();
poolingOptions.setCoreConnectionsPerHost(HostDistance.LOCAL, 2)
.setMaxConnectionsPerHost(HostDistance.LOCAL, 4)
.setCoreConnectionsPerHost(HostDistance.REMOTE, 2)
.setMaxConnectionsPerHost(HostDistance.REMOTE, 4)
.setMaxRequestsPerConnection(HostDistance.LOCAL, 200)
.setMaxRequestsPerConnection(HostDistance.REMOTE, 200);
cluster = Cluster.builder()
.addContactPointsWithPorts(socketAddressList)
.withPoolingOptions(poolingOptions)
.withRetryPolicy(DefaultRetryPolicy.INSTANCE)
.withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy())).build();
Session session = cluster.connect(cassandraDB);**
我收到以下异常 16/01/14 09:52:45 信息 core.NettyUtil:在类路径中未找到 Netty 的本机 epoll 传输,默认为 NIO。
2014 年 1 月 16 日 09:52:46 警告 core.Cluster:***您在联系点中列出了 /xx.xxx.x.xxx:9043,但在启动时无法联系到它*
16/01/14 09:52:47 信息 policies.DCAwareRoundRobinPolicy:为 DCAwareRoundRobinPolicy 使用数据中心名称 'name'(如果不正确,请使用 DCAwareRoundRobinPolicy 构造函数提供正确的数据中心名称)ent.Futures $CombinedFuture setExceptionAndMaybeLog
严重:输入未来失败。
com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] 无法连接
在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156)
在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139)
在 io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
在 io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603)
在 io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563)
在 io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284)
在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
在 io.netty.channel.nio.NioEventLoop.processSelectedKeys 优化(NioEventLoop.java:468)
在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
在 io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
在 java.lang.Thread.run(Thread.java:745)
原因:java.net.ConnectException:连接被拒绝:/xx.xxx.x.xxx:9042
在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)
在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
在 io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281)
... 还有 6 个
16/01/14 09:52:47 错误 core.Session:创建池到 /xx.xxx.x.xxx:9042 时出错
com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] 无法连接
在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156)
在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139)
在 io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
在 io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603)
在 io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563)
在 io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284)
在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
在 io.netty.channel.nio.NioEventLoop.processSelectedKeys 优化(NioEventLoop.java:468)
在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
在 io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
在 java.lang.Thread.run(Thread.java:745)
原因:java.net.ConnectException:连接被拒绝:/xx.xxx.x.xxx:9042
在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)
在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
在 io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281)**
我的问题是:
- 为什么它尝试连接端口 9042,而我在代码和配置文件中没有使用此端口?
卡桑德拉版本:卡桑德拉 2.2.1
why it is trying to connect on port 9042, while no where i am using this port in code as well as in config file ?
9042 是 CQL 二进制协议的默认端口。
你能告诉我们你传递给集群构建器的变量 socketAddressList 的内容吗?
您使用端口 9043 而不是默认端口 9042 有什么原因吗?
我在 Cassandra 集群中有 2 个节点 IP:Port aa.aaa.a.aaa:9043(node) 和 xx.xxx.x.xxx:9043。当我尝试使用以下配置进行连接时 **PoolingOptions poolingOptions = new PoolingOptions(); poolingOptions.setCoreConnectionsPerHost(HostDistance.LOCAL, 2) .setMaxConnectionsPerHost(HostDistance.LOCAL, 4) .setCoreConnectionsPerHost(HostDistance.REMOTE, 2) .setMaxConnectionsPerHost(HostDistance.REMOTE, 4) .setMaxRequestsPerConnection(HostDistance.LOCAL, 200) .setMaxRequestsPerConnection(HostDistance.REMOTE, 200);
cluster = Cluster.builder()
.addContactPointsWithPorts(socketAddressList)
.withPoolingOptions(poolingOptions)
.withRetryPolicy(DefaultRetryPolicy.INSTANCE)
.withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy())).build();
Session session = cluster.connect(cassandraDB);**
我收到以下异常 16/01/14 09:52:45 信息 core.NettyUtil:在类路径中未找到 Netty 的本机 epoll 传输,默认为 NIO。 2014 年 1 月 16 日 09:52:46 警告 core.Cluster:***您在联系点中列出了 /xx.xxx.x.xxx:9043,但在启动时无法联系到它* 16/01/14 09:52:47 信息 policies.DCAwareRoundRobinPolicy:为 DCAwareRoundRobinPolicy 使用数据中心名称 'name'(如果不正确,请使用 DCAwareRoundRobinPolicy 构造函数提供正确的数据中心名称)ent.Futures $CombinedFuture setExceptionAndMaybeLog 严重:输入未来失败。 com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] 无法连接 在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156) 在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139) 在 io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) 在 io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603) 在 io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563) 在 io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284) 在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys 优化(NioEventLoop.java:468) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) 在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) 在 io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) 在 java.lang.Thread.run(Thread.java:745) 原因:java.net.ConnectException:连接被拒绝:/xx.xxx.x.xxx:9042 在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法) 在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744) 在 io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281) ... 还有 6 个
16/01/14 09:52:47 错误 core.Session:创建池到 /xx.xxx.x.xxx:9042 时出错 com.datastax.driver.core.TransportException: [/xx.xxx.x.xxx:9042] 无法连接 在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:156) 在 com.datastax.driver.core.Connection$1.operationComplete(Connection.java:139) 在 io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) 在 io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603) 在 io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563) 在 io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:268) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284) 在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys 优化(NioEventLoop.java:468) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) 在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) 在 io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) 在 java.lang.Thread.run(Thread.java:745) 原因:java.net.ConnectException:连接被拒绝:/xx.xxx.x.xxx:9042 在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法) 在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744) 在 io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224) 在 io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281)**
我的问题是:
- 为什么它尝试连接端口 9042,而我在代码和配置文件中没有使用此端口?
卡桑德拉版本:卡桑德拉 2.2.1
why it is trying to connect on port 9042, while no where i am using this port in code as well as in config file ?
9042 是 CQL 二进制协议的默认端口。
你能告诉我们你传递给集群构建器的变量 socketAddressList 的内容吗?
您使用端口 9043 而不是默认端口 9042 有什么原因吗?