Can't connect to cassandra container via haproxy

不羁岁月 提交于 2019-12-08 19:43:33

I understand you're using haproxy for the service discovery of the Cassandra cluster. If so, it won't be successful if you don't have a mechanism that updates the configuration once the tasks from Marathon are changed (scaling etc.).

The problem why your Cassandra node can't talk to each other is presumably that the /cassandra app has no reference to /cassandra-seed .

According to the Cassandra Docker image docs you should be able to configure the CASSANDRA_SEEDS env parameter dynmically.

To be able to use the service name cassandra-seed.marathon.mesos if would be necessary to resolve it to an IP address first IMHO:

"CASSANDRA_SEEDS": "$(host cassandra-seed.marathon.mesos | awk '/has address/ { print $4 }')"

would theoretically work (e.g. if your app has just one instance).

As you seem to use Mesos DNS, there can be a problem because currently (v0.4.0) only internal IP addresses are advertised (see Issue). You might have to fall back to a "real" Mesos DNS client which can resolve SRV records to correctly map those to Mesos Slave IP adresses and ports.

Or, you can parse the dig results yourself and use this as an input for the CASSANDRA_SEEDS env parameter:

dig _cassandra-seed._tcp.marathon.mesos SRV

see Mesos DNS docs.

mesosdns-cli can handle this, but requires a Node.js runtime in the Docker container where it should be used. You'd therefore have to create your own derivate of the cassandra Docker image.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!