<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I had no answer so I tough the mailing list wasn’t working for me…. I made a change in the wiki for other people not struggle like i have (completely insane the script can’t work with hostname…<div class=""><br class=""></div><div class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">If someone is interested i made cool script. What the script make is to keep in sync in both the hosts, create a new log file everyday to log all the sync and send you an email containing the log file if something bad happens. In fact it's a loop and the goal is to always have the most recent copies of the vm disk on both sides. Almost as interesting than DRBD but without the split-brain complications :)</span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">In my case for exemple i have approximately 15 KVM VM witch are not to much solicited and the script need 1 minute to make a loop, I think during solicited period maybe 2 or 3 minutes, surely less than 5... It's all new so i have not experience with it, if someone use it i would be very happy if he let me know how it works for him. </span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">It's made to work almost "out of the box"" in a full ZFS Proxmox installation in a two hosts cluster only, if your configuration is different you will have to adapt it...</span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">You just have to verify that you have following packages installed : pve-zsync and screen, you will have to put your mail address in the var monmail at the beginning of the script.</span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">Sorry all the comments in the script are in french, hope you will understand :)</span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><div class="bbcode_container" style="margin: 5px 20px 20px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;"><div class="bbcode_quote" style="margin: 0px 10px 10px; padding: 0px; background-image: none; background-color: rgb(242, 246, 248); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border: 1px solid rgb(65, 115, 148); font-style: italic; line-height: normal; font-family: Tahoma, Calibri, Verdana, Geneva, sans-serif; position: relative; top: 0px;"><div class="quote_container" style="margin: 0px; padding: 5px 10px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;"><div class="bbcode_quote_container" style="margin: 0px; padding: 0px; background-image: url(http://forum.proxmox.com/images/misc/quote-left.png); background-color: transparent; width: 9px; height: 13px; position: absolute; left: -9px; background-position: 0% 50%; background-repeat: no-repeat no-repeat;"></div>#!/bin/bash<br class=""><br class=""><br class="">monmail="<a href="mailto:admin@mydomain.com" class="">admin@mydomain.com</a>"<br class=""><br class=""><br class="">gosync() {<br class="">##On commence la boucle<br class="">while true;do<br class="">## Creation du log (on verifie que le dossier des logs est cree avant)<br class="">if [ ! -d "/var/log/syncro" ];then<br class="">mkdir -p /var/log/syncro<br class="">fi<br class="">logfic="/var/log/syncro/syncro-`date '+%d-%m-%Y'`.log"<br class="">##On detecte sur quelle machine on se trouve et quelle est la machine distante<br class="">loc=`hostname`<br class="">dist=`ls /etc/pve/nodes/ | grep -v $loc`<br class="">###On recupere les ID des VM qui utilisent zfs locales puis de VM distantes<br class="">vmloc=`grep rpool /etc/pve/nodes/$loc/qemu-server/*.conf | cut -d / -f 7 | cut -d . -f 1`<br class="">vmdist=`grep rpool /etc/pve/nodes/$dist/qemu-server/*.conf | cut -d / -f 7 | cut -d . -f 1`<br class="">###On recupere l'IP de l'hote distant<br class="">ipdist=$(ping -c 1 $dist | gawk -F'[()]' '/PING/{print $2}')<br class="">##On vérifie la présence du répertoire des hotes du cluster<br class="">if [ ! -d "/etc/pve/nodes/" ]; then<br class="">echo "PB avec le cluster a `date '+%d-%m-%Y_%Hh%Mm%Ss'`" >> $logfic<br class="">##On laisse une trace d'envoi de mail et on l'envoie<br class="">if [ $logfic != `cat /tmp/mail.tmp` ];then<br class="">echo $logfic > /tmp/mail.tmp<br class="">cat $logfic | mail -s "PB Syncro ZFS" $monmail;<br class="">fi<br class="">fi<br class=""><br class=""><br class="">echo "syncro des machines de $loc vers $dist" >> $logfic<br class="">for n in $vmloc<br class="">do<br class="">if test -f "/tmp/stopsync.req"<br class="">then<br class="">rm /tmp/stopsync.req<br class="">touch /tmp/stopsync.ok<br class="">exit 0<br class="">else<br class="">echo "debut syncro de la machine $n a `date '+%d-%m-%Y_%Hh%Mm%Ss'`" >> $logfic<br class="">pve-zsync sync --source $n --dest $ipdist:rpool/lastsync --maxsnap 1 --verbose >> $logfic<br class="">if test ${?} -eq 0 ; then<br class="">echo "syncro de la machine $n finie a `date '+%d-%m-%Y_%Hh%Mm%Ss'`" >> $logfic<br class="">else<br class="">##On laisse une trace d'envoi de mail et on l'envoie<br class="">if [ $logfic != `cat /tmp/mail.tmp` ];then<br class="">echo $logfic > /tmp/mail.tmp<br class="">cat $logfic | mail -s "PB Syncro ZFS" $monmail;<br class="">fi<br class="">fi<br class="">fi<br class="">done<br class=""><br class=""><br class="">echo "syncro des machines de $dist vers $loc" >> $logfic <br class="">for n in $vmdist<br class="">do<br class="">if test -f "/tmp/stopsync.req"<br class="">then<br class="">rm /tmp/stopsync.req<br class="">touch /tmp/stopsync.ok<br class="">exit 0<br class=""><br class="">else <br class="">echo "debut syncro de la machine $n a `date '+%d-%m-%Y_%Hh%Mm%Ss'`" >> $logfic<br class="">pve-zsync sync --source $ipdist:$n --dest rpool/lastsync --maxsnap 1 --verbose >> $logfic<br class="">if test ${?} -eq 0 ; then<br class="">echo "syncro de la machine $n finie a `date '+%d-%m-%Y_%Hh%Mm%Ss'`" >> $logfic<br class="">else<br class="">##On laisse une trace d'envoi de mail et on l'envoie<br class="">if [ $logfic != `cat /tmp/mail.tmp` ];then<br class="">echo $logfic > /tmp/mail.tmp<br class="">cat $logfic | mail -s "PB Syncro ZFS" $monmail;<br class="">fi<br class="">fi<br class="">fi<br class=""><br class=""><br class="">done<br class=""><br class=""><br class="">done<br class="">}<br class=""><br class=""><br class="">stop() {<br class="">touch /tmp/stopsync.req<br class="">##On commence une nouvelle boucle pour attendre que la syncro en cours soit finie<br class="">while true;do<br class="">if test -f "/tmp/stopsync.ok"<br class="">then<br class="">echo "Arret de la syncro : OK"<br class="">##Et l'arret du script en lui meme<br class="">rm /tmp/stopsync.ok<br class="">kill $$<br class="">exit 0<br class="">else<br class="">echo "Arret en cours..."<br class="">echo "la syncronisation en cours se finit, cela peut durer un peu..."<br class="">sleep 3 <br class="">fi<br class="">done <br class="">}<br class=""><br class=""><br class="">case "$1" in<br class="">gosync)<br class="">gosync<br class="">;;<br class="">start)<br class="">screen -d -m -S syncro-zfs bash -c '/root/scripts/syncro-zfs gosync'<br class="">echo "Lancement de la syncronisation : OK"<br class="">echo "taper la commande 'screen -r syncro-zfs' pour voir la sortie standard."<br class="">;;<br class="">stop)<br class="">stop<br class="">;;<br class="">*)<br class="">echo "Usage: $0 {start|stop}" >&2<br class="">exit 1<br class="">;;<br class="">esac<br class=""><br class=""></div></div></div><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">Hope you will like it, please let me know.</span><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><br style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;" class=""><span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; background-color: rgb(250, 250, 250);" class="">Best regards,</span><br class=""><div class=""><br class=""></div><div class=""><br class=""><div class="">
<br class="">
<link href="http://fonts.googleapis.com/css?family=Acme" rel="stylesheet" type="text/css" class="">
<hr size="2" color="grey" class="">
<table width="500" height="100" border="0" cellpadding="0" cellspacing="0" class="">
<tbody class=""><tr class="">
<td width="100" class="">
<img src="https://www.ipgenius.fr/logo.png" width="80" height="80" style="float: left; margin-left:10px; padding: 0 0 0 0; " class="">
</td>
<td width="400" class="">
<div id="sigipg" style="min-height: 80px; line-height: 16px; color: #999; font-family: 'Acme', sans-serif; font-size: 12px; margin-left:10px;" class="">
<strong style="color: #403120;" class="">Jean-Laurent Ivars </strong><br class="">
<strong class="">Responsable Technique | Technical Manager</strong><br class="">
22, rue Robert - 13007 Marseille <br class="">
Tel: 09 84 56 64 30 - Mobile: 06.52.60.86.47 <br class="">
<a href="http://fr.linkedin.com/in/jlivars/" style="color: #0095a2; text-decoration: none; border-bottom: 1px #333333 dotted;" class="">Linkedin</a>
| <a href="http://www.viadeo.com/fr/profile/jean-laurent.ivars" style="color: #0095a2; text-decoration: none; border-bottom: 1px #333333 dotted;" class="">Viadeo</a>
| <a href="https://www.ipgenius.fr" style="color: #0095a2; text-decoration: none; border-bottom: 1px #333333 dotted;" class="">www.ipgenius.fr</a>
</div>
</td>
</tr>
</tbody></table>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 28 sept. 2015 à 08:18, Michael Rasmussen <<a href="mailto:mir@miras.org" class="">mir@miras.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">On Mon, 28 Sep 2015 08:14:42 +0200 (CEST)<br class="">Wolfgang Bumiller <<a href="mailto:w.bumiller@proxmox.com" class="">w.bumiller@proxmox.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">root@cyclone ~ # pve-zsync sync --source 106 --dest ouragan:rpool/BKP_24H<br class="">--verbose <br class=""></blockquote><br class="">I just checked the source - apparently we currently only allow ip(v4) addresses<br class="">there, no hostnames (this still needs changing...).<br class=""><br class=""></blockquote>And IPv6?<br class=""><br class="">-- <br class="">Hilsen/Regards<br class="">Michael Rasmussen<br class=""><br class="">Get my public GnuPG keys:<br class="">michael <at> rasmussen <dot> cc<br class=""><a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E" class="">http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E</a><br class="">mir <at> datanom <dot> net<br class="">http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C<br class="">mir <at> miras <dot> org<br class="">http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917<br class="">--------------------------------------------------------------<br class="">/usr/games/fortune -es says:<br class="">Nature makes boys and girls lovely to look upon so they can be<br class="">tolerated until they acquire some sense.<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>-- William Phelps<br class="">_______________________________________________<br class="">pve-user mailing list<br class="">pve-user@pve.proxmox.com<br class="">http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>