In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Brief introduction to keepalived:
1. What is keepalived?
Keepalived was originally designed for lvs to ensure the high availability of the cluster, which is used to detect the status of the server and the failover (failover) between the loadbbalance host and the backup host to prevent a single point of failure. If a server goes down or fails in the cluster, keepalived will detect and kick the faulty server out of the cluster and let other servers take the place of the server. When the server returns to normal, keepalived automatically adds the server to the cluster without human intervention, just need to make the relevant configuration and repair the faulty server.
2. The working status of keepalived:
Keepalived is implemented by vrrp (virtual router redundancy protocol) protocol, that is, virtual routing redundancy protocol. Vrrp is a protocol to achieve high availability of routers, which consists of a routing group of multiple routers providing the same service, which is composed of a primary route and multiple backup routes. Master uses VIP (virtual IP) within the group to provide services, and master uses the multicast address 224.0.0.18 to send vrrp advertisements to backup. When backup does not receive vrrp notifications from master, master is considered to be down. Restart the backup through the priority of vrrp to elect a higher priority as master to provide services to the outside. This ensures the high availability of routes.
Keepalived is a software similar to layer3, 4-7 switching mechanism, that is, IP, TCP and application layer of IP/TCP protocol stack.
How layer3 works: at this time keepalived works in the IP layer of the IP/TCP protocol stack. Taking the IP address of the server as the standard of whether the server is working properly or not, master sends ICMP packets regularly through multicast. If an abnormal IP,keepalived is found, the server will be considered invalid and the server farm will be proposed.
How layer4 works: at this time keepalived works in the TCP layer of the IP/TCP protocol stack. The status of the TCP port provided by the service determines whether the server is working properly. If a port snooping anomaly is detected, keepalived will kick the server out of the server farm.
How layer7 works: keepalived works in the application layer of the IP/TCP protocol stack. Comparatively speaking, it is more responsible than layer3 and layer4, and the network takes up more bandwidth and uses relatively less. Keepalived will check whether the service program is normal according to the user's own configuration, and if it does not match the user's settings, it will be regarded as an exception on the server and will be kicked out of the server farm.
4. The module of keepalived
Keepalived mainly has three modules: core, check and vrrp. Core module is the core of keepalived, which is responsible for the startup and maintenance of the main process as well as the loading and parsing of global configuration files. Check is responsible for health check-ups, including common check-ups. The vrrp module is used to implement the VRRP protocol.
5. Configuration file of keepalived
A relatively complete keepalived configuration file, its configuration file keepalived.conf can contain three text blocks: global definition block (global_defs), VRRP instance definition block (vrrp_instance) and virtual server definition block (virtual_server). Global definition blocks and virtual server definition blocks are required, and if there is only one load balancer, there is no need for VRRP instance definition blocks.
II. Deploy keepalived services
1. Before compiling and installing keepalived, first install the dependent library files that keepalived needs:
[root@node1 ~] # yum-y install popt-devel kernel-devel openssl-devel gcc-c++ libnl-devel libnl3-devel libnfnetlink-devel
2. Download the keepalived source code compression package. :
Download address: http://www.keepalived.org/software/keepalived-1.3.5.tar.gz
[root@node1 ~] # wget http://www.keepalived.org/software/keepalived-1.3.5.tar.gz
3. Install keepalived:
Using the specified kernel library at compile time and specifying the installation directory as / directory can save a lot of troublesome links. This allows you to use the keepalived service directly after the installation is complete
[root@node1 ~] # tar zxf keepalived-1.3.5.tar.gz [root@node1 ~] # cd keepalived-1.3.5 [root@node1 keepalived-1.3.5] #. / configure-prefix=/-with-kernel-dir=/usr/src/kernels/3.10.0-514.21.1.el7.x86_64/include/ [root@node1 keepalived-1.3.5] # make [root@node1 keepalived-1.3.5] # make install
4. The installation is complete.
Keepalived configuration file location: under the keepalived.conf directory under / etc/keepalived, there are various template files under the samples subdirectory. The location of the execution program is / usr/sbin/keepalived. The startup script has automatically added the system. You can use the systemctl command directly to perform startup.
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.