错误会话:创建池到/127.0.0.1:9042时出错 [英] ERROR Session: Error creating pool to /127.0.0.1:9042

查看:930
本文介绍了错误会话:创建池到/127.0.0.1:9042时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试在cassandra中插入值时遇到此错误:

  15/08/14 10:21 :54 INFO集群:新Cassandra主机/ abcd:9042添加
15/08/14 10:21:54 INFO集群:新Cassandra主机/127.0.0.1:9042添加
INFO CassandraConnector:连接到Cassandra cluster:测试集群
15/08/14 10:21:54错误会话:创建池到/127.0.0.1:9042错误
com.datastax.driver.core.TransportException:[/127.0.0.1 :9042]无法在com.datastax.driver.core.Connection连接
。< init>(Connection.java:109)
at com.datastax.driver.core.PooledConnection。< init> (PooledConnection.java:32)
at com.datastax.driver.core.Connection $ Factory.open(Connection.java:586)
at com.datastax.driver.core.SingleConnectionPool。< init> ;(SingleConnectionPool.java:76)
at com.datastax.driver.core.HostConnectionPool.newInstance(HostConnectionPool.java:35)
at com.datastax.driver.core.SessionManager.replacePool(SessionManager。 java:271)
at com.datastax.driver.core.SessionManager.access $ 400(SessionManager.java:40)
at com.datastax.driver.core.SessionManager $ 3.call(SessionManager.java: 308)
at com.datastax.driver.core.SessionManager $ 3.call(SessionManager.java:300)
at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
在java.util。 concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:603)
在java.lang.Thread.run(Thread.java:722)
引发者:java.net.ConnectException:Connection refused:/ 127.0.0.1:9042

我的复制因子是1. Cass集群中有5个节点're all up)。 rpc_address:0.0.0.0,broadcast_rpc_address:127.0.0.1



我认为我应该看到其中5个INFO Cluster:New Cassandra host ..每个5个节点。 但我看到127.0.0.1,我不知道为什么。



我也注意到,在cassandra.yaml文件,节点列在种子下。 (我知道是不建议,但我没有设置这个集群)

  seed_provider:
class_name:org。 apache.cassandra.locator.SimpleSeedProvider
parameters:
seeds:ip1,ip2,ip3,ip4,ip5

其中ipx是节点x的ipaddr。



在cassandra-topology.properties下,它只是说下面的内容,

 #未知节点的默认值

default = DC1:r1

有人可以解释为什么我看到错误会话:错误创建池,以/127.0.0.1:9042错误。 / p>

Cassandra的新增功能。

解决方案

我想问题是你的rpc_broadcast_address设置为127.0.0.1。有什么原因,特别是你这样做吗?



java驱动程序使用system.peers表来查找用于连接到主机的ip地址。如果设置rpc_broadcast_address这是system.peers中将存在,驱动程序将尝试使用它。如果未设置rpc_broadcast_address,将使用rpc_address。无论哪种情况,您都需要将其中一个地址设置为客户端可以访问的地址。如果设置rpc_address,您将要删除broadcast_rpc_address。


I am trying to insert values in cassandra when I come across this error:

15/08/14 10:21:54 INFO Cluster: New Cassandra host /a.b.c.d:9042 added
15/08/14 10:21:54 INFO Cluster: New Cassandra host /127.0.0.1:9042 added
INFO CassandraConnector: Connected to Cassandra cluster: Test Cluster
15/08/14 10:21:54 ERROR Session: Error creating pool to /127.0.0.1:9042
com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect
        at com.datastax.driver.core.Connection.<init>(Connection.java:109)
        at com.datastax.driver.core.PooledConnection.<init>(PooledConnection.java:32)
        at com.datastax.driver.core.Connection$Factory.open(Connection.java:586)
        at com.datastax.driver.core.SingleConnectionPool.<init>(SingleConnectionPool.java:76)
        at com.datastax.driver.core.HostConnectionPool.newInstance(HostConnectionPool.java:35)
        at com.datastax.driver.core.SessionManager.replacePool(SessionManager.java:271)
        at com.datastax.driver.core.SessionManager.access$400(SessionManager.java:40)
        at com.datastax.driver.core.SessionManager$3.call(SessionManager.java:308)
        at com.datastax.driver.core.SessionManager$3.call(SessionManager.java:300)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.net.ConnectException: Connection refused: /127.0.0.1:9042

My replication factor is 1. There are 5 nodes in the Cass cluster (they're all up). rpc_address: 0.0.0.0, broadcast_rpc_address: 127.0.0.1

I would think that I should see 5 of those "INFO Cluster: New Cassandra host.." line from above for each of the 5 nodes. But instead I see 127.0.0.1, I am not sure why.

I also noticed that in the cassandra.yaml file, all the 5 nodes are listed under seed. (which I know is not advised but I did not set up this cluster)

seed_provider:
class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
seeds: "ip1, ip2, ip3, ip4, ip5"

Where ipx is the ipaddr for node x.

And under cassandra-topology.properties it just says the following and does not mention any of the 5 nodes.

# default for unknown nodes                                                                                                                     

default=DC1:r1

Can someone explain why I am seeing the ERROR Session: Error creating pool to /127.0.0.1:9042 error.

Kind of new to Cassandra.. thanks in advance!

解决方案

I think the problem is your rpc_broadcast_address is set to 127.0.0.1. Is there a reason in particular you are doing this?

The java driver uses the system.peers table to look up the ip address to use to connect to hosts. If rpc_broadcast_address is set this is what will be present in system.peers and the driver will try to use it. If rpc_broadcast_address is not set, rpc_address will be used. In either case, you'll want to set one of these addresses to an address that will be accessible by your client. If you set rpc_address, you will want to remove broadcast_rpc_address.

这篇关于错误会话:创建池到/127.0.0.1:9042时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆