当前位置:网站首页>Heartbeat and DRBD configuration process
Heartbeat and DRBD configuration process
2022-06-30 20:16:00 【Brother Xing plays with the clouds】
my PC There are only 1 NIC , So I use the serial port to make the two computers communicate ;
192.168.119.1 It's from my router IP, As an extraterritorial The server , Within detection domain The server If there is something wrong ;
First configuration host file :
127.0.0.1 localhost 127.0.1.1 Ubuntu-Bing
192.168.119.102 ubuntu-Bing 192.168.119.103 Lab-Server
Copy configuration file :
cp /usr/local/ha/share/doc/authkeys /usr/local/ha/etc/ha.d cp /usr/local/ha/share/doc/ha.cf /usr/local/ha/etc/ha.d cp /usr/local/ha/share/doc/haresources /usr/local/ha/etc/ha.d
ha.d file :
debugfile /var/log/ha-debug logfile /var/log/ha-log logfacility local0 keepalive 2 deadtime 30 warntime 10 initdead 120 baud 19200 serial /dev/ttyS0 # Linux auto_failback on node ubuntu-Bing node Lab-Server ping 192.168.119.1 respawn hacluster /usr/lib/ocf/resource.d/heartbeat/pingd -m 100 -d 5s apiauth pingd gid=haclient uid=hacluster
compression bz2 compression_threshold 2
resource.d Under the table of contents drbddisk Script
#!/bin/bash # # This script is intended to be used as resource script by heartbeat # # Copright 2003-2008 LINBIT Information Technologies # Philipp Reisner, Lars Ellenberg # ###
DEFAULTFILE="/etc/default/drbd" DRBDADM="/sbin/drbdadm"
if [ -f $DEFAULTFILE ]; then . $DEFAULTFILE fi
if [ "$#" -eq 2 ]; then RES="$1" CMD="$2" else RES="all" CMD="$1" fi
## EXIT CODES # since this is a "legacy heartbeat R1 resource agent" script, # exit codes actually do not matter that much as long as we conform to # http://wiki.linux-ha.org/HeartbeatResourceAgent # but it does not hurt to conform to lsb init-script exit codes, # where we can. # http://refspecs.linux-foundation.org/LSB_3.1.0/ #LSB-Core-generic/LSB-Core-generic/iniscrptact.html ####
drbd_set_role_from_proc_drbd() { local out if ! test -e /proc/drbd; then ROLE="Unconfigured" return fi
dev=$( $DRBDADM sh-dev $RES ) minor=${dev#/dev/drbd} if [[ $minor = *[!0-9]* ]] ; then # sh-minor is only supported since drbd 8.3.1 minor=$( $DRBDADM sh-minor $RES ) fi if [[ -z $minor ]] || [[ $minor = *[!0-9]* ]] ; then ROLE=Unknown return fi
if out=$(sed -ne "/^ *$minor: cs:/ { s/:/ /g; p; q; }" /proc/drbd); then set -- $out ROLE=${5%/**} : ${ROLE:=Unconfigured} # if it does not show up else ROLE=Unknown fi }
case "$CMD" in start) # try several times, in case heartbeat deadtime # was smaller than drbd ping time try=6 while true; do $DRBDADM primary $RES && break let "--try" || exit 1 # LSB generic error sleep 1 done ;; stop) # heartbeat (haresources mode) will retry failed stop # for a number of times in addition to this internal retry. try=3 while true; do $DRBDADM secondary $RES && break # We used to lie here, and pretend success for anything != 11, # to avoid the reboot on failed stop recovery for "simple # config errors" and such. But that is incorrect. # Don't lie to your cluster manager. # And don't do config errors... let --try || exit 1 # LSB generic error sleep 1 done ;; status) if [ "$RES" = "all" ]; then echo "A resource name is required for status inquiries." exit 10 fi ST=$( $DRBDADM role $RES ) ROLE=${ST%/**} case $ROLE in Primary|Secondary|Unconfigured) # expected ;; *) # unexpected. whatever... # If we are unsure about the state of a resource, we need to # report it as possibly running, so heartbeat can, after failed # stop, do a recovery by reboot. # drbdsetup may fail for obscure reasons, e.g. if /var/lock/ is # suddenly readonly. So we retry by parsing /proc/drbd. drbd_set_role_from_proc_drbd esac case $ROLE in Primary) echo "running (Primary)" exit 0 # LSB status "service is OK" ;; Secondary|Unconfigured) echo "stopped ($ROLE)" exit 3 # LSB status "service is not running" ;; *) # NOTE the "running" in below message. # this is a "heartbeat" resource script, # the exit code is _ignored_. echo "cannot determine status, may be running ($ROLE)" exit 4 # LSB status "service status is unknown" ;; esac ;; *) echo "Usage: drbddisk [resource] {start|stop|status}" exit 1 ;; esac
exit 0
First, configure DRBD service , And then it starts heartbeat service ; test Heartbeat!
Stop the master The server Of heartbeat service , Then check it out /mnt/drbd Whether the file can be seen under ! If possible , It's a success !
边栏推荐
- 广州股票开户选择手机办理安全吗?
- Transport layer uses sliding window to realize flow control
- TorchDrug--药物属性预测
- 以全栈全功能解决方案,应对多样工具复杂环境DevOps落地难题
- Client request external interface standard processing method
- 消灭Bug,开发者不可不知的几款Bug探索测试神器。
- Convert seconds to * * hours * * minutes
- QT QStringList用法
- 杰理之关于长按开机检测抬起问题【篇】
- originpro 2021 附安装教程
猜你喜欢

RP prototype resource sharing - shopping app

Data intelligence - dtcc2022! China database technology conference is about to open
![Jerry's touch key recognition process [chapter]](/img/a4/3affa0f03db158ab68f69f935945e0.png)
Jerry's touch key recognition process [chapter]

杰理之触摸按键识别流程【篇】

消灭Bug,开发者不可不知的几款Bug探索测试神器。

Conditional compilation

Halcon知识:盘点一下计量对象【1】

屏幕显示技术进化史

Primary school, session 3 - afternoon: Web_ xxe

The Commission is so high that everyone can participate in the new programmer's partner plan
随机推荐
Openfire solves the problem of Chinese garbled code after using MySQL database
Basic syntax of VB
mysql登录出现1045错误修改方法[通俗易懂]
PostgreSQL heap堆表 存储引擎实现原理
分析超700万个研发需求发现,这八大编程语言才是行业最需要的
杰理之关于长按复位【篇】
小学期,第三场-下午:WEB_xxe
Static classes use @resource annotation injection
originpro 2021 附安装教程
杰理之触摸按键识别流程【篇】
Exness: liquidity series - liquidity cleaning and reversal, decision interval
杰理之触摸按键识别流程【篇】
Jerry's touch key recognition process [chapter]
Tencent conference application market was officially launched, with more than 20 applications in the first batch
[ICLR 2021] semi supervised object detection: unbiased teacher for semi supervised object detection
Enterprise middle office planning and it architecture microservice transformation
信息学奥赛一本通 1362:家庭问题(family)
C language: hashtable
微信小程序开发实战 云音乐
The Commission is so high that everyone can participate in the new programmer's partner plan