无法连接到cassandra集群,但可以连接到单个节点吗?

时间:2015-12-15 17:16:51

标签: docker cassandra mesos marathon akka-persistence

我在尝试将外部Play应用程序连接到cassandra集群(通过mesos在docker容器上运行)时遇到了一些奇怪的情况。

问题是:

如果我只有一个Cassandra节点,我可以从Play应用程序正确连接到它。但是,如果我向其添加第二个节点,我将无法再连接到任何节点。

我将节点设置如下:

第一个节点(SEED)

{
    "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 app连接到cassandra-seed。

CASSANDRA NODE2

{
    "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 status 结果:

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没有绑定到该地址,主机停止看到它。我该怎么办?

0 个答案:

没有答案