Re: [Csync2] csync2: 2 servers Master-Master

2016-06-09 Thread Rabin Yasharzadehe
​
I personally put a random sleep in my cron call,

1 * * * * root  sleep $((RANDOM%60)) && csync2-update
>

where csync2 is a wrapper around csync -xv which handle errors and mail
notifications.

you can move the sleep into the wrapper script,
and only use the delay when there is no tty (which is when the script is
called via cron)

not perfect, but it works nicely.


--
Rabin
​


On Thu, Jun 9, 2016 at 9:47 AM, Гусев Павел  wrote:

> Hi! If you run csync2 -xv on each node, you can get sqlite-database locks.
> So, if you do not want sqlite-database locks, you can use one of these
> recomendations:
> 1) use csync 2.0, it is possibility to use mysql backend
> 2) on each node authorized_keys file and connect to each node from one
> supermaster node, and run csync2 -xv over ssh in  a cycle, for example:
>
> #!/bin/bash
> list="host1 host2 host3"
> rid=$(date +%s)
> LOGS_PATH=/var/log/csync2_master/mainapp
> mkdir -p $LOGS_PATH
> CUR_DATE=`date +%F`
>
> find $LOGS_PATH -type f -mtime +30 -exec rm -f {} \;
> 2>&1
> | tee -a $LOGS_PATH/last.log
>
> for ip in $list;do
> echo
> ''
> 2>&1 | tee -a
> $LOGS_PATH/last.log
> echo 'Starting '${trid}' sync on '$ip' at '`date`
> 2>&1
> | tee -a $LOGS_PATH/last.log
> timeout 3600 ssh -oStrictHostKeyChecking=no csync2@$ip
> "timeout 3600 sudo csync2 -xv"
> 2>&1 | tee -a
> $LOGS_PATH/last.log
> echo 'Finishing '${trid}' sync on '$ip' at '`date`
> 2>&1  |
> tee -a $LOGS_PATH/last.log
> echo
> ''
> 2>&1 | tee -a
> $LOGS_PATH/last.log
> done
> echo -e
> "*\n"
> 2>&1   | tee -a $LOGS_PATH/last.log
> sleep 60;
>
> 3) if you do not want previously choices, you can use csync2 -Bxv (key B -
> do not lock sqlite-database, but you can get bad data in database or
> crashed db-file)
>
> Paul Goosev
>
>
>
> 08.06.2016, 18:50, "Rabin Yasharzadehe" :
>
> check the manual - http://oss.linbit.com/csync2/paper.pdf
> just note that csync2 works by pushing changes, so you'll need to run the
> sync command on each node, to sync both sides.
>
> On Wed, Jun 8, 2016 at 1:12 PM, Solanellas Llobet, Xavier <
> xavier.solanel...@esade.edu> wrote:
>
> Hi,
>
> I would like to configure 2 servers Master-Master using csync2 in
> RedHatLinux.
>
> Do you have a document with step by step to configure 2 servers?
>
>
>
> Thanks.
>
> ___
> Csync2 mailing list
> Csync2@lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2
>
> ,
>
> ___
> Csync2 mailing list
> Csync2@lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2
>
>
___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2


Re: [Csync2] csync2: 2 servers Master-Master

2016-06-08 Thread Гусев Павел
Hi! If you run csync2 -xv on each node, you can get sqlite-database locks. So, if you do not want sqlite-database locks, you can use one of these recomendations:1) use csync 2.0, it is possibility to use mysql backend2) on each node authorized_keys file and connect to each node from one supermaster node, and run csync2 -xv over ssh in  a cycle, for example:#!/bin/bashlist="host1 host2 host3"rid=$(date +%s)    LOGS_PATH=/var/log/csync2_master/mainapp    mkdir -p $LOGS_PATH    CUR_DATE=`date +%F`    find $LOGS_PATH -type f -mtime +30 -exec rm -f {} \; 2>&1    | tee -a $LOGS_PATH/last.log    for ip in $list;do    echo '' 2>&1 | tee -a $LOGS_PATH/last.log    echo 'Starting '${trid}' sync on '$ip' at '`date` 2>&1   | tee -a $LOGS_PATH/last.log    timeout 3600 ssh -oStrictHostKeyChecking=no csync2@$ip "timeout 3600 sudo csync2 -xv" 2>&1 | tee -a $LOGS_PATH/last.log    echo 'Finishing '${trid}' sync on '$ip' at '`date` 2>&1  | tee -a $LOGS_PATH/last.log    echo '' 2>&1 | tee -a $LOGS_PATH/last.log    done    echo -e "*\n" 2>&1   | tee -a $LOGS_PATH/last.log    sleep 60;3) if you do not want previously choices, you can use csync2 -Bxv (key B - do not lock sqlite-database, but you can get bad data in database or crashed db-file) Paul Goosev   08.06.2016, 18:50, "Rabin Yasharzadehe" :check the manual - http://oss.linbit.com/csync2/paper.pdfjust note that csync2 works by pushing changes, so you'll need to run the sync command on each node, to sync both sides.On Wed, Jun 8, 2016 at 1:12 PM, Solanellas Llobet, Xavier  wrote:Hi,I would like to configure 2 servers Master-Master using csync2 in RedHatLinux.Do you have a document with step by step to configure 2 servers? Thanks.___ Csync2 mailing list Csync2@lists.linbit.com http://lists.linbit.com/mailman/listinfo/csync2 ,___Csync2 mailing listCsync2@lists.linbit.comhttp://lists.linbit.com/mailman/listinfo/csync2___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2


Re: [Csync2] csync2: 2 servers Master-Master

2016-06-08 Thread Rabin Yasharzadehe
check the manual - http://oss.linbit.com/csync2/paper.pdf
just note that csync2 works by pushing changes, so you'll need to run the
sync command on each node, to sync both sides.

On Wed, Jun 8, 2016 at 1:12 PM, Solanellas Llobet, Xavier <
xavier.solanel...@esade.edu> wrote:

> Hi,
>
> I would like to configure 2 servers Master-Master using csync2 in
> RedHatLinux.
>
> Do you have a document with step by step to configure 2 servers?
>
>
>
> Thanks.
>
> ___
> Csync2 mailing list
> Csync2@lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2
>
>
___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2


[Csync2] csync2: 2 servers Master-Master

2016-06-08 Thread Solanellas Llobet, Xavier
Hi,
I would like to configure 2 servers Master-Master using csync2 in RedHatLinux.
Do you have a document with step by step to configure 2 servers?

Thanks.
___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2