适用版本
OAT V3.2 以前版本。
问题现象
对于目前 OAT 的升级,比较简单,停止 OAT,然后直接删除旧的 OAT docker,旧的 OAT 本地挂在目录的数据不要删除,然后挂同样的目录启动新的 OAT 即可。
当升级 OAT 后,进入 OAT docker 容器,查看 Antman 目录(/oat/task_engine/shells/Antman)下的配置信息,发现 obcluster.config 和软连接等信息都丢失。
问题原因
原来部署的 Antman 的相关文件未被持久化,其配置信息只保存在 MySQL 数据库里,因此升级后重新安装的 OAT 仅仅是初始文件,丢失了原有 Antman 目录下的相关配置信息。
解决方法
进入 OAT docker,通过 python 命令执行 manage.py 脚本来从 MySQL 数据库中进行配置文件的还原。
步骤如下:
登录 OAT docker。
[root@xxx oat]# docker exec -it oat bash [root@98xxxxxxxxxx oat]# ls antman hardware_monitor LEGAL.md manage.py oat oceanbase_log_analyzer Pipfile requirements.txt static_root task_engine distribution init_database_data.sh locale mime.types oceanbase oraclient Pipfile.lock static syclient使用 python 修改。
[root@98xxxxxxxxx oat]# python3 manage.py shell Python 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from task_engine.plugins.utils import generate_upper_conf_file >>> from antman.models import Product >>> cid=Product.objects.get(name='ocp').config.id >>> generate_upper_conf_file(cid) [2022-09-27 14:47:29,806] {base.py:78} INFO - Using connection to: id: antman. Host: 127.x.x.x, Port: 3306, Schema: antman, Login: root, Password: MsF_DjxA2N3, extra: {'charset': 'utf8', 'cursor': 'DictCursor'} [2022-09-27 14:47:29,826] {base.py:78} INFO - Using connection to: id: antman. Host: 127.x.x.x, Port: 3306, Schema: antman, Login: root, Password: MsF_DjxA2N3, extra: {'charset': 'utf8', 'cursor': 'DictCursor'} >>> >>> >>> exit() [root@98xxxxxxxx oat]#