我为couchbase创建了docker image。我能够运行独立的couchbase图像它工作正常但是在使用它与docker-compose(Storm)时它会给我以下错误:
couchbase_1 | Note: Unnecessary use of -X or --request, POST is already inferred.
couchbase_1 | * Trying 127.0.0.1...
couchbase_1 | % Total % Received % Xferd Average Speed Time Time Time Current
couchbase_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connect to 127.0.0.1 port 8091 failed: Connection refused
couchbase_1 | * Failed to connect to 127.0.0.1 port 8091: Connection refused
couchbase_1 | * Closing connection 0
couchbase_1 | curl: (7) Failed to connect to 127.0.0.1 port 8091: Connection refused
stormcluster_couchbase_1 exited with code 7
我从docker文件调用configure.sh文件,该文件中的curl命令如下:
curl --fail -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300
curl --fail -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex
curl --fail -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=XXX-d password=XXX
这是我的yaml文件:
couchbase:
image: xyz/test
ports:
- "8091:8091"
- "22"
zookeeper:
image: xyz/storm-zookeeper
ports:
- "49181:2181"
- "22"
nimbus:
image: xyz/storm-nimbus
ports:
- "49773:3773"
- "49772:3772"
- "49627:6627"
- "22"
links:
- zookeeper:zk
- couchbase:cb
supervisor:
image: xyz/storm-supervisor
ports:
- "8000"
- "22"
links:
- nimbus:nimbus
- zookeeper:zk
- couchbase:cb
- couchbase:couchbase.docker
ui:
image: xyz/storm-ui
ports:
- "49080:8080"
- "22"
links:
- nimbus:nimbus
- zookeeper:zk
- couchbase:cb
- couchbase:couchbase.docker
答案 0 :(得分:0)
这是我的yaml文件:
couchbase: 图像:xyz / test 端口: - “8091:8091” - “22” 饲养员: image:xyz / storm-zookeeper 端口: - “49181:2181” - “22” 雨云: image:xyz / storm-nimbus 端口: - “49773:3773” - “49772:3772” - “49627:6627” - “22” 链接: - zookeeper:zk - couchbase:cb 监事: image:xyz / storm-supervisor 端口: - “8000” - “22” 链接: - nimbus:nimbus - zookeeper:zk - couchbase:cb - couchbase:couchbase.docker 用户界面: image:xyz / storm-ui 端口: - “49080:8080” - “22” 链接: - nimbus:nimbus - zookeeper:zk - couchbase:cb - couchbase:couchbase.docker
答案 1 :(得分:0)
从我所看到的,您正尝试使用localhost
从另一个容器访问一个容器。这不起作用。
您正在使用容器链接,这将允许容器彼此通信。
正在运行的脚本正在尝试访问caouchbase db。您需要将localhost
或127.0.0.1
替换为cb
作为您在composefile中指定的主机名别名。
因此,将http://127.0.0.1:8091
替换为http://cb:8091
,连接应该有效。