zoukankan      html  css  js  c++  java
  • tomcat 多实例做

    tomcat 多实例做
    解压部署tomcat程序
    tar xf apache-tomcat-8.9.16.tar.gz
    mv apache-tomcat-8.9.16  /usr/local/
    创建实例一个
    mkdir -p /usr/local/tomcat_instance/tomcat1
    拷贝程序目录下的conf文件放入个实例中
    cp -R /usr/local/apache-tomcat-8.9.16/conf/ /usr/local/tomcat_instance/tomcat1
    在实例中创建启动脚本和停止脚本
    mkdir /usr/local/tomcat_instance/tomcat1/bin
    touch /usr/local/tomcat_instance/tomcat1/bin
    chmod +x /usr/local/tomcat_instance/tomcat1/bin/startup.sh
    ls /usr/local/tomcat_instance/
    指向实例目录路径(编辑)
    vim /usr/local/tomcat_instance/tomcat1/bin/startup.sh
    ------------------------------------------------------------
    #!/bin/bash
    export CATALINA_HOME="/usr/local/apache-tomcat-8.5.16"
    export CATALINA_BASE="/usr/local/tomcat_instance/tomcat1"
    export CATALINA_TMPDIR="$CATALINA_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
    export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat1"
    #创建logs目录
    if [ ! -d "$CATALINA_BASE/logs" ]; then
      mkdir $CATALINA_BASE/logs
    fi
    #创建temp目录
    if [ ! -d "$CATALINA_BASE/temp" ]; then
      mkdir $CATALINA_BASE/temp
    fi
    # 调用tomcat启动脚本
    bash $CATALINA_HOME/bin/startup.sh "$@"
    ----------------------------------------------------------------
    第二个实例,同上
     touch /usr/local/tomcat_instance/tomcat2}/bin/shutdown.sh
    chmod +x /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/shutdown.sh
     vim /usr/local/tomcat_instance/tomcat1/bin/shutdown.sh
    ---------------------------------------------------------------------
    #!/bin/bash
    export CATALINA_HOME="/usr/local/apache-tomcat-8.5.16"
    export CATALINA_BASE="/usr/local/tomcat_instance/tomcat1"
    export CATALINA_TMPDIR="$CATALINA_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
    bash $CATALINA_HOME/bin/shutdown.sh "$@"
    ------------------------------------------------------------------------------
    [root@localhost ~]# vim /usr/local/tomcat_instance/tomcat2/bin/shutdown.sh
    #!/bin/bash
    export CATALINA_HOME="/usr/local/apache-tomcat-8.5.16"
    export CATALINA_BASE="/usr/local/tomcat_instance/tomcat2"
    export CATALINA_TMPDIR="$CATALINA_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
    bash $CATALINA_HOME/bin/shutdown.sh "$@"
    ----------------------------------------------------------------
    创建测试页
    # mkdir -p /usr/local/tomcat_instance/{tomcat1,tomcat2}/webapps/ROOT
    编辑文件
     vim /usr/local/tomcat_instance/tomcat1/webapps/ROOT/index.jsp
    <html>
    <title>Tomcat-1</title>
    <body>
        Hello This is Tomcat-1.
    </body>
    </html>
    启动tomcat实例
     /usr/local/tomcat_instance/tomcat1/bin/startup.sh
    查看监听端口
    netstat -lnpt  | grep java
     
     
     
  • 相关阅读:
    GSM和GPRS的区别
    IP规划和VLSM子网划分例题
    20190806-sed面试题
    yum.rpm一点点
    实验:基于http的yum源
    vim编辑二进制文件
    关于find的-perm
    误删tree命令如何恢复
    删除Linux的依赖库并进入救援模式恢复
    第六天、用户、组、权限、grep
  • 原文地址:https://www.cnblogs.com/123456likun/p/11566911.html
Copyright © 2011-2022 走看看