真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

mysql+keepalived的安裝配置方法

本篇內(nèi)容主要講解“MySQL+keepalived的安裝配置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“mysql+keepalived的安裝配置方法”吧!

創(chuàng)新互聯(lián)2013年開創(chuàng)至今,先為宜良等服務(wù)建站,宜良等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為宜良企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

注意:keepalived在每一臺(tái)的服務(wù)器上都需要安裝

環(huán)境介紹:

master_mysql: 10.20.20.51
slave_mysql : 10.20.20.61
virtual_ip :  10.20.20.201

注意:關(guān)閉防火墻、selinux
一、安裝keepalived

下載地址:
1、 http://www.keepalived.org/software/keepalived-1.1.20.tar.gz

3、安裝C編譯器
yum install popt-devel openssl-devel popt-devel 
yum install gcc gcc-c++ autoconf automake


4、編譯安裝
[root@node1 ~]# tar zxvf keepalived-1.2.13.tar.gz
[root@node1 keepalived-1.2.13]# cd keepalived-1.2.13
[root@node1 keepalived-1.2.13]# ./configure --prefix=/usr/local/keepalived --disable-fwmark
[root@node1 keepalived-1.2.13]# make
[root@node1 keepalived-1.2.13]# make install
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
[root@node1 keepalived-1.2.13]# cd /etc/init.d/
[root@node1 init.d]# chkconfig --add keepalived
[root@node1 init.d]# chkconfig keepalived on
[root@node1 init.d]# mkdir -p /etc/keepalived

5、配置keepalived文件
1)主庫的keepalived配置文件
vim /etc/keepalived/keepalived.conf
global_defs {


router_id Hadb_1


}


vrrp_sync_group VGM {


group {


VI_HA


}


}


vrrp_script chk_mysql {




script "

interval 1


}


# vvrp_instance define #


vrrp_instance VI_HA {


state MASTER


interface eth0


virtual_router_id 54


priority 100


advert_int 1


authentication {


auth_type PASS


auth_pass hamysql


}


virtual_ipaddress {


10.20.20.201


}


track_script {


chk_mysql


}


}


2)從庫的keepalived的配置文件
vim /etc/keepalived/keepalived.conf


global_defs {


router_id Hadb_1


}


vrrp_sync_group VGM {


group {


VI_HA


}


}


vrrp_script chk_mysql {




script "

interval 1


}


# vvrp_instance define #


vrrp_instance VI_HA {


state BACKUP


interface eth0


virtual_router_id 54


priority 50


advert_int 1


authentication {


auth_type PASS


auth_pass hamysql


}


virtual_ipaddress {


10.20.20.201


}


track_script {


chk_mysql


}


}
6、啟動(dòng)keepalived服務(wù)
service keepalived start



二、配置mysql的AB復(fù)制(互相的AB復(fù)制)




1、1.主庫配置(master服務(wù)器)


 #vi /etc/my.cnf
       [mysqld]
       log-bin=mysql-bin   //[必須]啟用二進(jìn)制日志
       server-id=51       //[必須]服務(wù)器唯一ID,默認(rèn)是1,一般取IP最后一段


2.修改從服務(wù)器slave:


   #vi /etc/my.cnf
       [mysqld]
       log-bin=mysql-bin   //[必須]啟用二進(jìn)制日志
       server-id=61       //[必須]服務(wù)器唯一ID,默認(rèn)是1,一般取IP最后一段
3、重啟兩臺(tái)服務(wù)器的mysql
/etc/init.d/mysql restart


4、在主服務(wù)器上建立帳戶并授權(quán)slave:
10.20.20.51:
mysql>GRANT REPLICATION SLAVE ON *.* to 'repler'@'%' identified by '123.com';


10.20.20.61:
mysql>GRANT REPLICATION SLAVE ON *.* to 'repler'@'%' identified by '123.com';


5、登錄主服務(wù)器的mysql,查詢master的狀態(tài)
mysql>show master status;
   +------------------+----------+--------------+------------------+
   | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
   +------------------+----------+--------------+------------------+
   | mysql-bin.000004 |      308 |              |                  |
   +------------------+----------+--------------+------------------+
   
 6、配置從服務(wù)器Slave:
10.20.20.61: 
 mysql>change master to master_host='10.20.20.51',master_user='repler',master_password='123.com',
         master_log_file='mysql-bin.000004',master_log_pos=308;  
   
 10.20.20.51:   
  mysql>change master to master_host='10.20.20.61',master_user='repler',master_password='123.com',
         master_log_file='mysql-bin.000004',master_log_pos=308;    
 7、啟動(dòng)從服務(wù)器復(fù)制功能  
  mysql>start slave;   
   
  8、檢查從服務(wù)器復(fù)制功能狀態(tài):
   mysql> show slave status\G 

到此,相信大家對“mysql+keepalived的安裝配置方法”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!


新聞名稱:mysql+keepalived的安裝配置方法
網(wǎng)站網(wǎng)址:http://weahome.cn/article/jphdhj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部