ERROR Session: Error creating pool to /127.0.0.1:9

2020-02-29 23:56发布

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!

1条回答
\"骚年 ilove
2楼-- · 2020-03-01 00:43

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.

查看更多
登录 后发表回答