亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mysql+keepalived的安裝配置方法

發布時間:2021-08-18 09:42:10 來源:億速云 閱讀:212 作者:chen 欄目:MySQL數據庫

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

注意:keepalived在每一臺的服務器上都需要安裝

環境介紹:

master_mysql: 10.20.20.51
slave_mysql : 10.20.20.61
virtual_ip :  10.20.20.201

注意:關閉防火墻、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、啟動keepalived服務
service keepalived start



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




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


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


2.修改從服務器slave:


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


4、在主服務器上建立帳戶并授權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、登錄主服務器的mysql,查詢master的狀態
mysql>show master status;
   +------------------+----------+--------------+------------------+
   | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
   +------------------+----------+--------------+------------------+
   | mysql-bin.000004 |      308 |              |                  |
   +------------------+----------+--------------+------------------+
   
 6、配置從服務器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、啟動從服務器復制功能  
  mysql>start slave;   
   
  8、檢查從服務器復制功能狀態:
   mysql> show slave status\G 

到此,相信大家對“mysql+keepalived的安裝配置方法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

华容县| 磴口县| 万山特区| 宜宾县| 文成县| 贵港市| 南华县| 姜堰市| 扬中市| 军事| 芦山县| 元江| 海南省| 温宿县| 驻马店市| 庆安县| 泰来县| 卢氏县| 紫云| 那坡县| 巢湖市| 甘泉县| 邳州市| 城步| 都江堰市| 周宁县| 华亭县| 鄂托克旗| 通海县| 台安县| 丰都县| 吉隆县| 行唐县| 深州市| 汶上县| 息烽县| 师宗县| 弋阳县| 确山县| 盐城市| 科技|