couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Date Mon, 16 Mar 2009 13:53:28 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by BrianCandler:
http://wiki.apache.org/couchdb/How_to_replicate_a_database

The comment on the change is:
Extra "echo" no longer required, since couchdb adds a NL to response

------------------------------------------------------------------------------
  
  == Playing with Replication ==
  
- It's straightforward to set up two test couchdb instances on the same machine. Here is local1.ini:
+ You may replicate between two databases in the same couchdb instance.
+ 
+ However if you prefer a more realistic test, you can also set up two test couchdb instances
on the same machine and replicate between them. Here is local1.ini:
  
  {{{
  ; Remember to create the directories:
@@ -217, +219 @@

  DB1="$HOST1/$LOCAL1"
  DB2="$HOST2/$LOCAL2"
  
- curl -X DELETE "$DB1"; echo
+ curl -X DELETE "$DB1"
- curl -X DELETE "$DB2"; echo
+ curl -X DELETE "$DB2"
- curl -X PUT "$DB1"; echo
+ curl -X PUT "$DB1"
- curl -X PUT "$DB2"; echo
+ curl -X PUT "$DB2"
  
  resp=`curl -sX PUT -d "{\"hello\":\"world\"}" "${DB1}/doc1"`
- echo "$resp"; echo
+ echo "$resp"
  rev=`expr "$resp" : '.*"rev":"\([^"]*\)"'`
  
  # Replicate
- curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo
+ curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"
  curl -s "$DB1/doc1" | grep world
  curl -s "$DB2/doc1" | grep world
  
@@ -238, +240 @@

  curl -s "$DB2/doc1" | grep jim
  
  # Replicate again, A->B. Conflict seen on B side only.
- curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo
+ curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"
  echo "*** On first DB ***"
- curl -s "$DB1/doc1?conflicts=true"; echo
+ curl -s "$DB1/doc1?conflicts=true"
  echo "*** On second DB ***"
- curl -s "$DB2/doc1?conflicts=true"; echo
+ curl -s "$DB2/doc1?conflicts=true"
  
  # Replicate again, B->A. Identical conflict on both sides.
- curl -X POST -d "{\"target\":\"$DB1\",\"source\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo
+ curl -X POST -d "{\"target\":\"$DB1\",\"source\":\"$LOCAL2\"}" "$HOST2/_replicate"
  echo "*** On first DB ***"
- curl -s "$DB1/doc1?conflicts=true"; echo
+ curl -s "$DB1/doc1?conflicts=true"
  echo "*** On second DB ***"
- curl -s "$DB2/doc1?conflicts=true"; echo
+ curl -s "$DB2/doc1?conflicts=true"
  }}}
  

Mime
View raw message