資源描述:
《keepalivedmysql主主同步mysql高可用(ha)集群》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、1.這個環(huán)境最大的缺陷在于主機寫入速度極慢,主鍵重復。2.mysql最好采用5.6以上集群版本,5.5以下單線程版本不大適合。博客中的mysql為5.5,實際測試挺差的,換成5.6之后十分完美,請各位運維在意一下。環(huán)境:CentOS6.4apache2.4.4PHP5.3.27MYSQL5.5.33機器vip192.168.1.100MASTER:192.168.1.101BACKUP:192.168.1.102高可用部分:yuminstallipvsadmyuminstallkeepalivediptables–F如果不允許禁用iptables請在/e
2、tc/sysconfig/iptables里面加上-A?INPUT?-d?224.0.0.18/16?-j?ACCEPT??(vrrp的組播)-A?INPUT??-p?vrrp?-j?ACCEPT-A?INPUT-mstate–stateNEW-mtcp-ptcp–dport3306-jACCEPserviceiptablesrestartsetenforce0MASTER:vi/etc/keepalived/keepalived.confglobal_defs{notification_email{????????barbytang@hotmail.c
3、om??#郵件地址????}????router_idLVS1}vrrp_sync_groupGLVS{group{????mysqlha??????????????????????#組名?}}vrrp_instancemysqlha{????stateMASTER????????????????????????????????????????????????(經(jīng)過測試這里寫MASTER或者BUCKUP對整個系統(tǒng)都沒有影響)????interfaceeth0?????????????????????????????????????????????????
4、?(注意看當前工作網(wǎng)卡,我就有過遇到bond0的狀況)????lvs_sync_daemon_intefaceeth0????virtual_router_id51????priority180????advert_int1authentication{????auth_typePASS????auth_pass1111}virtual_ipaddress{????192.168.1.100}}virtual_server192.168.1.1003306{??????????#mysql端口????delay_loop6????lb_algorr???
5、???????????????????????????????????????????????????#LVS????lb_kindDR????????????????????????????????????????????????????#LVS采用DR模式????persistence_timeout20????protocolTCP????sorry_server192.168.1.1023306????real_server192.168.1.1013306{????????????????????#buckup機器也這么寫,原因是因為讓正常工作
6、時只用101????weight3????TCP_CHECK{????connect_timeout3????nb_get_retry3????delay_before_retry3????connect_port3306}}}BACKUP:vim/etc/keepalived/keepalived.confglobal_defs{notification_email{????????barbytang@hotmail.com????}????router_idLVS1}vrrp_sync_grouptest{group{????mysqlha}}vrr
7、p_instancemysqlha{????stateBACKUP????interfaceeth0????lvs_sync_daemon_intefaceeth0????virtual_router_id51????priority150????advert_int1authentication{????auth_typePASS????auth_pass1111}virtual_ipaddress{????192.168.1.100}}virtual_server192.168.1.1003306{????delay_loop6????lb_algo
8、rr????lb_kindDR????persistence_timeout20