sudo docker run --name dc101 -P -d -e CASSANDRA_CLUSTER_NAME="Cluster1" -e
CASSANDRA_DC="datacenter1" -e CASSANDRA_RACK="rc1" -e
CASSANDRA_ENDPOINT_SNITCH="GossipingPropertyFileSnitch" -e
CASSANDRA_RPC_ADDRESS="<IPOfUbuntu>" -e CASSANDRA_BROADCAST_ADDRESS="
<IPOfUbuntu>" -p 9042:9042 cassandra:latest
我在ubuntu上使用docker。并尝试创建一个cassandra节点。上述命令成功运行并创建一个节点。但无法从其他系统连接。我能够从同一台机器连接。如果我telnet到9042,它没有连接。
谢谢!
以下是错误日志----
INFO 04:00:18 Using Netty Version: [netty-buffer=netty-buffer-4.0.39.Final.38bdf86, netty-codec=netty-codec-4.0.39.Final.38bdf86, netty-codec-haproxy=netty-codec-haproxy-4.0.39.Final.38bdf86, netty-codec-http=netty-codec-http-4.0.39.Final.38bdf86, netty-codec-socks=netty-codec-socks-4.0.39.Final.38bdf86, netty-common=netty-common-4.0.39.Final.38bdf86, netty-handler=netty-handler-4.0.39.Final.38bdf86, netty-tcnative=netty-tcnative-1.1.33.Fork19.fe4816e, netty-transport=netty-transport-4.0.39.Final.38bdf86, netty-transport-native-epoll=netty-transport-native-epoll-4.0.39.Final.38bdf86, netty-transport-rxtx=netty-transport-rxtx-4.0.39.Final.38bdf86, netty-transport-sctp=netty-transport-sctp-4.0.39.Final.38bdf86, netty-transport-udt=netty-transport-udt-4.0.39.Final.38bdf86]
INFO 04:00:18 Starting listening for CQL clients on /10.24.112.136:9042 (unencrypted)...
Exception (java.lang.IllegalStateException) encountered during startup: Failed to bind port 9042 on 10.24.112.136.
java.lang.IllegalStateException: Failed to bind port 9042 on 10.24.112.136.
at org.apache.cassandra.transport.Server.start(Server.java:164)
at java.util.Collections$SingletonSet.forEach(Collections.java:4767)
at org.apache.cassandra.service.NativeTransportService.start(NativeTransportService.java:128)
at org.apache.cassandra.service.CassandraDaemon.startNativeTransport(CassandraDaemon.java:649)
at org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:511)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:616)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:730)
ERROR 04:00:18 Exception encountered during startup
java.lang.IllegalStateException: Failed to bind port 9042 on 10.24.112.136.
at org.apache.cassandra.transport.Server.start(Server.java:164) ~[apache-cassandra-3.9.jar:3.9]
at java.util.Collections$SingletonSet.forEach(Collections.java:4767) ~[na:1.8.0_111]
at org.apache.cassandra.service.NativeTransportService.start(NativeTransportService.java:128) ~[apache-cassandra-3.9.jar:3.9]
at org.apache.cassandra.service.CassandraDaemon.startNativeTransport(CassandraDaemon.java:649) [apache-cassandra-3.9.jar:3.9]
at org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:511) [apache-cassandra-3.9.jar:3.9]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:616) [apache-cassandra-3.9.jar:3.9]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:730) [apache-cassandra-3.9.jar:3.9]
INFO 04:00:18 Announcing shutdown
答案 0 :(得分:0)
您的描述错误“上述命令成功运行并创建节点”。它根据您的日志不起作用
ERROR 04:00:18 Exception encountered during startup
INFO 04:00:18 Announcing shutdown
我认为这是因为rpc_address
应该映射到docker容器的私有IP,而不是宿主。最好将其保留为默认值
sudo docker run --name dc101 -P -d -e CASSANDRA_CLUSTER_NAME="Cluster1" -e
CASSANDRA_DC="datacenter1" -e CASSANDRA_RACK="rc1" -e
CASSANDRA_ENDPOINT_SNITCH="GossipingPropertyFileSnitch" -e CASSANDRA_BROADCAST_ADDRESS="
<IPOfUbuntu>" -p 9042:9042 cassandra:latest