Created
February 26, 2022 21:15
-
-
Save amaltaro/67bd133c519300fb82dd0cad372cf1a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0. Define environment variables to hold dummy user/pass and remote host name | |
$ USERPASS=cmst1:passwd | |
$ REMOTEHOST=alanblah.blah.ch | |
1. Checking status of remote CouchDB (running with Erlang R16B03) | |
$ curl -ks --cert $X509_USER_CERT --key $X509_USER_KEY "https://$REMOTEHOST/couchdb/" | |
{"couchdb":"Welcome","uuid":"50f495ef9a2090ec6dcb8f1543cab70d","version":"1.6.1","vendor":{"version":"1.6.1","name":"The Apache Software Foundation"}} | |
2. Checking status of local CouchDB (running with Erlang 22.3.4.19) | |
$ curl http://localhost:5984/ | |
{"couchdb":"Welcome","version":"3.1.2","git_sha":"572b68e72","uuid":"652fb71bc6c32121e0752325a4973eb3","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}} | |
2.a. and documents in the _replicator db | |
$ curl http://$USERPASS@localhost:5984/_replicator/_all_docs | |
{"total_rows":1,"offset":0,"rows":[ | |
{"id":"_design/_replicator","key":"_design/_replicator","value":{"rev":"1-85a961d0d9b235b7b4f07baed1a38fda"}} | |
]} | |
2.b. and output of _scheduler/docs API | |
curl http://$USERPASS@localhost:5984/_scheduler/docs | |
{"total_rows":0,"offset":0,"docs":[ | |
]} | |
3. Now checking source and target database | |
$ curl -ks --cert $X509_USER_CERT --key $X509_USER_KEY "https://$REMOTEHOST/couchdb/workqueue/_all_docs" | |
{"total_rows":2,"offset":0,"rows":[ | |
{"id":"_design/WorkQueue","key":"_design/WorkQueue","value":{"rev":"1-cecd66584cf99f7b7e536f42b9c75d09"}}, | |
{"id":"task_activity","key":"task_activity","value":{"rev":"4-3975ecf173f7f5b3776ccc2df2fbb4c8"}} | |
]} | |
$ curl http://$USERPASS@localhost:5984/workqueue_inbox/_all_docs | |
{"total_rows":1,"offset":0,"rows":[ | |
{"id":"_design/WorkQueue","key":"_design/WorkQueue","value":{"rev":"1-46bfe3e5277b1eaa409511fb80ce16fd"}} | |
]} | |
4. Setting up a continuous and permanent replication: | |
$ curl -X POST http://$USERPASS@localhost:5984/_replicator -d '{"source":"http://$USERPASS@localhost:5984/workqueue_inbox/", "target":"https://$REMOTEHOST/couchdb/workqueue/", "continuous":true}' -H "Content-Type: application/json" | |
{"ok":true,"id":"5dfd894db86cbb4a52913705f2000aed","rev":"1-95994b3bd17dff6b8748af0cb0e9b7ea"} | |
5. Checking replication status | |
$ curl http://$USERPASS@localhost:5984/_replicator/5dfd894db86cbb4a52913705f2000aed | |
{"_id":"5dfd894db86cbb4a52913705f2000aed","_rev":"2-ccad0c419045c032c447cb3b64a8663f","source":"http://****:****@localhost:5984/workqueue_inbox/","target":"https://$REMOTEHOST/couchdb/workqueue/","continuous":true,"owner":"cmst1","_replication_state":"failed","_replication_state_time":"2022-02-26T20:57:58Z","_replication_state_reason":"{error,undef}"} | |
$ curl http://$USERPASS@localhost:5984/_scheduler/docs | |
{"total_rows":1,"offset":0,"docs":[ | |
{"database":"_replicator","doc_id":"5dfd894db86cbb4a52913705f2000aed","id":null,"source":"http://cmst1:*****@localhost:5984/workqueue_inbox/","target":null,"state":"failed","error_count":1,"info":{"error":"{error,undef}"},"start_time":"2022-02-26T20:57:58Z","last_updated":"2022-02-26T20:57:58Z"} | |
]} | |
6. Create a dummy document in the source database | |
$ curl -X PUT http://$USERPASS@localhost:5984/workqueue_inbox/dummy_doc01 -d '{"name":"Alan", "age":"1"}' -H "Content-Type: application/json" | |
{"ok":true,"id":"dummy_doc01","rev":"1-51ba96b578089e025eaf6c3c97ff5ca1"} | |
7. Check again the source and remote databases | |
$ curl -ks --cert $X509_USER_CERT --key $X509_USER_KEY "https://$REMOTEHOST/couchdb/workqueue/_all_docs" | |
{"total_rows":2,"offset":0,"rows":[ | |
{"id":"_design/WorkQueue","key":"_design/WorkQueue","value":{"rev":"1-cecd66584cf99f7b7e536f42b9c75d09"}}, | |
{"id":"task_activity","key":"task_activity","value":{"rev":"9-b308c957d8b168a79367ae5777305cac"}} | |
]} | |
$ curl http://$USERPASS@localhost:5984/workqueue_inbox/_all_docs | |
{"total_rows":2,"offset":0,"rows":[ | |
{"id":"_design/WorkQueue","key":"_design/WorkQueue","value":{"rev":"1-46bfe3e5277b1eaa409511fb80ce16fd"}}, | |
{"id":"dummy_doc01","key":"dummy_doc01","value":{"rev":"1-51ba96b578089e025eaf6c3c97ff5ca1"}} | |
]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment