无法使用管理员和自签名SSL证书复制CouchDB数据库

时间:2018-05-02 13:31:00

标签: couchdb replication

我的本​​地和远程CouchDB SSL服务器配置

cert_file   /etc/couchdb/cert/couchdb.pem   
key_file    /etc/couchdb/cert/privkey.pem
port        6984
ssl_certificate_max_depth   1
verify_ssl_certificates false

每当我在像我这样的本地沙发数据库的_replicator数据库中创建文档时

{
   "_id": "181361e45e43f9363612b9dec1005a78",
   "_rev": "6-87e9881fd3fecb26e906bb38b8e00a2f",
   "source": "https://adminname:pass@localhostName:6984/DatabaseFromReplicate/",
   "target": "https://adminname:pass@remotehostName:6984/DatabaseToReplicate/",
   "continuous": true,
   "owner": "Admin Name"
}

我的文档被修改为

{
  "_id": "181361e45e43f9363612b9dec1005a78",
  "_rev": "7-87e9881fd3fecb26e906bb38b8e00a2f",
  "source": "https://adminname:pass@localhostName:6984/DatabaseFromReplicate/",
  "target": "https://adminname:pass@remotehostName:6984/DatabaseToReplicate/",
  "continuous": true,
  "owner": "Admin Name",
  "_replication_state": "error",
  "_replication_state_time": "2018-05-02T07:23:07-06:00",
  "_replication_state_reason": "timeout",
  "_replication_id": "f236397473a906778fd8edbe63dbe59d"
}

DatabaseFromReplicate存在于本地couchDb,而DatabaseToReplicate存在于Remote couchDb

我的CouchDB日志显示:

  

重试HEAD请求https://admin:***** @ remotehost:6984 / DatabaseToReplicate /在0.25秒内由于错误{conn_failed,{error,closed}}

更新:   如果在_replicator数据库目标键值中创建的文档从https更改为http,端口号从6984更改为5984,则复制将在https上的远程数据库中以6984端口启动,为什么会这样。

我的本​​地和远程的couchdb配置:

For replicator

connection_timeout           30000
db                          _replicator
http_connections             20
max_replication_retry_count  10
retries_per_request          10
socket_options               [{keepalive, true}, {nodelay, false}]
ssl_certificate_max_depth    3
verify_ssl_certificates      false
worker_batch_size            500
worker_processes             4

For httpd

allow_jsonp                  false
authentication_handlers      {couch_httpd_oauth, oauth_authentication_handler}, {couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}
bind_address                 0.0.0.0
default_handler              {couch_httpd_db, handle_request}
enable_cors                  false
log_max_chunk_size           1000000
port                         5984
secure_rewrites              true
socket_options               [{recbuf, 262144}, {sndbuf, 262144}]
vhost_global_handlers        _utils, _uuids, _session, _oauth, _users

For couch_httpd_auth

allow_persistent_cookies     false
auth_cache_size              50
authentication_db            _users
authentication_redirect      /_utils/session.html
iterations                   10
require_valid_user           true
secret                       ***************************
timeout                      600

For couch_httpd_oauth

use_users_db                 false

For ssl

cert_file                    /etc/couchdb/cert/couchdb.pem  
key_file                     /etc/couchdb/cert/privkey.pem
port                         6984
ssl_certificate_max_depth    1
verify_ssl_certificates      false

我的_users数据库只包含设计文档。

我的couchDb版本是1.6.1

1 个答案:

答案 0 :(得分:0)

在您放入/_replicator的文档中,您有:

"source": "https://adminname:pass@host:6984/DatabaseFromReplicate/",
"target": "https://adminname:pass@host:6984/DatabaseToReplicate/",

对于您使用source的{​​{1}}和targethostlocalHost不应该是source remoteHost?我的意思是,它们不应该不同吗?

我不确定,也许这只是你问题上的一个错字。