Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

KEEPALIVED dual computer hot standby

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Overview of "1"

The function of KEEPALIVED is to detect the status of the back-end TCP service. If a back-end node providing TCP service goes down or fails, KEEPALIVED detects it in time and removes the faulty node from the system. When the node providing TCP service is restored and the service is provided normally, KEEPALIVED automatically sends the node providing TCP service to the cluster. All this work is done automatically by KEEPALIVED without human intervention. All that needs to be done manually is to repair the failed server.

"2" installation

Visit the official website http://www.keepalived.org to get the software package. Version 1.2.16 here

The function implemented this time is that when accessing the WEB service of 192.168.3.118, the real servers 192.168.3.1 and 192.168.3.2 are automatically proxied to the back end, and the host computer is 192.168.3.87 and the standby machine is 192.168.3.88.

(1) tar xvf keeplived-1.2.16.tar.gz

(2) cd keepalived-1.2.16

(3) yum install-y openssl openssl-devel

(4). / configure-prefix=/usr/local/keepalived

(5) make & make install

(6) ln-s / usr/local/keepalived/etc/keepalived

"3" configuration

/ etc/keepalived/keepalived.conf master configuration file (master node)

one! Cconfigure File for keepalived

two

3 vrrp_instance VI_1 {

4 # specify that the node should be set to BACKUP on the standby node of the primary node

5 state MASTER

6 # Network interface of kidnapping virtual IP

7 interface eno1677736

8 # VRRP group name, both nodes need to be set the same to indicate that each node belongs to the same VRRP group

9 virtual_router_id 51

10 # the priority of the master node. The value is 1-254. Note that the slave node must have a lower priority than the master node.

11 priority 50

12 # Multicast message sending interval, the two nodes need to set the same

13 advert_int 1

14 # set verification information, the two nodes need to be consistent

15 authentication {

16 auth_type PASS

17 auth_pass 1234

18}

19 # specify a virtual IP. The two nodes need to be set the same.

20 virtual_ipaddress {

21 192.168.3.118

22}

23}

24 # Virtual IP Service

25 virtual_server 192.168.3.118 80 {

26 # set the interval between checking the actual server

27 delay_loop 6

28 # specify LVS algorithm

29 lb_algo rr

30 # specify LVS mode

31 lb_kind nat

32 nat_mask 255.255.255.255

33 # persistent connection settings, session persistence time

34 persistence_timeout 50

35 # forwarding protocol is TCP

36 protocol TCP

37 # actual backend TCP service configuration (1)

38 real_server 192.168.3.1 80 {

39 # weight

40 weight 1

41 TCP_CHECK {

42 # connection Port

43 connect_port port number

44 # connection timeout

45 connect_timeout 3

46 # retry count

47 nb_get_retry 3

48 # retry interval (seconds)

49 delay_before_retry 4

50}

51}

52 # actual backend TCP service configuration (2) the configuration content is the same as above

53 real_server 192.168.3.2 80 {

54 weight 1

55 TCP_CHECK {

56 connect_port port number

57 connect_timeout 3

58 nb_get_retry 3

59 delay_before_retry 4

60}

61}

62}

(backup node configuration)

Unlike the master node, the standby state is set to BACKUP

State BACKUP

The priority is lower than the primary node.

Priority 50

Other configurations are the same as the primary node

"4" starts KEEPALIVED

Primary node:

Export PATH=/usr/local/keepalived/sbin:$PATH.

Keepalived-D-f / etc/keepalived/keepalived.conf

Use the ip addr list command to view service status

Backup node:

/ usr/local/keepalived/sbin/keepalived-D-f / etc/keepalived/keepalived.conf

Also use the ip addr list command to view the service status

Direct access via VIP: curl http://192.168.3.118 (HELLO 192.168.3.1 / HELLO 192.168.3.2 is successful)

At this point, the installation, configuration and startup of KEEPALIVED are basically completed.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report