No title Revision 393465313963 (Sun Aug 23 2009 at 17:05) - Diff Link to this snippet: https://friendpaste.com/6iC7KyOglqHFexivY9g1W Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#!/bin/sh -ex# cd into couchdb directory, run ./replication-ring-continuous.sh N from there# requires N CouchDB installs running on ports 5985 to 5984 + NN=$1if [ -z "$N" ]; then echo "usage: ./replication-ring-continuous.sh N" exit 1fisetup_replication(){ # pull replication N=$1 MAX=$2 TARGET_PORT=`expr 5984 + $N` # when we set up 1st couch, we replicate from Nth couch if [ $N -eq 1 ]; then SOURCE_PORT=`expr 5984 + $MAX` else SOURCE_PORT=`expr 5984 + $N - 1` fi TARGET="http://127.0.0.1:$TARGET_PORT" SOURCE="http://127.0.0.1:$SOURCE_PORT" # create dbs, ignore errors curl -X PUT "$SOURCE/db" curl -X PUT "$TARGET/db" curl -X POST "$TARGET/_replicate" -d "{\"source\":\"$SOURCE/db\",\"target\":\"db\",\"continuous\":true}"}MAX=$Nwhile([ $N -gt 0 ]); do echo "Do CouchDB N=$N" setup_replication $N $MAX N=`expr $N - 1`done# insert some docsecho "Done"# Done