Keepalived : प्रक्रियाओं की निगरानी करें2023/10/11 |
Keepalived के साथ प्रक्रियाओं की निगरानी। यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है। VIP:10.0.0.30 +----------------------+ | +----------------------+ | [node01.srv.world] |10.0.0.51 | 10.0.0.52| [node02.srv.world] | | Keepalived#1 +----------+----------+ Keepalived#2 | | | | | +----------------------+ +----------------------+ |
[1] | |
[2] | उदाहरण के लिए, बुनियादी Keepalived सेटिंग्स के अलावा, sshd प्रक्रिया की निगरानी के लिए सेटिंग्स जोड़ें। |
root@node01:~#
vi /etc/keepalived/keepalived.conf global_defs { router_id node01 notification_email { root@localhost } notification_email_from root@node01.srv.world smtp_server localhost smtp_connect_timeout 30 } # sshd प्रक्रिया के लिए मॉनिटरिंग सेटिंग जोड़ें vrrp_track_process track_sshd { process sshd delay 1 } vrrp_instance VRRP1 { state MASTER # nopreempt interface enp1s0 virtual_router_id 101 priority 200 advert_int 1 virtual_ipaddress { 10.0.0.30/24 } # जोड़ना track_process { track_sshd } smtp_alert }root@node01:~# systemctl restart keepalived
|
[3] | ठीक है। sshd डाउन होने पर फ़ेलओवर और फ़ेलबैक सत्यापित करें। |
# प्राथमिक नोड root@node01:~# ip address show enp1s0 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:35:69:7c brd ff:ff:ff:ff:ff:ff inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0 valid_lft forever preferred_lft forever inet 10.0.0.30/24 scope global secondary enp1s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe35:697c/64 scope link valid_lft forever preferred_lft foreverroot@node01:~# systemctl stop sshd root@node01:~# ip address show enp1s0 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:35:69:7c brd ff:ff:ff:ff:ff:ff inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe35:697c/64 scope link valid_lft forever preferred_lft foreverroot@node01:~# ssh ubuntu@node02 "ip address show enp1s0" ubuntu@node02's password: 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:7d:c5:e7 brd ff:ff:ff:ff:ff:ff inet 10.0.0.52/24 brd 10.0.0.255 scope global enp1s0 valid_lft forever preferred_lft forever inet 10.0.0.30/24 scope global secondary enp1s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe7d:c5e7/64 scope link valid_lft forever preferred_lft forever |
Sponsored Link |