tepheikk posted to #ajatus:

tepheikk

How to run replication on a command line? Is the only way to do it currently at the browser?

1 year, 8 months ago.

4 comments so far

  • rambo

    You can use CURL to POST the commands vai cli. Here is the script we @nemein use the replicate to/from our central server:

    <snip>

    !/bin/bash

    TIMEOUT=90 USERNAME=whoami SERVER=nemein.nemein.net LOCALDB=ajatusdbcontent REMOTEDB=nemeinajatusdbcontent SSHOPTIONS="-C -c blowfish"

    Fork SSH tunnel (it will auto-close some time after the replications are done)

    ssh $SSH_OPTIONS -f -L 25984:127.0.0.1:5984 $USERNAME@$SERVER "sleep $TIMEOUT"

    Replicate UP

    echo "Replicating changes TO $SERVER"

    TODO: redirect output, check output for errors, amybe retry

    curl -H 'Content-Type: application/xml' -d '{"source":"'$LOCALDB'","target":"http://127.0.0.1:25984/'$REMOTEDB'"}' http://127.0.0.1:5984/_replicate echo

    Replicate DOWN

    echo "Replicating changes FROM $SERVER"

    TODO: redirect output, check output for errors, amybe retry

    curl -H 'Content-Type: application/xml' -d '{"source":"http://127.0.0.1:25984/'$REMOTEDB'","target":"'$LOCALDB'"}' http://127.0.0.1:5984/_replicate echo <snip>

    For replicating large databases for the first time the timeout might need to be incremented (or the tunnel opened with a proper shell to another window).

    1 year, 8 months ago by rambo

  • rambo

    Args, formatting messed it up....

    1 year, 8 months ago by rambo

  • bergie

    @rambo Markdown, indent code with 4 spaces

    1 year, 8 months ago by bergie

  • tepheikk

    Should have done things earlier :-) My laptop hung up and ajatus's database corrupted. There seems to be no fixing tools available. Luckily there was not that importand data yet.

    @bergie is there a bug tracker btw? I've found a couple of little issues.

    1 year, 8 months ago by tepheikk

Sign in to add a comment