Couchdb _replicate 端点不接受端口 443。

huangapple go评论44阅读模式
英文:

Couchdb _replicate endpoint doesn't accept port 443

问题

我正在运行以下命令进行翻译:

curl -XPOST "$COUCHDB_ADMIN_URL/_replicate"  \
  -H 'Content-Type:application/json' \
  -d "{\"source\": \"$COUCHDB_ADMIN_URL/alice-db\", \"target\": \"http://bob:p%40ssword@localhost:5984/alice-db-copy-for-bob\", \"create_target\": true }"

来自 https://github.com/apache/couchdb/issues/2892 ,使用我的凭据@url:443。

通常,couchdb 实例的端口是 5984,但我正在使用 Docker 运行一个只暴露 80/443 端口并在内部路由流量的服务,所以我无法从外部访问 5984 端口。

当我尝试在 5984 端点上复制时,我得到了 req_timeout 错误,而一旦我更改为 443 端口(这是我可以在 _utils 下访问数据库的地方),我得到了以下错误:

{"error":"invalid_json","reason":"{error,{1,invalid_json}}"}

有没有办法解决这个问题?

英文:

I am running

curl -XPOST "$COUCHDB_ADMIN_URL/_replicate"  \
  -H 'Content-Type:application/json' \
  -d "{\"source\": \"$COUCHDB_ADMIN_URL/alice-db\", \"target\": \"http://bob:p%40ssword@localhost:5984/alice-db-copy-for-bob\", \"create_target\": true }"

from https://github.com/apache/couchdb/issues/2892 with my credentials@url:443

Normally the Port for the couchdb instance is 5984, but I am using docker to run a service which doesn't expose 5984 only 80/443 and routes traffic internally so I don't have access to 5984 from outside.

When I try to replicate on the endpoint 5984 I get req_timeout, and as soon as I change to 443 which is where I can access the database under _utils I get

{"error":"invalid_json","reason":"{error,{1,invalid_json}}"}

Is there a way to go around this?

答案1

得分: 0

该服务正在运行在一个 Docker 容器中,因此它有一个不同的 IP 地址。我使用以下命令检查 IP 地址:

sudo docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINERID

这个命令给出了我所需要的 IP 地址,然后我使用通常是 CouchDB 端口的 5984 端口。

英文:

The service was running on a docker container so it had a different IP, I checked

sudo docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINERID

which gave me the IP address I needed, and then I used the port 5984 which is normally the couchDB port.

huangapple
  • 本文由 发表于 2023年8月9日 16:01:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76865726.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定