我正在尝试将CB和同步网关示例放入Docker中。我设法启动了CB服务器(定义的存储桶、用户等),但在执行以下Docker命令后SG失败并显示以下错误消息:
docker run -p 4984:4984 -d couchbase/sync-gateway https://config/sg-config.json
错误消息为:
~ % docker logs unruffled_jennings
2023-03-02T13:54:22.004Z ==== Couchbase Sync Gateway/3.0.5(8;godeps/) EE ====
2023-03-02T13:54:22.005Z [INF] Loading content from [https://config/sg-config.json] ...
2023-03-02T13:54:22.879Z [INF] Found unknown fields in startup config. Attempting to read as legacy config.
2023-03-02T13:54:22.879Z [INF] Loading content from [https://config/sg-config.json] ...
2023-03-02T13:54:23.070Z [INF] Config is a legacy config, and disable_persistent_config was not requested. Attempting automatic config upgrade.
2023-03-02T13:54:23.075Z [WRN] gocb: Pipeline Client 0x40002940e0 failed to bootstrap: check server ports and cluster encryption setting: dial tcp 127.0.0.1:11210: connect: connection refused -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:26.075Z [WRN] gocb: CCCPPOLL: Failed to retrieve CCCP config. check server ports and cluster encryption setting: dial tcp 127.0.0.1:11210: connect: connection refused -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:26.075Z [WRN] gocb: CCCPPOLL: Failed to retrieve config from any node. -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:28.076Z [WRN] gocb: Pipeline Client 0x40002940e0 failed to bootstrap: check server ports and cluster encryption setting: dial tcp 127.0.0.1:11210: connect: connection refused -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:31.582Z [WRN] gocb: CCCPPOLL: Failed to retrieve CCCP config. check server ports and cluster encryption setting: dial tcp 127.0.0.1:11210: connect: connection refused -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:31.582Z [WRN] gocb: CCCPPOLL: Failed to retrieve config from any node. -- base.GoCBCoreLogger.Log() at logger_external.go:80
2023-03-02T13:54:33.075Z [ERR] Couldn't start Sync Gateway: unambiguous timeout | {"InnerError":{"InnerError":{"InnerError":{},"Message":"unambiguous timeout"}},"OperationID":"WaitUntilReady","Opaque":"","TimeObserved":10000218462,"RetryReasons":["NOT_READY"],"RetryAttempts":15,"LastDispatchedTo":"","LastDispatchedFrom":"","LastConnectionID":""} -- rest.ServerMain() at main.go:26
Couchbase服务器在其自己的容器中成功运行,我可以访问管理员Web UI和配置的用户和bucket。
config.json为:
{
"log": [
""
],
"databases": {
"db": {
"server": "http://127.0.0.1:8091",
"bucket": "test_bucket",
"username": "username",
"password": "pwdpwdpwd",
"enable_shared_bucket_access": true,
"num_index_replicas": 0,
"import_docs": true,
"users": {
"GUEST": {
"disabled": true
},
"username": {
"password": "pwdpwdpwd",
"admin_channels": [
""
]
},
},
"sync": "function(doc, oldDoc) {\n if (doc.replRole) {\n requireRole('replicator');\n if (doc.replRole !== 'replicator') {\n requireRole(doc.replRole);\n channel(doc.replRole);\n if (doc.channels && doc.channels.length) {\n doc.channels.each(function(channel) {\n channel(doc.replRole + '_' + channel);\n });\n }\n }\n } else {\n requireRole('sync_daemon');\n channel(doc.channels);\n }\n}"
}
}
}
1条答案
按热度按时间wkyowqbh1#
配置
告知同步网关尝试在同步网关容器 * 内 * 的端口8091上查找Couchbase服务器,这在几乎所有情况下都不是正确的做法。您必须为运行Couchbase服务器的容器指定正确的地址。
Docker Networking本身就是一个完整的主题,并且有许多方法,但一般来说,下面三个示例应该足以让您开始运行。
例如,直接路由到Docker容器的IP:
或者,如果要通过主机上的绑定端口进行路由:
或者使用容器主机名: