zoukankan      html  css  js  c++  java
  • tomcat多实例的部署

    解压部署tomcat程序
    创建2个实例的工作目录
    mkdir -p /usr/local/tomcat8_instance/tomcat1
    mkdir -p /usr/local/tomcat8_instance/tomcat2

    拷贝tomcat 程序目录下的conf分别放入2个实例目录中
    cp -R /usr/local/tomcat8/conf /usr/local/tomcat8_instance/tomcat1
    cp -R /usr/local/tomcat8/conf/ /usr/local/tomcat8_instance/tomcat2
    mkdir /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin
    touch /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin/statup.sh
    chmod +x /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin/startup.sh

    在tomcat实例目录下的bin目录中创建实例启动和停止脚本
    vim /usr/local/tomcat8_instance/tomcat1/bin/startup.sh
    #!/bin/bash
    export CATALINA_HOME="/usr/local/tomcat8"
    export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
    export CATALINA_TMPDIR="$CATALINX_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 "$@"


    vim /usr/local/tomcat8_instance/tomcat2/bin/startup.sh
    #!/bin/bash
    export CATALINA_HOME="/usr/local/tomcat8"
    export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat2"
    export CATALINA_TMPDIR="$CATALINX_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
    export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat2"
    #创建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 "$@"


    [root@localhost ~]# touch /usr/local/tomcat8_instance/{tomcat1,tomcat2}/bin/shutdown.sh
    [root@localhost ~]# chmod +x /usr/local/tomcat8_instance/{tomcat1,tomcat2}/bin/shutdown.sh
    [root@localhost ~]# vim /usr/local/tomcat8_instance/tomcat1/bin/shutdown.sh
    #!/bin/bash
    export CATALINA_HOME="/usr/local/tomcat8"
    export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
    export CATALINA_TMPDIR="$CATALINX_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"

    bash $CATALINA_HOME/bin/shutdown.sh "$@"


    [root@localhost ~]# vim /usr/local/tomcat8_instance/tomcat2/bin/shutdown.sh
    #!/bin/bash
    export CATALINA_HOME="/usr/local/tomcat8"
    export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
    export CATALINA_TMPDIR="$CATALINX_BASE/temp"
    export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"

    bash $CATALINA_HOME/bin/shutdown.sh "$@"

    修改实例中配置文件端口,详细文档中的
    创建测试页

    vim /usr/local/tomcat8_instance/tomcat1/webapps/ROOT/index.jsp

    <html>
    <title>Tomcat-1</title>
    <body>
            THIS IS TOMCAT1
    </body>
    </html>
    vim /usr/local/tomcat8_instance/tomcat2/webapps/ROOT/index.jsp
    <html>
    <title>This-TOMCAT2</title>
    <body>
            this is tomcat2
    </body>
    </html>
    访问http://192.168.30.21:8080
    192.168.30.21:8090

  • 相关阅读:
    阿里面试后的问题总结
    Spring IOC源码实现流程
    Spring Aop源码分析
    SpringCloud的分布式配置及消息总线
    阿里java编码规范考试总结
    压缩文件的压缩时候中文乱码码
    mybatis的时间比较 xml 及不解析<=的写法
    批量插入一张表的数据,并且生成不同的uuid 字符截取 批量更新 去除重复数据
    Redis集群的搭建
    Python 之 基础知识(二)
  • 原文地址:https://www.cnblogs.com/zc1741845455/p/10921277.html
Copyright © 2011-2022 走看看