Brouillon+mbuffer

Version 1 (Lois Taulelle, 11/19/2013 12:53 pm)

1 1 Lois Taulelle
h1. Brouillon+mbuffer
2 1 Lois Taulelle
3 1 Lois Taulelle
<pre>
4 1 Lois Taulelle
against gZFS/zfs-replica v65
5 1 Lois Taulelle
185:(fullreplication) $BINZFS send $snapshot2replicate |ssh -o BatchMode=yes root@$server $BINZFS recv $namereplica
6 1 Lois Taulelle
228:(incremental_replication) $BINZFS send -i $lastsnapshotReplicated $namevolfs@$snasphot2replicate | ssh -o BatchMode=yes root@$server $BINZFS recv $namereplica
7 1 Lois Taulelle
8 1 Lois Taulelle
9 1 Lois Taulelle
LOCALHOST=$(hostname -s)
10 1 Lois Taulelle
11 1 Lois Taulelle
function computePort {
12 1 Lois Taulelle
# add a number, based on replica name, to mbuffer base port.
13 1 Lois Taulelle
# This try to avoid problems, on multiple replicas cases, such as reception of 
14 1 Lois Taulelle
# different replicas on same mbuffer port: yeah, epic fail!
15 1 Lois Taulelle
  BasePORT="1030"
16 1 Lois Taulelle
  #for i in $(echo $snapshot2replicate| od -An -t u1); do j=$(($j+$i)); echo $j; done
17 1 Lois Taulelle
  SumChar=0
18 1 Lois Taulelle
  BaseChars=$(echo $snapshot2replicate | od -An -t u1)
19 1 Lois Taulelle
  for i in $BaseChars
20 1 Lois Taulelle
  do
21 1 Lois Taulelle
    SumChar=$(($SumChar+$i))
22 1 Lois Taulelle
  done
23 1 Lois Taulelle
  PORT=$(($BasePORT+$SumChar))
24 1 Lois Taulelle
}
25 1 Lois Taulelle
#echo "$LOCALHOST:$PORT"
26 1 Lois Taulelle
27 1 Lois Taulelle
computePort
28 1 Lois Taulelle
ssh -o BatchMode=yes root@$server "mbuffer -4 -v 1 -s 128k -m 1G -I $LOCALHOST:$PORT | $BINZFS recv $namereplica " &
29 1 Lois Taulelle
sleep 5s
30 1 Lois Taulelle
$BINZFS send $snapshot2replicate | mbuffer -4 -v 1 -s 128k -m 1G -O $server:$PORT
31 1 Lois Taulelle
32 1 Lois Taulelle
33 1 Lois Taulelle
computePort
34 1 Lois Taulelle
ssh -o BatchMode=yes root@$server "mbuffer -4 -v 1 -s 128k -m 1G -I $LOCALHOST:$PORT | $BINZFS recv $namereplica " &
35 1 Lois Taulelle
sleep 5s
36 1 Lois Taulelle
$BINZFS send -i $lastsnapshotReplicated $namevolfs@$snasphot2replicate | mbuffer -4 -v 1 -s 128k -m 1G -O $server:$PORT
37 1 Lois Taulelle
38 1 Lois Taulelle
39 1 Lois Taulelle
</pre>