标签:pool and prope webapp localhost query -- 商城 文件
66主机操作:
[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# netstat -lnpt |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 11512/mysqld
[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> create database slsaledb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on slsaledb.* to admin@‘%‘ identified by ‘123456‘ ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
导入数据文件 slsaledb-2014-4-10.sql
[root@localhost ~]# mysql -uroot < slsaledb-2014-4-10.sql
[root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
url=jdbc\:mysql\://192.168.200.66\:3306/slsaledb?useUnicode\=true&characterEncoding\=UTF-8
uname=admin
保存退出
[root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
[root@localhost ~]# tail -f /usr/local/tomcat8/logs/catalina.2019-11-23.log
23-Nov-2019 10:57:43.916 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 16125 ms
---------------
--67主机操作
[root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
driverClassName=com.mysql.jdbc.Driver
url=jdbc\:mysql\://192.168.200.66\:3306/slsaledb?useUnicode\=true&characterEncoding\=UTF-8
uname=admin
password=123456
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=100
removeAbandonedTimeout=180
removeAbandoned=true
保存退出
[root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
[root@localhost ~]# tail -f /usr/local/tomcat8/logs/catalina.2019-11-23.log
23-Nov-2019 10:55:23.042 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 15720 ms
=====
在浏览器中访问192.168.200.66:8080 登录密码进入
在访问192.168.200.67:8080 登录密码进入
66主机
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost ~]# nginx -t
[root@localhost ~]# killall -HUP nginx
在浏览器中进行访问192.168.200.66
出现400错误
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
在location中添加
location / {
root html;
index index.html index.htm;
proxy_pass http://tomcat_pool;
proxy_set_header Host $http_host; //转向头部
}
在进行访问
另外添加以下内容
upstream tomcat_pool{
ip_hash; //固定IP
server 192.168.200.66:8080 weight=1;
server 192.168.200.67:8080 weight=1;
}
结束!!
!
!!!!!!!!!!!!!!!!!!!!!!!!!
标签:pool and prope webapp localhost query -- 商城 文件
原文地址:https://www.cnblogs.com/elin989898/p/11914275.html