迁移前:jumpserver/jms_all:2.0.2
迁移后:jumpserver v2.7.1
迁移前准备
备份原数据
# 查看容器ID
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a31721dcf8d jumpserver/jms_all:2.0.2 "./entrypoint.sh /bi…" About an hour ago Up About an hour 80/tcp, 2222/tcp jumpserver
# 进入容器
docker exec -it jms_all /bin/bash
# 备份jumpserver表
$ mysqldump --databases jumpserver >/opt/jumpserver.sql
导出数据
# 复制sql文件到服务器
$ sudo docker cp 1a31721dcf8d:/opt/jumpserver.sql /opt/jumpserver.sql
# 复制jumpserver目录到服务器
$ sudo docker cp 1a31721dcf8d:/opt/jumpserver /opt/jumpserver
搭建DB&Redis服务
外置环境要求
- Redis >= 5.0.0
- MySQL >= 5.7
- MariaDB >= 10.2
- 推荐使用外置 数据库 和 Redis, 方便日后扩展升级
安装MariaDB
DB服务器IP:192.168.100.2
# 检查一下是否存在以前的安装包
$ yum list installed | grep mariadb
mariadb-libs.x86_64 1:5.5.68-1.el7 @base
# 卸载
$ yum remove mariadb-libs
# 添加Maria源
$ vim /etc/yum.repos.d/mariadb.repo
# 添加以下信息
[mariadb]
name = MariaDB
baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.5/centos7-amd64/
gpgkey = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
# 清除并重建yum缓存
$ yum clean all
$ yum makecache
# 查看yum源里可用的安装包
$ yum list | grep mariadb
MariaDB-client.x86_64 10.5.8-1.el7.centos mariadb
MariaDB-client-debuginfo.x86_64 10.5.8-1.el7.centos mariadb
MariaDB