In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Since I haven't come into contact with load-related debugging for a long time, I have reviewed it.
Experimental system:
(1) CentOS 6.5_x86_64
(2) there are two hosts. In this experiment, the hosts are named after the ip address, that is, 10 hosts and 11 hosts.
Experimental premise: firewall and selinux are turned off, and time synchronization between hosts
Experimental software: nginx-1.10.2-1.el6.x86_64, keepalived-1.2.13-5.el6_6.x86_64, httpd-2.2.15-59.el6.centos.x86_64
In order to facilitate the experiment, only two virtual machines are set up to facilitate testing. Nginx, keepalived and httpd are installed on each virtual machine. The logical topology diagram is as follows.
1. Install and configure keepalived
1. Install directly using yum:
Yum-y install keepalived nginx httpd # if nginx cannot be installed, install the Epel source first, or compile the installation
two。 Configure keepalived on the 34 host:
Vim / etc/keepalived/keepalived.conf
-
Global_defs {/ / this configuration ignores
Notification_email {
Acassen@firewall.loc
}
Notification_email_from Alexandre.Cassen@firewall.loc
Smtp_server 192.168.200.1
Smtp_connect_timeout 30
Router_id master
}
Vrrp_instance VI_1 {
State MASTER / / is defined as a MASTER host
Interface eth0
Virtual_router_id 55 / / Virtual id
Priority 100 / / priority
Advert_int 1 / / Detection interval
Authentication {
Auth_type PASS / / authentication method
Auth_pass abcd / / Authentication password
}
Virtual_ipaddress {
192.168.1.15 brd 192.168.1.255 dev eth0
}
# actions performed after notify_master "/ etc/init.d/nginx start" / / becomes MASTER
# actions performed after notify_backup "/ etc/init.d/nginx stop" / / becomes BACKUP
# actions performed after notify_fault "/ etc/init.d/nginx stop" / / FAULT
}
3. Transfer the configuration file to the 11 host and modify the red part:
4. Two hosts start the keepalived service, and now the host 10 is MASTER, so the services all start on this host:
Service keepalived start
Ip addr show
If 10 stops keeplived, observe whether the vip on 11 is started. If you do not start, please check the cause, probably because the configuration file is miswritten.
There is another problem to note. If the master is stopped, the backup can be taken over, but if the master is started again, it cannot be connected back. Only by stopping the backup can you give it back to the master.
5. Configure nginx proxy server
Upstream webservers {
Server 192.168.1.10 server 8000; # # apache-realserver address
Server 192.168.1.11 server 8000; # # apache-realserver address
}
Server {
Listen 80 default_server
Server_name _
Root / usr/share/nginx/html
# Load configuration files for the default server block.
Include / etc/nginx/default.d/*.conf
Location / {
Proxy_pass http://webservers;
Proxy_set_header X-Real-IP $remote_addr
}
}
The main part is marked here.
6. Configure the realserver part of Apache
In order to test the default configuration, we mainly modify the Listen port to 8000.
The contents in each file used to distinguish access to the two realserver are modified as follows:
7. Final test
The result of the two visits is to visit different realserver. The test was successful (because ip_hash was not configured on nginx), so a different realserver was accessed each time.
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.