docker+容器+redis+minio+java jar,实现开机自启动
一、docker
systemctl enable docker.service
二、容器
加参数:--restart=always
如果容器已存在,修改容器:
docker update --restart=always 容器ID(或者容器名)
三、redis
1.注册服务
vi /etc/systemd/system/redis.service
2.服务配置文件
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/redis-5.0.7/src/redis-server /usr/local/redis/redis-5.0.7/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3.服务自启动
systemctl enable redis
四、minio
1.minio配置文件,配置用户名和密码
vi /home/minio/conf/minio.conf
输入内容:
MINIO_ACCESS_KEY="minioadmin"
MINIO_SECRET_KEY="Aa123456@admin"
2.注册服务
vi /etc/systemd/system/minio.service
3.服务配置文件
[Unit]
Description=Minio
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
[Service]
# User and group
User=root
Group=root
EnvironmentFile=/home/minio/conf/minio.conf
ExecStart=/usr/local/soft/minio server --address :9000 --console-address :9090 /home/minio/data
ExecReload=/bin/kill -HUP $MAINPID
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
TimeoutStopSec=5
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
4.服务自启动
systemctl enable minio
五、java jar
1.注册服务
vi /etc/systemd/system/exam.service
2.服务配置文件:
[Unit]
Description=exam
After=network.target
[Service]
User=root
Type=simple
ExecStart=/usr/local/java/jdk1.8.0_341/bin/java -jar /home/app/exam/backend/exam.jar
Restart=on-failure
[Install]
WantedBy=multi-user.target
3.服务自启动
systemctl enable exam
原文地址:https://blog.csdn.net/xiaoxiangzi520/article/details/144023373
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!