http://www.freebsd.org/doc/en/books/handbook/geom-ggate.html
http://phaq.phunsites.net/2006/08/11/realtime-file-system-replication-on-freebsd/
Выполняем процедуру Добавление дисков до создания и переименования слайса включительно на обоих узлах.
[gate1:~] # cat /etc/hosts ... 10.0.0.2 slave ... [gate2:~] # cat /etc/hosts ... 10.0.0.1 slave ... [gateN:~] # cat /etc/gg.exports slave RW /dev/ad1s1e [gateN:~] # mkdir /opt [gateN:~] # cat /etc/periodic.conf daily_status_gmirror_enable="YES"
[gate1:~] # gmirror load [gate1:~] # gmirror label -v gm0 /dev/ad1s1e [gate1:~] # gmirror status [gate1:~] # newfs /dev/mirror/gm0 [gate1:~] # fsck -y -t ufs /dev/mirror/gm0 [gate1:~] # mount /dev/mirror/gm0 /opt [gate2:~] # ggated [gate1:~] # ggatec create -t 10 -u 0 slave /dev/ad1s1e && echo Success [gate1:~] # ggatec list [gate1:~] # gmirror insert gm0 ggate0 [gate1:~] # gmirror status
[gate1:~] # gmirror status Name Status Components mirror/gm0 DEGRADED ad1s1e
заставляем зеркало “забыть” о недоподключенном диске и вновь подключаем его
[gate1:~] # gmirror forget gm0 [gate1:~] # gmirror insert gm0 ggate0 [gate1:~] # tail -f /var/log/messages
Иногда, при постоянных сбоях синхронизации, помогает перезапуск ggated на slave узле
[gate2:~] # killall ggated [gate2:~] # ggated
gate1 - бывший мастер, теперь бекап
gate2 - бывший бекап, теперь мастер
[gate1:~] # umount /opt [gate1:~] # gmirror status [gate1:~] # gmirror deactivate gm0 ggate0 [gate1:~] # gmirror deactivate gm0 ad1s1e [gate1:~] # gmirror unload [gate1:~] # ggatec list [gate1:~] # ggatec destroy -u 0 [gate1:~] # killall -9 ggatec [gate1:~] # ggated [gate2:~] # killall ggated [gate2:~] # gmirror load [gate2:~] # gmirror label -v gm0 /dev/ad1s1e [gate2:~] # gmirror status [gate2:~] # fsck -y -t ufs /dev/mirror/gm0 [gate2:~] # mount /dev/mirror/gm0 /opt [gate2:~] # ggatec create -t 10 -u 0 slave /dev/ad1s1e [gate2:~] # ggatec list [gate2:~] # gmirror insert gm0 ggate0 [gate2:~] # gmirror status
[gate2:~] # umount /opt [gate2:~] # gmirror status [gate2:~] # gmirror deactivate gm0 ggate0 [gate2:~] # gmirror deactivate gm0 ad1s1e [gate2:~] # gmirror unload