我有一组作为docker容器运行的微服务。一个微服务说,A想连接到我的笔记本电脑本地运行的cassnadra。为了做到这一点,我有以下的配置服务A将本地cassandra集群与docker容器连接起来
cassandra:
hosts: [127.0.0.1]
keyspace: "My keyspace"
protocol_version: 3
ports: 9042
在另一边,我通过调用./bin/cassandra跑卡桑德拉
从YAML片断文件。然后我连接到本地cqlsh其输出如下
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.6 | CQL spec 3.4.0 | Native protocol v4]
Use HELP for help.
现在,当我的容器来了,并尝试连接到托管在我的机器上运行这个卡桑德拉它说是说拒绝连接。请参阅下面
File "cassandra/cluster.py", line 2076, in cassandra.cluster.ControlConnection._reconnect_internal (cassandra/cluster.c:36914)
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'127.0.0.1': ConnectionRefusedError(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
[start] application exit with code 1, killing container
更多信息 跟踪我使用Apache的卡桑德拉 - 3.0.6。
请指教。由于
你如何在你的本地环境中运行docker-daemon?如果您使用的是Oracle虚拟机或Docker机器,您是否可以进入机器并检查您是否可以访问cassandra服务? – Shibashis