Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

CouchDB Day NYC 2017: Replication

300 views

Published on

The concept of data movement lies at the heart of Apache CouchDB. CouchDB’s replication protocol lets developers synchronize copies of their data to remote CouchDB-based systems – including Cloudant – at the push of a button. Replication jobs can also run continuously, and in both directions.

Published in: Software
  • Be the first to comment

CouchDB Day NYC 2017: Replication

  1. 1. Lab: Replication (30 minutes) Bradley Holt, Developer Advocate Thursday, February 9, 2017 CouchDB Developer Day @BradleyHolt
  2. 2. Peer-to-Peer Replication @BradleyHolt Cloudant SyncCouchDB PouchDB CouchDB Replication Protocol CouchDB
  3. 3. http-console $ npm install http-console -g @BradleyHolthttps://github.com/cloudhead/http-console
  4. 4. http-console $ npm install http-console -g $ http-console 127.0.0.1:5984 @BradleyHolthttps://github.com/cloudhead/http-console
  5. 5. http-console $ npm install http-console -g $ http-console 127.0.0.1:5984 > http-console 0.6.3 > Welcome, enter .help if you're lost. > Connecting to 127.0.0.1 on port 5984. @BradleyHolthttps://github.com/cloudhead/http-console
  6. 6. Connecting to CouchDB 2.0 $ http-console root:passw0rd@127.0.0.1:5984 --json @BradleyHolt
  7. 7. Connecting to CouchDB 2.0 $ http-console root:passw0rd@127.0.0.1:5984 --json > http-console 0.6.3 > Welcome, enter .help if you're lost. > Connecting to 127.0.0.1 on port 5984. @BradleyHolt
  8. 8. Connecting to IBM Cloudant $ http-console https://bradley-holt:passw0rd@bradley-holt.cloudant.com --json @BradleyHolt
  9. 9. Connecting to IBM Cloudant $ http-console https://bradley-holt:passw0rd@bradley-holt.cloudant.com --json > http-console 0.6.3 > Welcome, enter .help if you're lost. > Connecting to bradley-holt.cloudant.com on port 443. @BradleyHolt
  10. 10. Replication /> @BradleyHolt
  11. 11. Replication /> POST /_replicate @BradleyHolt
  12. 12. Replication /> POST /_replicate ... @BradleyHolt
  13. 13. Replication /> POST /_replicate ... { "create_target": true, "source": "https://bradley-holt.cloudant.com/kittens", "target": "kittens" } @BradleyHolt
  14. 14. Replication /> POST /_replicate ... { "create_target": true, "source": "https://bradley-holt.cloudant.com/kittens", "target": "kittens" } HTTP/1.1 200 OK Content-Type: application/json { ok: true, session_id: '9f7bd286a0001ece5bf0bf65dd83c5ab', source_last_seq: '5- g1AAAAFDeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtVLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1 YiA6oWQ9xakhyAZFI9SFcGcyJzLpDHbplmZmxkaULYBKIdlscCJBkagBTQov2kuA- i8wBEJ9iNTGA3mhoampmnGBA2JQsA1LtoyA', … } @BradleyHolt
  15. 15. Try It On Your Own 1. Create database test_1 2. Create database test_2 3. Set up continuous replication from the test_1 database to the test_2 database 4. Create a document in the test_1 database 5. Confirm that the document has been replicated to the test_2 database 6. Delete the test_1 and the test_2 databases @BradleyHolt
  16. 16. Lab: Replication CouchDB Developer Day @BradleyHolt

×