Server Deployment - Apache Tomcat 5.5/6/7

Server Deployment - Apache Tomcat 5.5/6/7

These days, I tried very hard to start and maintain multi tomcats on one linux server.

Download the tomcat zip files from the official website
1. The shell script for starting up tomcat start-tomcat1.sh:
#!/bin/sh

CATALINA_HOME="/home/luohua/tools/shellscript/apache-tomcat-5.5.33"
#CATALINA_HOME="/home/luohua/tools/shellscript/apache-tomcat-7.0.12"
CATALINA_BASE="tomcat1"
export CATALINA_HOME CATALINA_BASE

mkdir -p "${CATALINA_BASE}/logs" "${CATALINA_BASE}/temp"

exec "${CATALINA_HOME}/bin/catalina.sh" run

2. Configuration file in tomcat1 directory:
tomcat1/conf/server.xml(for tomcat5.5):
<Server port="9081" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8083" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="." debug="100"
unpackWARs="false" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false"/>
</Engine>
</Service>
</Server>

tomcat3/conf/server.xml(for tomcat7):
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8085" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="."
unpackWARs="false" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>

tomcat3/conf/*, other configuration file in this directory are copied from the original directory.

3. war package configuration
tomcat1/conf/Catalina/localhost/easymarket.xml:
<Context path="/easymarket" docBase="/home/luohua/tools/shellscript/apps/easymarket.war"
debug="0" privileged="true">
</Context>

4. properties file configuration
I put these properties files in tomcat directory
for tomcat5.5, apache-tomcat-5.5.33/common/classes
for tomcat5.0.12, apache-tomcat-7.0.12/lib

references:
http://hi.baidu.com/luohuazju/blog/item/907cb9348c3bd23d5bb5f59a.html
http://hi.baidu.com/luohuazju/blog/item/0b1cb1a4d9f1d8f19152ee54.html
http://hi.baidu.com/luohuazju/blog/item/0740fc228bb58aa24723e839.html
好的,以下是一个完整的 Kubernetes YAML 文件示例,用于在 Kubernetes 中部署 Hyperf 应用: ```yaml # 定义一个 Kubernetes 的 Deployment apiVersion: apps/v1 kind: Deployment metadata: name: hyperf-deployment labels: app: hyperf spec: replicas: 3 selector: matchLabels: app: hyperf template: metadata: labels: app: hyperf spec: containers: - name: hyperf image: hyperf/hyperf:7.4-alpine-v3.11-swoole command: [ "sh", "-c", "php /hyperf-skeleton/bin/hyperf.php start" ] ports: - containerPort: 9501 volumeMounts: - name: hyperf-volume mountPath: /hyperf-skeleton volumes: - name: hyperf-volume hostPath: path: /mnt/hgfs/www/hyperf/ # 定义一个 Kubernetes 的 Service --- apiVersion: v1 kind: Service metadata: name: hyperf-service spec: selector: app: hyperf ports: - protocol: TCP port: 9501 targetPort: 9501 type: ClusterIP ``` 这个 YAML 文件定义了一个 Kubernetes 的 Deployment 和一个 Service。在 Deployment 中,我们定义了一个使用 Hyperf 容器镜像的 Pod 模板,使用 `volumeMounts` 字段将宿主机上 Hyperf 应用所在的目录 `/mnt/hgfs/www/hyperf/` 挂载到容器的 `/hyperf-skeleton` 目录下,并使用 `command` 字段指定容器启动 Hyperf 应用的命令 `php /hyperf-skeleton/bin/hyperf.php start`,使用 `ports` 字段将容器的 9501 端口暴露出来。在 Service 中,我们定义了一个 ClusterIP 类型的 Service,将容器的 9501 端口映射到 Kubernetes 集群内部的端口上,以便其他 Pod 可以通过 Service 访问 Hyperf 应用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值