Couchdb _replicate 终端不接受端口 443。

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

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

然后,我使用通常是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-2.html
匿名

发表评论

匿名网友

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

确定