mysql Keepalived 實踐

來源:互聯網
上載者:User

標籤:

1.解壓原始碼包(解壓縮到 /usr/src/)
tar zxvf keepalived-1.2.18.tar.gz -C /usr/src/
2.原始碼安裝(在解壓縮目錄下)
(1)./configure
(2)make
(3)make install
3.用原始碼包產生rpm包
(1)產生keepalived.spec檔案及Makefile檔案夾
./configure
(2)構建rpm包
rpmbuild ~
cp keepalived.spec ~/rpmbuild/SPECS/
cp keepalived-1.2.18.tar.gz ~/rpmbuild/SOURCES/
(3)進入 cd ~/rpmbuild/SPECS/ 目錄
(4)編譯源碼並產生rpm包
rpmbuild -bb keepalived.spec
構建完成後在 /root/rpmbuild/RPMS/x86_64目錄下可以找到
4.安裝rpm包
rpm -ivh keepalived-1.2.18-5.x86_64.rpm

----------------搭建mysql HA----------------------
1.關閉防火牆
service iptables stop
2.將 SELinux 在 Enforcing 與 permissive 之間切換與查看(切換成permissive)
[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce Permissive
[[email protected] ~]# setenforce 1
[[email protected] ~]# getenforce Enforcing
3.配置好相應的mysql replication 後登陸mysql(a機器為 197 b機器為165)
A機器:
GRANT REPLICATION SLAVE ON *.* TO ‘slave‘@‘10.2.10.165‘ IDENTIFIED BY ‘123456‘;
flush privileges;
B機器:
GRANT REPLICATION SLAVE ON *.* TO ‘slave‘@‘10.2.10.197‘ IDENTIFIED BY ‘123456‘;
flush privileges;

配置同步
A機器:
CHANGE MASTER TO MASTER_HOST=‘10.2.10.165‘, MASTER_PORT=3306, MASTER_USER=‘slave‘,MASTER_PASSWORD=‘123456‘, master_auto_position=1;
start slave
B機器:
CHANGE MASTER TO MASTER_HOST=‘10.2.10.197‘, MASTER_PORT=3306, MASTER_USER=‘slave‘,MASTER_PASSWORD=‘123456‘, master_auto_position=1;
start slave

mysql Keepalived 實踐

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.