# centos7安装Zipkin并设置开机启动

# Zipkin下载地址

# zipkin启动脚本

vim /opt/software/zipkin_start.sh

#!/bin/sh

export JAVA_HOME=/usr/java/default
export JRE_HOME=$JAVA_HOME/jre 
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib 
export PATH=$PATH:$JAVA_HOME/bin

nohup java -jar /opt/software/zipkin-server-2.23.19-exec.jar --STORAGE_TYPE=mysql --MYSQL_HOST=192.168.216.22 --MYSQL_TCP_PORT=3306 --MYSQL_DB=zipkin --MYSQL_USER=root --MYSQL_PASS=tiankafei >/opt/software/zipkin.log 2>&1 &

echo $! > /var/run/zipkin.pid

# zipkin停止脚本

vim /opt/software/zipkin_stop.sh

PID=$(cat /var/run/zipkin.pid)

kill -9 $PID

# Zipkin脚本增加可执行权限

chmod +x /opt/software/zipkin_start.sh
chmod +x /opt/software/zipkin_stop.sh

# Zipkin开机启动脚本

vim /usr/lib/systemd/system/zipkin.service

#!/bin/sh
[Unit]
Description=zipkin-service
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/opt/software/zipkin_start.sh
ExecStop=/opt/software/zipkin_stop.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

# Zipkin开启启动

# 重新加载service的配置
systemctl daemon-reload
# 设置开机启动
systemctl enable zipkin.service
# 启动nacos
systemctl start zipkin.service
# 重启nacos
systemctl restart zipkin.service
# 停止nacos
systemctl stop zipkin.service
# 查看nacos状态
systemctl status zipkin.service
Last Updated: 11/29/2022, 4:14:10 AM