HTTP + Tomcat 实现负载均衡
1、实验拓扑
2、各个虚机的软件安装
2.1 HTTPD
2.1.1 HTTPD 安装
[root@Tang-11 ~]# ipinfo
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.13 netmask 255.255.255.0 broadcast 192.168.1.255
--
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
[root@Tang-11 ~]# yum install httpd -y
2.1.2 HTTPD 启动
[root@Tang-11 ~]# systemctl start httpd.service
[root@Tang-11 ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
2.1.3 HTTPD 访问
2.1.4 HTTPD 加载的模块,确保已经加载了所需要使用的模块
[root@Tang-11 ~]# httpd -M
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fee9:9f90. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
... ...
systemd_module (shared)
cgi_module (shared)
2.2 Tomcat - 2
2.2.1 Tomcat 安装
[root@Tang-6 ~]# ipinfo
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
--
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
[root@Tang-6 ~]# yum list all tomcat*
Installed Packages
tomcat.noarch 7.0.76-9.el7_6 @base
tomcat-admin-webapps.noarch 7.0.76-9.el7_6 @base
tomcat-docs-webapp.noarch 7.0.76-9.el7_6 @base
tomcat-el-2.2-api.noarch 7.0.76-9.el7_6 @base
tomcat-jsp-2.2-api.noarch 7.0.76-9.el7_6 @base
tomcat-lib.noarch 7.0.76-9.el7_6 @base
tomcat-servlet-3.0-api.noarch 7.0.76-9.el7_6 @base
tomcat-webapps.noarch 7.0.76-9.el7_6 @base
Available Packages
tomcat-javadoc.noarch 7.0.76-9.el7_6 base
tomcat-jsvc.noarch 7.0.76-9.el7_6 base
tomcat-native.x86_64 1.2.21-1.el7 epel
tomcatjss.noarch 7.2.1-8.el7_6 base
[root@Tang-6 ~]# yum install tomcat.noarch tomcat-admin-webapps.noarch tomcat-docs-webapp.noarch tomcat-webapps.noarch -y
2.2.2 Tomcat 启动
[root@Tang-6 ~]# systemctl start tomcat.service
[root@Tang-6 ~]# ss -tnl
State Recv-Q Send