1

My local and remote CouchDB SSL server configuration

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

Whenever i create a document in _replicator database of my local couch db like this

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

My document gets revised to

{
  "_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 is present at local couchDb and DatabaseToReplicate is present at Remote couchDb

My CouchDB log shows:

Retrying HEAD request to https://admin:*****@remotehost:6984/DatabaseToReplicate/ in 0.25 seconds due to error {conn_failed,{error,closed}}

Update: If the document created in _replicator database target key value is changed from https to http and port number from 6984 to 5984 then the replication starts in my remote database on https with 6984 port why is that.

My couchdb config for local and remote:

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

My _users database just contains the design document.

My couchDb version is 1.6.1

sykyck
  • 11
  • 1
  • 4

1 Answers1

0

In the document you put into /_replicator you have:

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

For both source and target you're using host, shouldn't it be something like localHost for source and remoteHost for target? I mean, shouldn't they be different?

I'm not sure, maybe that's just a typo in your question.

Megidd
  • 7,089
  • 6
  • 65
  • 142
  • yes thats a typo mistake in my question thanks for pointing out – sykyck May 04 '18 at 10:59
  • @sykyck I strongly suggest using CouchDB 2.1.1, since version 1.6.1 has [security bugs](https://www.cvedetails.com/vulnerability-list/vendor_id-45/product_id-19046/Apache-Couchdb.html) which allows the system to be exploited [by bitcoin miners](https://stackoverflow.com/questions/49361589/couchdb-causes-a-process-flooding-with-100-cpu-power-consumption#comment85966400_49361676). – Megidd May 04 '18 at 11:28
  • Thanks for the info – sykyck May 04 '18 at 15:31