Ubuntu Server Guide Changes, errors and bugs
Download 1.27 Mb. Pdf ko'rish
|
ubuntu-server-guide
- Bu sahifa navigatsiya:
- Configuration
Ubuntu HA - DRBD
Distributed Replicated Block Device (DRBD) mirrors block devices between multiple hosts. The replication is transparent to other applications on the host systems. Any block device hard disks, partitions, RAID devices, logical volumes, etc can be mirrored. To get started using drbd, first install the necessary packages. From a terminal enter: sudo apt i n s t a l l drbd8−u t i l s Note If you are using the virtual kernel as part of a virtual machine you will need to manually compile the drbd module. It may be easier to install the linux-server package inside the virtual machine. This section covers setting up a drbd to replicate a separate /srv partition, with an ext3 filesystem between two hosts. The partition size is not particularly relevant, but both partitions need to be the same size. 278 Configuration The two hosts in this example will be called drbd01 and drbd02. They will need to have name resolution configured either through DNS or the /etc/hosts file. See ??? for details. • To configure drbd, on the first host edit /etc/drbd.conf: g l o b a l { usage−count no ; } common { s y n c e r { r a t e 100M; } } r e s o u r c e r 0 { p r o t o c o l C; s t a r t u p { wfc−t i m e o u t 1 5 ; degr−wfc−t i m e o u t 6 0 ; } n e t { cram−hmac−a l g sha1 ; shared −s e c r e t ” s e c r e t ” ; } on drbd01 { d e v i c e / dev / drbd0 ; d i s k / dev / sdb1 ; a d d r e s s 1 9 2 . 1 6 8 . 0 . 1 : 7 7 8 8 ; meta−d i s k i n t e r n a l ; } on drbd02 { d e v i c e / dev / drbd0 ; d i s k / dev / sdb1 ; a d d r e s s 1 9 2 . 1 6 8 . 0 . 2 : 7 7 8 8 ; meta−d i s k i n t e r n a l ; } } Note There are many other options in /etc/drbd.conf, but for this example their default values are fine. • Now copy /etc/drbd.conf to the second host: s c p / e t c / drbd . c o n f drbd02 : ~ • And, on drbd02 move the file to /etc: sudo mv drbd . c o n f / e t c / • Now using the drbdadm utility initialize the meta data storage. On each server execute: sudo drbdadm c r e a t e −md r 0 • Next, on both hosts, start the drbd daemon: sudo s y s t e m c t l s t a r t drbd . s e r v i c e • On the drbd01, or whichever host you wish to be the primary, enter the following: sudo drbdadm −− −−o v e r w r i t e −data−of −p e e r primary a l l 279 • After executing the above command, the data will start syncing with the secondary host. To watch the progress, on drbd02 enter the following: watch −n1 c a t / p r o c / drbd To stop watching the output press Ctrl+c. • Finally, add a filesystem to /dev/drbd0 and mount it: sudo mkfs . e x t 3 / dev / drbd0 sudo mount / dev / drbd0 / s r v Testing To test that the data is actually syncing between the hosts copy some files on the drbd01, the primary, to /srv: sudo cp −r / e t c / d e f a u l t / s r v Next, unmount /srv: sudo umount / s r v Demote the primary server to the secondary role: sudo drbdadm s e c o n d a r y r 0 Now on the secondary server promote it to the primary role: sudo drbdadm primary r 0 Lastly, mount the partition: sudo mount / dev / drbd0 / s r v Using ls you should see /srv/default copied from the former primary host drbd01. Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling