In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-05-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to achieve keeplied + nginx + tomcat high-availability deployment, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Tomcat deployment
This experiment is to deploy tomcat middleware on two virtual machines, each virtual machine deploys three services, using three ports 7001, 7002 and 7003 respectively to deploy the program.
Tomcat virtual machine address:
192.168.56.57
192.168.56.58
Tomcat7001 configuration:
Go to the tomcat configuration file and modify the port parameters
Change the business port to port 7001 for external browser access
Change the port closed by the program to port 8006, which is used internally.
Several other services change the tomcat port accordingly.
Nginx configuration
This reverse proxy uses soft load nginx as proxy, and two virtual machines are used to switch between master and slave to ensure the normal use of business.
The addresses of the two Nginx servers are:
192.168.56.55
192.168.56.56
Nginx configuration:
This time nginx is installed in the / usr/local/nginx directory
Nginx profile changes:
[root@edsir1p8 conf] # cat nginx.conf
Worker_processes 4
Error_log logs/error.log
Pid logs/nginx.pid
Events {
Use epoll
Worker_connections 65000
}
Http {
Include mime.types
Default_type application/octet-stream
Log_format main'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent"$http_x_forwarded_for"'
Log_format json'{"@ timestamp": "$time_iso8601",'
'"@ version": "1",'
'"client": "$remote_addr",'
'"url": "$uri",'
'"status": "$status",'
'"domian": "$host",'
'"host": "$server_addr",'
'"size": "$body_bytes_sent",'
'"responsetime": "$request_time",'
'"referer": "$http_referer",'
'"ua": "$http_user_agent"'
'}'
Sendfile on
Include weixin.vhost.conf
}
[root@edsir1p8 conf] # cat weixin.vhost.conf
Upstream weixin {
# ip_hash
Server 192.168.56.57:7001 weight=1
Server 192.168.56.57:7002 weight=1
Server 192.168.56.57:7003 weight=1
Server 192.168.56.58:7001 weight=1
Server 192.168.56.58:7002 weight=1
Server 192.168.56.58:7003 weight=1
}
Server {
Listen 80
Server_name localhost
Location / {
# include proxy_common.conf
Proxy_pass http://weixin;
}
Access_log logs/weixin_access.log
}
Verified by browser
So far, the reverse proxy has been configured successfully.
Keepalived configuration
Install Keepalive
In this lab, keepalived and nginx are installed on a server.
192.168.56.55
192.168.56.56
After completing the above steps, keepalived can realize the transfer of virtual IP, but what we need in practical application is to transfer the virtual IP automatically, so we also need to configure the script of keepalived so that it can automatically transfer the virtual IP to the standby server when a certain nginx cannot provide services. The following script comes from the link provided above, which is based on accessing a link through curl. If you lower the priority of the server if you don't respond for three seconds two times in a row, we create a file called check_status.sh in the / etc/keepalived directory and type the following
#! / bin/bash
Count=0
For ((kumb0; k)
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.