下文內(nèi)容主要給大家?guī)鞰ySQL雙主高可用配置方法解析,這里所講到的知識,與書籍略有不同,都是創(chuàng)新互聯(lián)專業(yè)技術(shù)人員在與用戶接觸過程中,總結(jié)出來的,具有一定的經(jīng)驗分享價值,希望給廣大讀者帶來幫助。
創(chuàng)新互聯(lián)公司專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、隆德網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、HTML5、成都商城網(wǎng)站開發(fā)、集團公司官網(wǎng)建設、成都外貿(mào)網(wǎng)站建設、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為隆德等各大城市提供網(wǎng)站開發(fā)制作服務。一、在兩臺云服務器上分別安裝MySQL實例
Mysql01:192.168.0.207
Mysql02:192.168.0.208
vip1:192.168.0.211
vip2:192.168.0.212
(略)
二、在兩臺服務器上配置主主復制
GRANT REPLICATION SLAVE ON *.* TO 'dba_repl'@'192.168.0.%' IDENTIFIED BY '123456';
change master to MASTER_HOST='192.168.0.207',
MASTER_USER='dba_repl',
MASTER_PASSWORD ='123456',
MASTER_LOG_FILE = 'mysql-bin.000003',
MASTER_LOG_POS = 120
;
三、配置keepalived,這個方案的關(guān)鍵點在于keepalived的配制,兩個vrrp_instance在兩個主上的優(yōu)先級相反。
MySQL01:
global_defs {
# Keepalived process identifier
lvs_id MySQL_HA
}
# Script used to check if Proxy is running
vrrp_script check_proxy {
script "killall -0 mysql"
interval 2
weight 3
}
# Virtual interface 1
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_01 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress {
192.168.0.211 dev eth0
}
track_script {
check_proxy
}
}
# Virtual interface 2
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_02 {
state MASTER
interface eth0
virtual_router_id 52
priority 102
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress {
192.168.0.212 dev eth0
}
track_script {
check_proxy
}
}
主二:
global_defs {
# Keepalived process identifier
lvs_id MySQL_HA
}
# Script used to check if Proxy is running
vrrp_script check_proxy {
script "killall -0 mysql"
interval 2
weight 3
}
# Virtual interface 1
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_01 {
state MASTER
interface eth0
virtual_router_id 51
priority 102
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress {
10.103.9.211 dev eth0
}
track_script {
check_proxy
}
}
# Virtual interface 2
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_02 {
state MASTER
interface eth0
virtual_router_id 52
priority 100
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress {
192.168.0.212 dev eth0
}
track_script {
check_proxy
}
}
對于以上關(guān)于MySQL雙主高可用配置方法解析,如果大家還有更多需要了解的可以持續(xù)關(guān)注我們創(chuàng)新互聯(lián)的行業(yè)推新,如需獲取專業(yè)解答,可在官網(wǎng)聯(lián)系售前售后的,希望該文章可給大家?guī)硪欢ǖ闹R更新。
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網(wǎng)頁標題:MySQL雙主高可用配置方法解析-創(chuàng)新互聯(lián)
路徑分享:http://aaarwkj.com/article12/ccdcgc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供微信公眾號、網(wǎng)站內(nèi)鏈、ChatGPT、網(wǎng)站營銷、品牌網(wǎng)站建設、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容