内容纲要
概要描述
TDH目前暂时不支持从界面或通过脚本安装Hotfix,需要手动安装Hotfix.
本文介绍TDH 5.x及以上版本如何手动的换包。
示例说明:
举例介绍TDH 5.1.0如何更换Inceptor Server的 /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar 包文件。
Hotfix(包文件)信息说明:[Hotfix] TDH 5.1 更换正式版License后Inceptor无法启动,提示License过期
详细说明
复制Hotfix(新的包文件)到容器
- 将Hotfix(新的包文件)复制到需要换包的组件对应的节点服务器 /tmp 目录,并确认Hotfix文件正确无误;
可以参照KB:如何进入某一组件的Docker容器 确定对应的节点服务器;[root@bryan1 /]# md5sum /tmp/msl-1.0-transwarp-5.1.0.jar b41f184355a14b6b486783daeb73abcc /tmp/msl-1.0-transwarp-5.1.0.jar //通过MD5值确认Hotfix包文件正确无误。
- 获取组件对应的容器ID(需要在安装了该服务角色的节点执行),例如:
[root@bryan1 /]# docker ps |grep inceptor-server |grep transwarp/inceptor a09261efc857 bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final "boot.sh INCEPTOR_SER" 54 minutes ago Up 54 minutes k8s_inceptor-server-inceptor1.76bd8f55_inceptor-server-inceptor1-924451460-7ms4h_default_ce0e8593-c8d9-11e9-9899-000c29b8d7a8_17dea196 //a09261efc857即为Inceptor Server的容器ID.
- 将Hotfix(新的包文件)复制到该容器的/tmp目录下,例如:
[root@bryan1 /]# docker cp /tmp/msl-1.0-transwarp-5.1.0.jar a09261efc857:/tmp/ //将Hotfix文件复制到Inceptor Server容器a09261efc857 /tmp 目录下
进入容器,更换包文件
- 进入该容器,例如:
[root@bryan1 /]# docker exec -it a09261efc857 bash [root@bryan1 ~]# //进入Inceptor Server容器
- 确认原始包文件符合安装Hotfix的系统需求,例如:
[root@bryan1 ~]# md5sum /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar 7c45405132d7f2601c84d8db2b7776d6 /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar //原始包符合条件,则进行下一步换包操作,否则请勿进行换包操作。
- 备份原始包到 /tmp 目录下(请勿将其备份到原始目录),例如:
[root@bryan1 ~]# cp /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar /tmp/msl-1.0-transwarp-5.1.0.jar_Original_Backup
- 将Hotfix(新的包文件)复制到原始包所在目录,覆盖原始包,例如:
[root@bryan1 ~]# cp /tmp/msl-1.0-transwarp-5.1.0.jar /usr/lib/inceptor/lib/ cp: overwrite ‘/usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar’? y //将原始包替换为新包。 [root@bryan1 ~]# md5sum /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar b41f184355a14b6b486783daeb73abcc /usr/lib/inceptor/lib/msl-1.0-transwarp-5.1.0.jar //确认替换成功,MD5值为Hotfix(新的包文件)的MD5值。
生成新的镜像
- 运行 exit 命令,退出容器,例如:
[root@bryan1 ~]# exit [root@bryan1 /]# //退出容器,退回到组件节点服务器;
- 用 docker images 命令查看组件对应的镜像的信息,例如:
[root@bryan1 /]# docker images |grep inceptor bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 9c45a1d53459 21 months ago 3.512 GB //Inceptor的镜像ID为 9c45a1d53459
- 使用 docker tag Image_ID REPOSITORY:TAG_Original_Backup 命令备份组件对应的镜像,例如
[root@bryan1 /]# docker tag 9c45a1d53459 bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final_Original_Backup //备份了一个TAG为transwarp-5.1.0-final_Original_Backup的镜像 [root@bryan1 /]# docker images |grep inceptor bryan1:5000/transwarp/inceptor transwarp-5.1.0-final_Original_Backup 9c45a1d53459 21 months ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 9c45a1d53459 21 months ago 3.512 GB //备份成功,有一个tag为 transwarp-5.1.0-final_Original_Backup 的备份镜像。
- 使用 docker commit 容器ID REPOSITORY:TAG命令提交镜像,例如:
[root@bryan1 /]# docker commit a09261efc857 bryan1:5000/transwarp/inceptor:transwarp-5.0-1.0-final sha256:4ea9559090f16d3402ba8bb1cb4a14f566f6c791709aa42fceb8fbc776279964 //提交了Inceptor Server容器a09261efc857的镜像
- 使用 docker images 命令确认组件新的镜像信息(新的Image ID),例如:
[root@bryan1 /]# docker images |grep inceptor bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 4ea9559090f1 48 seconds ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final_Original_Backup 9c45a1d53459 21 months ago 3.512 GB //生成了新的Inceptor镜像4ea9559090f1
Push镜像,换包完成
- 将新的组件镜像push到镜像仓库
命令:docker push REPOSITORY:TAG,例如:[root@bryan1 /]# docker push bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final The push refers to a repository [bryan1:5000/transwarp/inceptor] 95b5a7edb5a4: Preparing bb99e99f2cdd: Preparing 8f994ef6847d: Preparing 74c43e6061d7: Preparing 3274fc847175: Preparing 78fa2cdc2fca: Waiting 75e708b1de03: Waiting 28258159259b: Waiting eb1cc39305cc: Waiting 0ff6a1325f25: Waiting e2c6e2f04832: Waiting c9f2d8d6037f: Waiting 41cd12a9a717: Waiting 95b5a7edb5a4: Pushed 37845adbd008: Layer already exists 5f7b1013d89a: Layer already exists d8d620528fc5: Layer already exists 1714e6432a39: Layer already exists 5be7e5d8f620: Layer already exists 4546c7dcd531: Layer already exists 439abe4014aa: Layer already exists 470c3895c513: Layer already exists db1987186194: Layer already exists b6cfbb96330d: Layer already exists c0bc9f32a351: Layer already exists ce674294670f: Layer already exists 6bb08e58cbff: Layer already exists c5fb7af12e05: Layer already exists 7df81fd39299: Layer already exists 5f8fb442b307: Layer already exists 556318bf633b: Layer already exists 1138eeed60e5: Layer already exists 2a3ea38df0b1: Layer already exists e2118f1384a5: Layer already exists 22e8ec4db88e: Layer already exists 5f70bf18a086: Layer already exists 474639f8816c: Layer already exists 224dddf9c58a: Layer already exists 9cc71f240607: Layer already exists f41fe5c216da: Layer already exists 67a76a9f1bb7: Layer already exists d1834207b9bc: Layer already exists 8094bb354c2d: Layer already exists 1c975c1d69c2: Layer already exists 63f4980adde9: Layer already exists 6915b674a1d9: Layer already exists 02acef6a1434: Layer already exists 09c025892559: Layer already exists 04edc4f75029: Layer already exists 4f87223796ba: Layer already exists 87a0658287da: Layer already exists 1d2a0a103b14: Layer already exists 563c51d4d2d3: Layer already exists 3571f6772e41: Layer already exists f64116beaa4b: Layer already exists transwarp-5.1.0-final: digest: sha256:944599ff06cbf25672f29a56c9d3927bb0d652b99ba7c0229e251dc1d5ed33a3 size: 14281
- 在Manager页面,重启换包组件的服务
- 换包完成,查看换包后功能是否正常。
Hotfix回滚步骤
若换上新包后,出现了不可预知的新的问题,可以参照如下步骤进行回滚。
- 将上述步骤生成的组件的新的镜像tag为failed,例如:
[root@bryan1 /]# docker images |grep inceptor bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 4ea9559090f1 5 minutes ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final_Original_Backup 9c45a1d53459 21 months ago 3.512 GB //查看Docker 镜像 [root@bryan1 /]# docker tag 4ea9559090f1 bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final.failed //将之前生成的新的镜像4ea9559090f1标记为transwarp-5.1.0-final.failed [root@bryan1 /]# docker images |grep inceptor bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 4ea9559090f1 8 minutes ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final.failed 4ea9559090f1 8 minutes ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final_Original_Backup 9c45a1d53459 21 months ago 3.512 GB //标记成功
- 将之前备份的原始镜像tag为final镜像,例如:
[root@bryan1 /]# docker tag 9c45a1d53459 bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final //将transwarp-5.1.0-final_Original_Backu重新tag为transwarp-5.1.0-final [root@bryan1 /]# docker images bryan1:5000/transwarp/inceptor transwarp-5.1.0-final.failed 4ea9559090f1 11 minutes ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final_Original_Backup 9c45a1d53459 21 months ago 3.512 GB bryan1:5000/transwarp/inceptor transwarp-5.1.0-final 9c45a1d53459 21 months ago 3.512 GB //此时final镜像恢复为9c45a1d53459镜像
- 将final镜像push到镜像仓库,例如:
[root@bryan1 /]# docker push bryan1:5000/transwarp/inceptor:transwarp-5.1.0-final
- 在Manager页面,重启换包组件的服务;
- 查看组件功能,确认已经恢复到换包前的状态。