SYNC 网关无法在 docker 环境下连接到 couchbase 服务器

问题描述 投票:0回答:0

我正在尝试将 CB 和 Sync Gateway 实例放入 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 和配置的用户和存储桶。

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}"
            
        }
    }
    }
docker couchbase couchbase-sync-gateway
© www.soinside.com 2019 - 2024. All rights reserved.