我使用以下命令启动了一个cassandra docker映像,
docker run --name=n1 -d cassandra:3.11.4
344138bb96e5326113af6ba5c44a17d8b40ed710fe36ce063677a56ef0c0117
这个很好用,
docker exec -it n1 nodetool status gives,
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.17.0.2 103.7 KiB 256 100.0% 0ca2907d-49b9-4ed4-8bf3-6db99d0c8b45 rack1
现在当我尝试启动第二个节点时,我得到的是,
docker inspect -f '{{ .NetworkSettings.IPAddress}}' n1
172.17.0.2
docker run --name n2 -d cassandra:3.11.4 -seeds 172.17.0.2
1c89b67cb61b049c4a8ae0f21bd0f7cddffad02b7e7964e502cd82e0d2ff2866
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
344138bb96e5 cassandra:3.11.4 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp n1
docker exec -it n1 nodetool status
仍然没有第二个节点
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.17.0.2 103.7 KiB 256 100.0% 0ca2907d-49b9-4ed4-8bf3-6db99d0c8b45 rack1
docker exec -it n2 nodetool status
Error response from daemon: Container 1c89b67cb61b049c4a8ae0f21bd0f7cddffad02b7e7964e502cd82e0d2ff2866 is not running
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1c89b67cb61b cassandra:3.11.4 "docker-entrypoint.s…" 2 minutes ago Exited (1) 2 minutes ago n2
344138bb96e5 cassandra:3.11.4 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp n1
我做错什么了?
1条答案
按热度按时间a14dhokn1#
我不知道你从哪里得到你可以利用的信息
-seeds 172.17.0.2
要在这个docker映像中指定seed,实际上检查n2的日志,它说:医生说,
CASSANDRA_SEEDS
env是正确的方法,如下所示:结果:
稍等片刻,再检查,我们发现集群现在有2个节点: