在尝试将外部 Play 应用程序连接到 cassandra 集群(在 mesos 上的 docker 容器上运行)时,我在这里遇到了一些奇怪的情况。
问题是:
如果我只有一个 Cassandra 节点,我可以从 Play 应用程序正确连接到它。但是,如果我向其中添加第二个节点,我将无法再连接到任何节点。
我将节点设置如下:
第一个节点(种子)
{
"id": "cassandra-seed",
"constraints": [["hostname", "CLUSTER", "docker-sl-vm"]],
"container": {
"type": "DOCKER",
"docker": {
"image": "cassandra:latest",
"network": "BRIDGE",
"portMappings": [ {"containerPort": 9042,"protocol": "tcp"} ]
}
},
"env": {
"CASSANDRA_SEED_COUNT": "1"
},
"cpus": 0.5,
"mem": 512.0,
"instances": 1,
"backoffSeconds": 1,
"backoffFactor": 1.15,
"maxLaunchDelaySeconds": 3600
}
此时,我可以将 playy 应用程序连接到 cassandra-seed。
卡桑德拉节点2
{
"id": "cassandra",
"constraints": [["hostname", "CLUSTER", "docker-sl-vm"]],
"container": {
"type": "DOCKER",
"docker": {
"image": "cassandra:latest",
"network": "BRIDGE",
"portMappings": [ {"containerPort": 9042,"protocol": "tcp"} ]
}
},
"env": {
"CASSANDRA_SEED_COUNT": "1",
"CASSANDRA_SEEDS": "cassandra-seed.marathon.mesos"
},
"cpus": 0.5,
"mem": 512.0,
"instances": 1,
"backoffSeconds": 1,
"backoffFactor": 1.15,
"maxLaunchDelaySeconds": 3600
}
此节点启动后,我无法连接到它,也无法连接到 cassandra-seed。
nodetool状态结果:
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UJ 172.17.0.3 92.91 KB 256 ? ccf83479-beed-44f5-9e36-6c997fd8855c rack1
UN 172.17.0.2 96.96 KB 256 ? 1e42609d-ba3f-4c35-80c2-424a095b4db7 rack1
看起来在第二个节点启动后,cassandra 没有绑定到该地址,并且主机不再看到它。我应该怎么办?