tomcat管理功能的使用,tomcat管理功能这对于tomcat自身及部署在 tomcat上的应用进行管理的web应用,在默认时关闭的,用以下方法开启
[root@localhost ~]# cat /usr/local/tomcat8/conf/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
</tomcat-users>
禁用地址池
[root@localhost ~]# cat /usr/local/tomcat8/webapps/manager/META-INF/context.xml
<Context antiResourceLocking="false" privileged="true" >
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
测试
http://192.168.200.111:8080
输入你的账号密码就可以进入了
WEB站点部署:
公司的架构:
开发人员开发完代码后放到代码仓库(代码管理软件)主流管理仓库{svn/git}
开发人员开发完事后,把代码包包装成 war包 运维上传到服务器
war包直接放到你的网页目录下,他是自己直接解压的
解压有点慢:
[root@localhost ~]# mv jpress-web-newest.war /usr/local/tomcat8/webapps/
[root@localhost ~]# ls /usr/local/tomcat8/webapps/
docs examples host-manager jpress-web-newest.war manager meminfo meminfo.war ROOT
[root@localhost ~]# ls /usr/local/tomcat8/webapps/
docs host-manager jpress-web-newest.war meminfo ROOT
examples jpress-web-newest manager meminfo.war
在浏览器测试
http://192.168.200.111:8080/jpress-web-newest/install
下一步操作安装数据库
[root@localhost ~]# yum -y install mariadb mariadb-server
启动数据库
[root@localhost ~]# systemctl start mariadb
进入数据库;
mysql
MariaDB [(none)]> create database jp;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on jp.* to 'jp'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
在重启一下tomcat就可以使用了;
tomcat监控:在理想的情况,找开发人员给你写个监控界面
方法一,用的不多 需要用到 jdk-8u191-linux-x64.tar.gz
[root@localhost ~]# jps -lvm
4857 org.apache.catalina.startup.Bootstrap start -Djava.util.logging.config.file=/usr/local/tomcat8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -Dcatalina.base=/usr/local/tomcat8 -Dcatalina.home=/usr/local/tomcat8 -Djava.io.tmpdir=/usr/local/tomcat8/temp
4953 sun.tools.jps.Jps -lvm -Dapplication.home=/usr/local/jdk1.8
方法三
tomcat远程监控功能;很重要
在文件中输入内容;
[root@localhost ~]# vim /usr/local/tomcat8/bin/catalina.sh
CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.200.111"
完后重启tomcat
查看端口号 关注一下 12345 开启没
[root@localhost ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4612/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1536/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2679/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2975/sshd: root@pts
tcp6 0 0 :::36322 :::* LISTEN 5170/java
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 5170/java
tcp6 0 0 :::8009 :::* LISTEN 5170/java
tcp6 0 0 :::8080 :::* LISTEN 5170/java
tcp6 0 0 :::56915 :::* LISTEN 5170/java
tcp6 0 0 :::22 :::* LISTEN 1536/sshd
tcp6 0 0 :::12345 :::* LISTEN 5170/java
tcp6 0 0 ::1:25 :::* LISTEN 2679/master
tcp6 0 0 ::1:6010 :::* LISTEN 2975/sshd: root@pts
在电脑上安装jdk 此电脑以安装
jconsole.exe 启动此程序