DRBD integrated heartbeat for automatic selection of main and automatic mounts

Source: Internet
Author: User
Tags egrep

First verify that the heartbeat status is normal and that there is no secondary IP

[[Email protected] data]# IP add|egrep "0.17|0.18"

inet 10.0.0.17/24 BRD 10.0.0.255 scope Global secondary eth0

[[Email protected]/]# IP add|egrep "0.17|0.18"

inet 10.0.0.18/24 BRD 10.0.0.255 scope Global secondary eth0


Stop a DRBD high available and view:

[[Email protected] data]# IP add|egrep "0.17|0.18"

[Email protected] data]#


[[Email protected]/]# 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

[Email protected]/]#


To view the DRBD status of two machines:

[Email protected]/]# CAT/PROC/DRBD

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

git-hash:833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected], 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


[Email protected]/]# CAT/PROC/DRBD

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

git-hash:833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected], 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


Show results as from----from state


It is now necessary to manage DRBD through heartbeat, one of which is promoted to the primary state, and the/etc/ha.d/haresources file needs to be modified

[Email protected]/]# cat/etc/ha.d/haresources

Data-1-1 drbddisk::d ata ipaddr::10.0.0.17/24/eth0

Data-1-2 Ipaddr::10.0.0.18/24/eth0


[Email protected]/]# cat/etc/ha.d/haresources

Data-1-1 drbddisk::d ata ipaddr::10.0.0.17/24/eth0

Data-1-2 Ipaddr::10.0.0.18/24/eth0


Then restart the heartbeat program:

[Email protected]/]#/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:

[Email protected]/]# CAT/PROC/DRBD

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

git-hash:833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected], 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


[Email protected]/]#/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:

[Email protected]/]# CAT/PROC/DRBD

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

git-hash:833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected], 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


When DRBD is started, and both roles are secondary , start Heartbeat, which will help you select the master:

according to/etc/ha.d/haresources you set the parameters drbddisk::d ata to choose.


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

[Email protected] ~]# cat/etc/ha.d/haresources

Data-1-1 drbddisk::d ata 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 Equivalence

This article is from the "Linux" blog, so be sure to keep this source http://chenjisong.blog.51cto.com/7858025/1718539

DRBD integrated heartbeat for automatic selection of main and automatic mounts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.