In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Overview of Keepalived double-click hot backup
At first, Keepalived is a powerful auxiliary tool specially designed for LVS, which is mainly used to provide failover (Failover) and health check (Health Checking) functions-to judge the availability of LVS load scheduler and node server, isolate and replace it with a new server in time, and rejoin the cluster when the failed host is restored.
The so-called dual-computer hot standby means that both machines are running, but not both machines are providing services at the same time.
When one of the service providers fails, the other will automatically take over and provide service immediately, and the switching time is very short.
VRRP (Virtual Router Redundancy Protocol) Virtual routing redundancy Protocol
Keepalived works on the VRRP (Virtual Router Redundancy Protocol) virtual routing redundancy protocol.
There are two important concepts in VRRP: the VRRP router and the virtual router, the master router and the backup router.
VRRP router refers to the router running VRRP, is a physical entity, virtual router refers to the creation of VRRP protocol, is a logical concept. A group of VRRP routers work together to form a virtual router.
There is an election mechanism in Vrrp, which is used to select the route that provides the service, that is, the master route, and the other routes become backup routes. When the master route fails, a master route will be re-elected in the backup route to continue to work to ensure uninterrupted service.
Install [root@localhost ~] # yum install-y keepalived ipvsadm [root@localhost ~] # systemct1 enable keepalivedCreated symlink from / etc/systemd/ system/ multi-user. Target .wants / keepalived.service to / usr/1ib/sys temd/system/keepal ived. Service.
Keepalived can be used as a server failover, which is mainly aimed at virtual IP address drift, so it can be applied to a variety of application servers (whether it is web, FTP, Mail, or SSH, DNS).
The following describes the configuration of Keepalived:
Configure the primary server
After installing the Keepalived service, edit the Keepalived main configuration file: / etc/keepalived/keepalived.conf
In the configuration file, modify the "global_defs {...}" area to set global parameters; modify the "vrrp_instance instance name {...}" area to specify VRRP hot backup parameters
Note text with "!" Beginning of symbol
Modify the configuration file:
The modification of vim / etc/keepalived/keepalived.conf is as follows: glabal_defs {route_id R1 / / Server name} vrrp-instance VI_1 {state MASTER / / determine the hot backup type (MASTER is primary) BUCKUP for standby) interface ens33 / / hot backup interface virtal_router_id 1 / / hot backup group number priority 1 / / priority (high primary) advert_int 1 / / Hello time} authentication {auth_type PASS auth_pass 12345 / / password authentication (same as master / slave)} virtual_ipaddress {192.168.18.254 / / (VIP address)}
Configure the backup server
In the same Keepalived hot backup group, the Keepalived configuration files of all servers are basically the same, so when configuring the backup server, you can refer to the configuration file of the master server and only modify the server name, hot backup status and priority.
The configuration steps are basically the same as the master:
The installation package yum-y install keepalived edits the main configuration file vim / etc/keepalived/keepalived.conf glabal_defs {route_id R2 / / server name} vrrp-instance VI_1 {state BACKUP / / determines the hot standby type (MASTER is primary) BUCKUP for standby) interface ens33 / / hot backup interface virtal_router_id 1 / / hot backup group number priority 30 / / priority (high primary) advert_int 1 / / Hello time} authentication {auth_type PASS auth_pass 12345 / / password authentication (same as master / standby)} virtual_ipaddress {192.168.18.254 / / (VIP address)}
test
It can be verified by a simple method: use the client captain's pingVIP address, and then shut down the primary server to see if it can be reached.
Through the test, it is found that when the main server is shut down, the ping test returns to normal after an interruption, indicating that the backup server has regained the control of the VIP address and the service has resumed normal operation.
Finally, when the primary server is disconnected, the backup server is immediately converted to the primary server for normal use.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.