当前位置:网站首页>Keepalived introduction and installation
Keepalived introduction and installation
2022-07-02 00:51:00 【Zhuge Bo】
keepalived brief introduction
Keepalived Is used to detect the state of the server , If a server goes down , Or work breakdown ,Keepalived Will detect , And remove the faulty server from the system , At the same time, use other servers to replace the work of this server , When the server is working Keepalived Automatically add servers to the server cluster , All this work is done automatically , There is no need for human intervention , All you need to do is fix the failed server . Official website : Keepalived Yes, it is C Programming language routing software . The main objective of the project is to Linux System and based on Linux Our infrastructure provides simple and powerful projects with load balancing and high availability . If we say network failure or itself keepalived After hanging up , Pre configured master slaver1 slaver2…

install keepalived, Configure the load balancing server
Installation configuration yum -y install keepalived
Host configuration vi /etc/keepalived/keepalived.conf
SMTP(Simple Mail Transfer Protocol) Simple Mail Transfer Protocol , It's a set of rules for sending mail from source to destination , It controls the way letters are transferred .
shell Script
vim /usr/local/nginx/conf/nginx.conf
#!/bin/bash
PSNUM=`ps -C nginx --no-header|wc -l`
if [ $PSNUM -eq 0 ];then
/usr/local/nginx/sbin/nginx
if [ `ps -C nginx --no-header|wc -l` -eq 0 ]; then
killall keepalived
fi
fi
Host configuration :
vim /etc/keepalived/check-nginx.sh
1
1
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected] # Who is the email source address when sending notification email
smtp_server 127.0.0.1
smtp_connect_timeout 30 # Connect smtp Connection timeout
router_id LVS_DEVEL # Machine identification
}
# It's for health check ups , At that time, when the inspection fails, it will vrrp_instance Of priority Reduce the corresponding value .
vrrp_script chk_http_port {
script "/usr/checknginx.sh" # Monitoring script
interval 2 # Monitoring script detection cycle seconds
weight 10 # It means if script in The instruction execution of failed ,
So the corresponding vrrp_instance The priority of will be reduced 10 A little bit
}
vrrp_instance VI_1 {
state MASTER #backup The machine is configured to BACKUP
interface eth0 # Bound network card name
virtual_router_id 51 # Must be with backup The machine configuration is the same
priority 100 # priority , than backup Machine height at least 50
advert_int 1 # Check interval , Default 1 second VRRP The sending cycle of heartbeat packets , Unit is s
authentication {
auth_type PASS # Type of Authorization , Must be with backup identical
auth_pass 1111 # Authorization code , Must be with backup identical
}
virtual_ipaddress {
192.168.23.220 # fictitious ip Address , Must be with backup identical
}
track_script {
chk_http_port
}
}
Standby configuration
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL_BAK
}
vrrp_script chk_http_port {
script "/usr/checknginx.sh" # Monitoring script
interval 2 # Monitor script detection cycle
weight -10 # It means if script Instruction execution in failed , So the corresponding vrrp_instance The priority of will be reduced 10 A little bit .
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 50
advert_int 1
authentication {
auth_type PASS # Type of Authorization , Must be with backup identical
auth_pass 1111 # Authorization code , Must be with backup identical
}
virtual_ipaddress {
192.168.23.220 # fictitious ip Address , Must be with backup identical
}
track_script {
chk_http_port
}
nopreempt # Don't take IP, When keepalived After switching , It can only be configured in BACKUP On ,
# This avoids the overhead of switching back and forth , It also avoids IP System instability caused by switching
}
边栏推荐
- 测试人进阶技能:单元测试报告应用指南
- Node -- egg creates a local file access interface
- 【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
- How to type spaces in latex
- [eight sorting ③] quick sorting (dynamic graph deduction Hoare method, digging method, front and back pointer method)
- Export default the exported object cannot be deconstructed, and module Differences between exports
- AIX存储管理之总结篇
- heketi 记录
- Example explanation: move graph explorer to jupyterlab
- 449-原码、补码、反码
猜你喜欢

Kyushu cloud and Intel jointly released the smart campus private cloud framework, enabling new infrastructure for education

SQL Server Installation Guide

Picture puzzle wechat applet source code_ Support multi template production and traffic master

2022 low voltage electrician examination questions and answers

The 8-year salary change of testers makes netizens envy it: you pay me one year's salary per month

gradle

Synthetic watermelon game wechat applet source code / wechat game applet source code

The new version of graphic network PDF will be released soon

export default 导出的对象,不能解构问题,和module.exports的区别

Promise and modular programming
随机推荐
[conference resources] the Third International Conference on Automation Science and Engineering in 2022 (jcase 2022)
Friends circle community program source code sharing
Xinniuniu blind box wechat applet source code_ Support flow realization, with complete material pictures
Advanced skills of testers: a guide to the application of unit test reports
Cmake engineering related
Leetcode skimming: stack and queue 03 (valid parentheses)
Tensorflow tensor convolution, input and convolution kernel dimension understanding
Take the enclave Park as a sample to see how Yuhua and Shaoshan play the song of Chang Zhu Tan integrated development
Node - generate wechat permission verification configuration
Data analysis methodology and previous experience summary [notes dry goods]
cookie、session、tooken
2022 high altitude installation, maintenance and removal of test question simulation test platform operation
PLC Analog input analog conversion FB s_ ITR (Mitsubishi FX3U)
Node——Egg 创建本地文件访问接口
Basis of deep learning neural network
Some understandings of graph convolution neural network r-gcn considering relations and some explanations of DGL official code
ThreadLocal内存泄漏是什么,怎么解决
测试人进阶技能:单元测试报告应用指南
BiLSTM-CRF代码实现
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?