DRBD integration HeartBeat Realizes automatic choice and automatic mount

First confirm whether the heartbeat status is normal and whether there is a secondary IP

[root@data-1-1 data]# ip add|egrep “0.17|0.18”

inet 10.0.0.17/24 brd 10.0.0.255 scope global secondary eth0

[root@data-1-2 /]# ip add|egrep “0.17|0.18”

< p> inet 10.0.0.18/24 brd 10.0.0.255 scope global secondary eth0

Stop one StationdrbdHigh availability and view:

[root@data-1-1 data]# ip add |egrep “0.17|0.18”

[root@data-1-1 data]#

[root@data-1-2 /]# ip add|egrep “0.17|0.18”

inet 10.0.0.18/24 brd 10.0.0.255 scope global secondary eth0

inet 10.0.0.17/24 brd 10.0.0.255 scope global secondary eth0

[root@data-1-2 /]#

Check the drbd status of the two machines:

[root@data-1-1 /]# cat /proc/drbd

version: 8.4.6 (api:1/proto:86-101)

GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00

0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r—–

ns:0 nr:0 dw :0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:8

[ root@data-1-2 /]# cat /proc/drbd

version: 8.4.6 (api:1/proto:86-101)

GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00

0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r—–

ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

The display result is slave—-slave status

p>

Now you need to manage drbd through heartbeat, and to promote one of them to the main status, you need to modify the /etc/ha.d/haresources file

[ root@data-1-1 /]# cat /etc/ha.d/haresources

data-1-1 drbddisk::data IPaddr::10.0.0.17/24/eth0

< p>data-1-2 IPaddr::10.0.0.18/24/eth0

[root@data-1-2 /]# cat /etc/ha .d/haresources

data-1-1 drbddisk::data IPaddr::10.0.0.17/24/eth0

data-1-2 IPaddr::10.0.0.18/24/eth0

Then restart the heartbeat program:

[root@data-1-1 /]# /etc/init.d/heartbeat restart

Stopping High-Availability services: Done.

Waiting to allow resource takeover to complete:Done.

Starting High-Availability services: INFO: Resource is stopped

< p>Done.

Check status:

[root@data-1-1 /]# cat /proc/drbd

version: 8.4.6 (api:1/proto:86-101)

GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00

0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r—–

ns:0 nr:0 dw:0 dr:660 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:8

[root@data-1-2 /]# /etc/init.d/heartbeat restart

Stopping High- Availability services: Done.

Waiting to allow resource takeover to complete:Done.

Starting High-Availability services: INFO: Resource is stopped

Done.

View status:

[root@data-1-2 /]# cat /proc/drbd

version: 8.4.6 (api:1/proto:86-101)< /p>

GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00

0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r—–

ns:0 nr:0 dw :0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

drbdTo start well, both roles should besecondaryWhen you start heartbeat, it can help you choose the master:

according to/etc/ha.d/haresourcesinside The parameters you setdrbddisk::data to choose.

Automatically mount /dev/drbd0, you need to configure parameters in /etc/ha.d/haresources

[root@data-1-2 ~]# cat /etc/ha.d/haresources

data-1-1 drbddisk::data Filesystem::/dev/drbd0::/data::ext4 IPaddr::10.0.0.17/24/eth0

data-1-2 IPaddr ::10.0.0.18/24/eth0

Filesystem::/dev/drbd0::/data::ext4 <========= ==>mount /dev/drbd0 /data Equivalent

Leave a Comment

Your email address will not be published.