安裝完成後配置檔案在
/opt/jumpserver/config/config.txt
記錄 SECRET_KEY 和 BOOTSTRAP_TOKEN
# cat /opt/jumpserver/config/config.txt | egrep "SECRET_KEY|BOOTSTRAP_TOKEN"
遷移請修改 SECRET_KEY 和 BOOTSTRAP_TOKEN 為原來的設定
SECRET_KEY=RUMyMjFENUMtNTA3OC04QTY5LUVBQkMtODQyRDE2MjI1QUIw
BOOTSTRAP_TOKEN=RUMyMjFENUMtNTA3OC04QTY5
RUMyMjFENUMtNTA3OC04QTY5
DB_PASSWORD=ZWMyZDhmODctYjNjZi1iNTk5LW
./opt/jumpserver-installer-v2.16.0/jmsctl.sh backup_db
備份jumpserver資料
cd opt/jumpserver-installer-v2.16.0
./jmsctl.sh backup_db
Backing up...
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[SUCCESS] Backup succeeded! The backup file has been saved to: /opt/jumpserver/db_backup/jumpserver-v2.16.0-2021-12-20_16:24:43.sql
檢視備份資料
ll /opt/jumpserver/db_backup/
-rw-r--r-- 1 root root 35386634 Dec 20 16:24 jumpserver-v2.16.0-2021-12-20_16:24:43.sql
還原資料操作
關閉服務
cd /opt/jumpserver-installer-v2.16.3
./jmsctl.sh stop
docker exec -it jms_mysql /bin/bash
# arm64 請使用 $MARIADB_ROOT_PASSWORD
mysql -uroot -p$MYSQL_ROOT_PASSWORD
drop database jumpserver;
create database jumpserver default charset 'utf8';
exit
exit
将備份資料複制到還原目錄下
cp /home/ubuntu/jumpserver-v2.16.0-2021-12-20_17_54_05.sql /opt/jumpserver/config/backup/
開始恢複資料
./jmsctl.sh restore_db /opt/jumpserver/config/backup/jumpserver-v2.16.0-2021-12-20_17_54_05.sql
Start restoring database: /opt/jumpserver/config/backup/jumpserver-v2.16.0-2022-03-17.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[SUCCESS] Database recovered successfully
重新開機服務
./jmsctl.sh restart
mkdir -p /opt/jumpserver/core/
mv /opt/jumpserver_bak/data /opt/jumpserver/core/