linux heartbeat mysql
高可用叢集是指一組通過硬體和軟體連線起來的獨立計算機,它們在使用者面前表現為一個單一系統,在這樣的一組計算機系統內部的一個或者多個節點停止工作,服務會從故障節點切換到正常工作的節點上執行,不會引起服務中斷。從這個定義可以看出,叢集必須檢測節點和服務何時失效,何時恢復為可用。這個任務通常由一組被稱為“心跳”的程式碼完成。在Linux-HA裡這個功能由一個叫做heartbeat的程式完成。
測試主機
可以使用虛擬機器VM,多增加一塊網路卡,記得兩臺虛擬機器分別繫結網路卡
master:
eth0:192.168.1.106
eth1:192.168.168.128 用作心跳線,
slave:
eth0:192.168.168.104
eht1:192.168.168.129 用作心跳線,用交叉線連線
實驗步驟
用master和slave機器做一個replication
master上my.cnf
log-bin=mysql-bin
server-id=1
replicate-do-db=test
測試mysql當機的時候,能夠自動漂移mysql伺服器,主要使用Linux的心跳,做高可用
軟體包:
可以從網站http://www.rpmfind.com/下載
heartbeat-2.1.4-9.el5.i386.rpm
heartbeat-pils-2.1.4-11.el5.i386.rpm
heartbeat-stonith-2.1.4-11.el5.i386.rpm
libnet-1.1.4-3.el5.i386.rpm
openhpi-libs-2.14.0-5.el5.asp121.i386.rpm
可以從網站http://www.rpmfind.com/下載
heartbeat-2.1.4-9.el5.i386.rpm
heartbeat-pils-2.1.4-11.el5.i386.rpm
heartbeat-stonith-2.1.4-11.el5.i386.rpm
libnet-1.1.4-3.el5.i386.rpm
openhpi-libs-2.14.0-5.el5.asp121.i386.rpm
測試主機
可以使用虛擬機器VM,多增加一塊網路卡,記得兩臺虛擬機器分別繫結網路卡
master:
eth0:192.168.1.106
eth1:192.168.168.128 用作心跳線,
slave:
eth0:192.168.168.104
eht1:192.168.168.129 用作心跳線,用交叉線連線
安裝步驟
1.[root@slave heartbeat-rpm]# rpm -ivh heartbeat-pils-2.1.4-11.el5.i386.rpm
warning: heartbeat-pils-2.1.4-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat-pils ########################################### [100%]
1.[root@slave heartbeat-rpm]# rpm -ivh heartbeat-pils-2.1.4-11.el5.i386.rpm
warning: heartbeat-pils-2.1.4-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat-pils ########################################### [100%]
2.[root@slave heartbeat-rpm]# rpm -ivh openhpi-libs-2.14.0-5.el5.asp121.i386.rpm
warning: openhpi-libs-2.14.0-5.el5.asp121.i386.rpm: Header V3 DSA signature: NOKEY, key ID 9b3c94f4
Preparing... ########################################### [100%]
1:openhpi-libs ########################################### [100%]
warning: openhpi-libs-2.14.0-5.el5.asp121.i386.rpm: Header V3 DSA signature: NOKEY, key ID 9b3c94f4
Preparing... ########################################### [100%]
1:openhpi-libs ########################################### [100%]
3.[root@slave heartbeat-rpm]# rpm -ivh heartbeat-stonith-2.1.4-11.el5.i386.rpm
warning: heartbeat-stonith-2.1.4-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat-stonith ########################################### [100%]
4.[root@slave heartbeat-rpm]# rpm -ivh heartbeat-2.1.4-9.el5.i386.rpm
warning: heartbeat-2.1.4-9.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat ########################################### [100%]
warning: heartbeat-stonith-2.1.4-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat-stonith ########################################### [100%]
4.[root@slave heartbeat-rpm]# rpm -ivh heartbeat-2.1.4-9.el5.i386.rpm
warning: heartbeat-2.1.4-9.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:heartbeat ########################################### [100%]
實驗步驟
用master和slave機器做一個replication
master上my.cnf
log-bin=mysql-bin
server-id=1
replicate-do-db=test
slave上my.cnf
server-id=2
log-bin=mysql-bin
replicate-do-db=test
server-id=2
log-bin=mysql-bin
replicate-do-db=test
剩下的進入slave的mysql
利用CHANGE MASTER TO
master_host=127.0.0.1,
master_user='test0',
master_password='test',
master_port=3306,
master_log_file='',
master_log_pos=,
使用show master 和show slave\G檢視狀態
利用CHANGE MASTER TO
master_host=127.0.0.1,
master_user='test0',
master_password='test',
master_port=3306,
master_log_file='',
master_log_pos=,
使用show master 和show slave\G檢視狀態
配置replication結束
開始配置LINUX HA
cp /usr/share/doc/heartbeat-2.1.4/ha.f /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.4/haresources /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.4/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.4/ha.f /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.4/haresources /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.4/authkeys /etc/ha.d/
修改ha.f如下
啟動heartbeat
[root@slave ha.d]# service heartbeat start
Starting High-Availability services:
2010/12/08_21:45:59 INFO: Resource is stopped
[確定]
[root@slave ha.d]# service heartbeat start
Starting High-Availability services:
2010/12/08_21:45:59 INFO: Resource is stopped
[確定]
注意事項
偏移的IP地址必須真實存在的
偏移的IP地址必須真實存在的
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12309491/viewspace-681570/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql 主從延時監控(pt-heartbeat)詳解MySql
- DB2 HADR的heartbeat檢測DB2
- Elastic 使用Heartbeat監測服務執行狀態AST
- Haproxy+Heartbeat 高可用叢集方案操作記錄
- LVS+Heartbeat 高可用叢集方案操作記錄
- websocket-heartbeat-js心跳檢測庫正式釋出WebJS
- mysql安裝 for LinuxMySqlLinux
- Mysql 5.7.21 install for LinuxMySqlLinux
- Linux安裝MySQLLinuxMySql
- PING[ARC5]: Heartbeat failed to connect to standby 'dghq'. Error is 12154.AIError
- 【mysql】linux下安裝mysql-5.7.31MySqlLinux
- 原始碼解讀etcd heartbeat,election timeout之間的拉鋸原始碼
- mysql每日備份for LinuxMySqlLinux
- Linux安裝mysql 8.0LinuxMySql
- Linux下的Mysql操作LinuxMySql
- 最新!linux mysql安裝LinuxMySql
- linux上安裝mysqlLinuxMySql
- Linux啟動mysql命令LinuxMySql
- Linux基礎命令---mysqlLinuxMySql
- mysql linux下安裝MySqlLinux
- Linux中登入mysqlLinuxMySql
- mysql在linux安裝MySqlLinux
- Linux 提權-MySQL UDFLinuxMySql
- linux mysql 找回密碼LinuxMySql密碼
- MySQL-01.Linux下MySQL安裝和使用MySqlLinux
- LINUX 環境 mysql to mysql OGG安裝配置(二)LinuxMySql
- Linux 下 docker 安裝 MySQLLinuxDockerMySql
- Linux自動備份MySQLLinuxMySql
- linux-mysql命令,tomcat命令LinuxMySqlTomcat
- Linux伺服器---使用mysqlLinux伺服器MySql
- Linux安裝Mysql5.6LinuxMySql
- Rocky Linux 安裝 MySQL 8.0LinuxMySql
- Linux下安裝使用MySQLLinuxMySql
- Linux下安裝MySQL 5.7LinuxMySql
- Linux安裝MySQL8.0LinuxMySql
- Linux 7 安裝Mysql 5.7LinuxMySql
- Linux安裝MySQL(使用yum)LinuxMySql
- linux 常用Mysql指令碼命令LinuxMySql指令碼
- [原始碼分析] 並行分散式任務佇列 Celery 之 Timer & Heartbeat原始碼並行分散式佇列