In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Let's first talk about how keepalived works:
The working principle of keepalived is based on three layers, namely IP layer, TCP layer and application layer.
IP layer: keepalived periodically sends an ICMP packet similar to a ping program to the servers in the server cluster. Popular understanding is that I keepalived to ping your server, if I ping through, then I know you are still alive, we can continue to cooperate, if unfortunately found that you are dead, then you have to kick this server. This layer is to ensure that the server ip address is valid, once to determine whether the server can continue to apply for a job.
TCP layer: this layer is similar to the IP layer, except that the IP layer checks IP, and this layer checks the TCP port. Keepalived is in the IP layer and reports that the IP of your server is valid, and then continue to look at your TCP port, for example, if you are web server, then your port 80 should be open if keepalived finds that your port 80 is not enabled. Then it will think that you are dead and then delete it.
Application layer: this layer is the specific working procedure. Keepalived is a conscientious prosecutor. The application layer program is closely related to the user's settings. Keepalived checks whether the operation of the server is consistent with the user's settings. If it is inconsistent, keepalived will declare the server to be sacrificed.
Keepalived + nginx
Host: 172.25.44.3 server3
Standby: 172.25.44.4 server4
Configure virtual ip [root@server3 ~] # vim / etc/sysconfig/network-scripts/ifcfg-eth0:0DEVICE=eth0:0TYPE=EthernetONBOOT=yesBOOTPROTO=staticDNS1=172.25.44.44IPADDR=172.25.44.100NETMASK=255.255.255.0GETWAY=172.25.44.44 [root@server3 ~] # / etc/init.d/network restart [root@server3 ~] # ifconfigeth0 Link encap:Ethernet HWaddr 52VOV 5400VAND 48VOLO 3e inet addr:172.25.44.4 Bcast:172.25.44.255 Mask : 255.255.255.0 inet6 addr: fe80::5054:ff:fe48:603e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11926 errors:0 dropped:0 overruns:0 frame:0 TX packets:6533 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:25662550 (24.4 MiB) TX bytes:876645 (856.0 KiB) eth0 : 0 Link encap:Ethernet HWaddr 52:54:00:48:60:3E inet addr:172.25.44.100 Bcast:172.25.44.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: 1/128 Scope:Host UP LOOPBACK RUNNING MTU : 16436 Metric:1 RX packets:36283 errors:0 dropped:0 overruns:0 frame:0 TX packets:36283 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1982812 (1.8 MiB) TX bytes:1982812 (1.8 MiB) both active and standby machines need to be configured to install nginx
Installation package: nginx-1.10.3.tar.gz
Extract the installation package: tar zxf nginx-1.10.3.tar.gz
[root@server3 software] # cd nginx-1.10.3-prefix=/usr/local/lnmp/nignx [root@server3 nginx-1.10.3] #. / configure [root@server3 nginx-1.10.3] # make [root@server3 nginx-1.10.3] # make install [root@server3 nginx-1.10.3] # ln-s / usr/local/lnmp/nginx/sbin/nginx / usr/local/sbin/# create soft links for nginx
Configure nginx [root@server3 nginx-1.10.3] # cd / usr/local/lnmp/nginx/conf [root@server3 conf] # vim nginx.conf/# to access port 8088 Yes the release directory is / var/www/html, while the default release directory for nginx is still / usr/local/lnmp/nginx/htmlserver {listen 8088 # listen on port 8088 server_name localhost; location / {root / var/www/html; index index.html index.htm;} error_page 500502503504 / 50x.hml; location = / 50x.html {root / usr/local/lnmp/nginx/html }} [root@server3 conf] # cd / var/www/html [root@server3 html] # vim index.htmlWelcome to nginxinstalled Welcome to nginx! 172.25.44.3 [root@server3 html] # nginx installation keepalived
Installation package: keepalived-1.2.2.tar.gz
[root@server3 software] # wget http://www.keepalived.org/software/keepalived-1.2.2.tar.gz[root@server3 software] # tar zxf keepalived-1.2.2.tar.gz [root@server3 software] # cd keepalived-1.2.2 [root@server3 keepalived-1.2.2] #. / configure [root@server3 keepalived-1.2.2] # make [root@server3 keepalived-1.2.2] # make install [root@server3 keepalived-1. 2.2] # cp / usr/local/sbin/keepalived / usr/sbin/ [root@server3 keepalived-1.2.2] # cp / usr/local/etc/rc.d/init.d/keepalived / etc/init.d/ [root@server3 keepalived-1.2.2] # cp / usr/local/etc/sysconfig/keepalived / etc/sysconfig/ [root@server3 keepalived-1.2.2] # cp-r / usr/local/etc/keepalived/ / etc/ configuration leepalived [root@ Server3 keepalived-1.2.2] # vim / var/www/html/index.htmlglobal_defs {router_id LVS_DEVEL} vrrp_script chk_http_port {script "
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.