【问题标题】:Trouble replicating CouchDB database to IBM Cloudant将 CouchDB 数据库复制到 IBM Cloudant 时出现问题
【发布时间】:2016-04-27 09:26:15
【问题描述】:

我正在尝试将数据库从本地 CouchDB 安装复制到 IBM Cloudant。我为此使用了 curl,就像这样 -

curl -X POST 'http://10.88.201.198:5984/_replicate' 
-d '{
        "source":"http://10.88.201.198:5984/temperature-db",
        "target":"username:password@username.cloudant.com/temperature-db"
    }' 
-H "Content-Type: application/json"
-v

尝试超时,我收到以下消息 -

 upload completely sent off: 255 out of 255 bytes
< HTTP/1.1 500 Internal Server Error
* Server CouchDB/1.6.1 (Erlang OTP/R16B03) is not blacklisted
< Server: CouchDB/1.6.1 (Erlang OTP/R16B03)
< Date: Wed, 27 Apr 2016 09:18:34 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 20
< Cache-Control: must-revalidate
< Proxy-Connection: Keep-Alive
< Connection: Keep-Alive
< 
{"error":"timeout"}

我该如何解决这个问题?

【问题讨论】:

  • 运行在 10.88.201.198 上的 couchdb 实例似乎无法连接到您的 Cloudant 实例。您是否能够通过 Web 或 telnet (telnet username.cloudant.com 443) 从位于 10.88.201.198 的机器连接到 Cloudant?
  • @MarkWatson 是的,我可以使用来自10.88.201.198 的 curl 访问 Cloudant。我刚刚在 Cloudant 上查询了一个搜索索引,得到了正确的结果。

标签: couchdb database-replication cloudant


【解决方案1】:

您需要添加一些有权复制的用户的用户名和密码,并且在目标上错过了“https://”并使用 localhost 或 0.0.0.0

curl -X POST 'http://username:password@localhost:5984/_replicate' 
-d '{
        "source":"http://username:password@localhost:5984/temperature-db",
        "target":"https://username:password@username.cloudant.com/temperature-db"
    }' 
-H "Content-Type: application/json"
-v

这也许有帮助

【讨论】:

  • 我确实有复制权限,我尝试复制到本地网络上另一台机器上的 CouchDB 安装,并且成功了。
  • 不要忘记cloudant的用户名和密码。和 https 协议。
【解决方案2】:

您的复制可能需要一段时间才能完成。要解决这个问题,您应该使用_replicatordatabase,您可以在闲暇时对其进行监控。 cloudant 网站上有关于如何使用_replicator 数据库设置复制的文档。

【讨论】:

  • 我无法使用 Cloudant 的 _replicator,因为我没有用于本地安装的公共静态 IP。
  • CouchDb 也有同样的功能。您将使用您的 Couchdb _replicator 数据库,请参阅:couchdb.readthedocs.io/en/1.6.1/replication/replicator.html?h
  • 我刚试了一下。 _replication_state 设置为 error_replication_state_reason 表示 timeout
  • 尝试使用http而不是https?
  • 对源和目标使用 http 的结果相同
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-10-04
  • 2019-07-13
  • 2020-09-18
  • 1970-01-01
  • 2016-02-01
  • 2015-09-15
  • 1970-01-01
相关资源
最近更新 更多