add
This commit is contained in:
43
998-常用脚本/重启服务器恢复/1-重启脚本.sh
Normal file
43
998-常用脚本/重启服务器恢复/1-重启脚本.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
install_prefix=/root/wdd/install
|
||||
|
||||
echo "运行前确保所有虚拟机都已经启动,IP网卡正常可互通"
|
||||
|
||||
#重启镜像服务
|
||||
echo "恢复镜像服务"
|
||||
docker-compose -f /root/wdd/harbor/docker-compose.yml up -d
|
||||
echo "等待10s"
|
||||
sleep 10s
|
||||
|
||||
# 关停所有的后端服务
|
||||
kubectl --kubeconfig /root/.kube/config delete -f ${install_prefix}/k8s-mysql.yaml
|
||||
kubectl --kubeconfig /root/.kube/config delete -f ${install_prefix}/k8s-nacos.yaml
|
||||
kubectl --kubeconfig /root/.kube/config delete -f ${install_prefix}/k8s-backend.yaml
|
||||
|
||||
echo "重启本机nginx服务"
|
||||
systemctl stop nginx && sleep 3 && systemctl start nginx
|
||||
docker-compose -f ${install_prefix}/nginx-docker-compose.yaml up -d
|
||||
|
||||
echo "等待10s 开始启动全部的服务"
|
||||
kubectl --kubeconfig /root/.kube/config apply -f ${install_prefix}/k8s-mysql.yaml
|
||||
echo "等待360s, 等待mysql启动!"
|
||||
sleep 360s
|
||||
kubectl --kubeconfig /root/.kube/config apply -f ${install_prefix}/k8s-nacos.yaml
|
||||
sleep 30s
|
||||
echo "等待30s,等待nacos启动!"
|
||||
|
||||
|
||||
kubectl --kubeconfig /root/.kube/config apply -f ${install_prefix}/k8s-backend.yaml
|
||||
echo "等待 10min"
|
||||
sleep 10m
|
||||
|
||||
kubectl --kubeconfig /root/.kube/config -n bjtg get pods | grep Off | awk '{print$1}' | xargs kubectl --kubeconfig /root/.kube/config -n bjtg delete pod
|
||||
|
||||
echo "等待2分钟,确保服务都完全启动"
|
||||
sleep 2m
|
||||
|
||||
kubectl --kubeconfig /root/.kube/config get pods -A
|
||||
|
||||
echo "确认上文输出都是running"
|
||||
echo "可登录平台进行验证"
|
||||
12
998-常用脚本/重启服务器恢复/1.1-minio-重启脚本.sh
Normal file
12
998-常用脚本/重启服务器恢复/1.1-minio-重启脚本.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
echo "运行前确保所有虚拟机都已经启动,IP网卡正常可互通"
|
||||
|
||||
#重启镜像服务
|
||||
echo "恢复MINIO服务"
|
||||
docker-compose -f /root/wdd/minio-docker-compose.yaml up -d
|
||||
|
||||
if docker ps | grep -q wdd-minio1-1; then
|
||||
echo "minio restart success !"
|
||||
else
|
||||
echo "minio restart failed !"
|
||||
fi
|
||||
11
998-常用脚本/重启服务器恢复/2-restore_from_reboot.service
Normal file
11
998-常用脚本/重启服务器恢复/2-restore_from_reboot.service
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Restore CMII after Reboot
|
||||
|
||||
[Service]
|
||||
ExecStart=/root/wdd/reboot/restore_from_reboot.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
# /etc/systemd/system/restore_from_reboot.service
|
||||
15
998-常用脚本/重启服务器恢复/3-restore_from_reboot.timer
Normal file
15
998-常用脚本/重启服务器恢复/3-restore_from_reboot.timer
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Run restore_from_reboot 10s after boot
|
||||
|
||||
[Timer]
|
||||
OnBootSec=10
|
||||
Unit=restore_from_reboot.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
# /etc/systemd/system/restore_from_reboot.timer
|
||||
# sudo systemctl daemon-reload
|
||||
sudo systemctl enable restore_from_reboot.timer
|
||||
journalctl -u restore_from_reboot -n 150 -f
|
||||
Reference in New Issue
Block a user