构建高可用服务器之 Keepalive参数详解
生活随笔
收集整理的這篇文章主要介紹了
构建高可用服务器之 Keepalive参数详解
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
keepalived有三類配置區(qū)域,注意不是三種配置文件,是一個(gè)配置文件里面三種不同類別的配置區(qū)域,
全局配置(Global?Configuration)、VRRPD配置、LVS配置!?Configuration?File?for?keepalived
################################全局配置#########################################
global_defs?{notification_email?{??????????#指定keepalived在發(fā)生切換時(shí)需要發(fā)送email到的對象,一行一個(gè)654001593@qq.com}notification_email_from?654001593@qq.com?#指定發(fā)件人smtp_server?192.168.200.1?????#指定smtp服務(wù)器地址smtp_connect_timeout?30???????#指定smtp連接超時(shí)時(shí)間router_id?LVS_DEVEL???????????#運(yùn)行keepalived機(jī)器的一個(gè)標(biāo)識(shí)
}
################################VRRP配置#########################################
#VRRP實(shí)例定義塊
vrrp_instance?VI_1?{???state?MASTER?????????????#指定那個(gè)為master,那個(gè)為backup,如果設(shè)置#了nopreempt這個(gè)值不起作用,主備靠priority決定interface?eth0???????????#設(shè)置實(shí)例綁定的網(wǎng)卡virtual_router_id?51?????#VPID標(biāo)記?,路由ID,可通過#tcpdump?vrrp查看priority?100?????????????#優(yōu)先級,高優(yōu)先級競選為masteradvert_int?1?????????????#檢查間隔,默認(rèn)1秒nopreempt????????????????#非搶占(因?yàn)槟J(rèn)如果master掛的時(shí)候,backup會(huì)頂上,當(dāng)master再好的時(shí)候,會(huì)再切回去,這樣就會(huì)造成兩次#斷開,加上nopreempt的時(shí)候,及時(shí)master又好了,依舊不會(huì)切換,但是要注意兩個(gè)state?都要是backup)?????authentication?{?????????#設(shè)置認(rèn)證auth_type?PASS???????#認(rèn)證方式auth_pass?1111???????#認(rèn)證密碼}virtual_ipaddress?{??????#設(shè)置vip192.168.200.16192.168.200.17192.168.200.18}
}
#################################LVS配置#############################################
#虛擬服務(wù)器定義塊
virtual_server?192.168.200.100?443?{????????#VIP?端口delay_loop?6????????????????????????????#健康檢查時(shí)間間隔lb_algo?rr??????????????????????????????#lvs調(diào)度算法rr|wrr|lc|wlc|lblc|sh|dhlb_kind?NAT?????????????????????????????#負(fù)載均衡轉(zhuǎn)發(fā)規(guī)則NAT|DR|RUNnat_mask?255.255.255.0??????????????????#nat?掩碼persistence_timeout?50??????????????????#會(huì)話保持時(shí)間protocol?TCP#使用的協(xié)議sorry_server<IPADDR>?<port>?????????????????#備用機(jī),所有realserver失效后啟用real_server?192.168.201.100?443?{???????#RIP?端口weight?1????????????????????????????#默認(rèn)為1,0為失效
inhibit_on_failure??????????????????????????#在服務(wù)器健康檢查失效時(shí),將其設(shè)為0,而不是直接從ipvs中刪除
notify_up???腳本(絕對路徑)??????????????????#在檢測到server?up后執(zhí)行腳本
notify_down?腳本(絕對路徑)??????????????????#在檢測到server?down后執(zhí)行腳本SSL_GET?{url?{path?/digest?ff20ad2481f97b1754ef3e12ecd3a9cc?????#檢查url,可以指定多個(gè)?status_code?200?????????????????????????????????????#檢查的返回狀態(tài)碼?}url?{path?/mrtg/digest?9b3a0c85a887a256d6939da88aabd8cd}connect_timeout?3?????????????????????????????#連接超時(shí)時(shí)間nb_get_retry?3????????????????????????????????#重連次數(shù)delay_before_retry?3??????????????????????????#重連間隔時(shí)間connect_port?23???????????????????????????????????????#健康檢查的端口的端口}}
}
轉(zhuǎn)載于:https://blog.51cto.com/zhagyilig/1902426
總結(jié)
以上是生活随笔為你收集整理的构建高可用服务器之 Keepalive参数详解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 设置联想电脑双屏显示(备用待查)
- 下一篇: 对于人工智能的学习有哪些建议?【转】