在openEuler平台部署特定版本的PostgreSql在安装包收集上存在较大难题,本次需求为制作zabbix系统所需的timescaledbV2插件的PostgreSqlV14.5数据库,在评估多种方案后,采用了基于CentOS底包制作容器方式来实现
一、提前准备事宜
在正式部署前,请提前完成以下事宜:
-
收集centos底包
笔者下载的是centos:latest版本镜像底包,实际版本为CentOS8.3.2011,对应保存为名为“centos8.3.2011.tar ”的文件,其他CentOS8系版本也可以的。
-
收集centos8运行环境下PostgreSqlV14.5及其时序数据库插件
经现网生产系统测试,以下版本zabbix运行良好,且具备平台从Mysql移植数据至PostgreSql库的能力:
postgresql14-14.5-1PGDG.rhel8.x86_64.rpm
postgresql14-libs-14.5-1PGDG.rhel8.x86_64.rpm
postgresql14-server-14.5-1PGDG.rhel8.x86_64.rpm
timescaledb-2-postgresql-14-2.7.0-0.el8.x86_64.rpm
timescaledb-tools-0.14.1-0.el8.x86_64.rpm
timescaledb-2-loader-postgresql-14-2.7.0-0.el8.x86_64.rpm
以上rpm包打包为名为“postgresql14.5el8rpm.tgz”的文件。
-
将容器底包和rpm文件包上传至内网服务器。
二、基于容器底包进行指定版本数据库程序的安装
-
将容器底包载入
# docker load -i centos8.3.2011.tar
Loaded image: quay.io/centos/centos:latest
[root@localhost dockerfile]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
quay.io/centos/centos latest 300e315adb2f 2 years ago 209MBdock
-
启动容器
#docker run --privileged -itd --name pgtsdb quay.io/centos/centos:latest /sbin/init
1597f853e87b7e37e1472a839f2b7ff0289c4b6a3ab097ac525d3fcc048573aa
-
将rpm包传入容器(本步骤没有反馈信息)
# docker cp /tmp/postgresql14.5el8rpm.tgz pgtsdb:/tmp
-
进入容器安装数据库及插件的rpm包
# docker exec -it pgtsdb /bin/bash
[root@1597f853e87b /]# cd /opt
[root@1597f853e87b opt]# mv /tmp/postgresql14.5el8rpm.tgz .
[root@1597f853e87b opt]# mkdir postgresql14ts-rpm
[root@1597f853e87b opt]# tar -xzvf postgresql14.5el8rpm.tgz
postgresql14-14.5-1PGDG.rhel8.x86_64.rpm
postgresql14-libs-14.5-1PGDG.rhel8.x86_64.rpm
postgresql14-server-14.5-1PGDG.rhel8.x86_64.rpm
timescaledb-2-postgresql-14-2.7.0-0.el8.x86_64.rpm
timescaledb-tools-0.14.1-0.el8.x86_64.rpm
timescaledb-2-loader-postgresql-14-2.7.0-0.el8.x86_64.rpm
[root@1597f853e87b opt]# mv *.rpm postgresql14ts-rpm/
[root@1597f853e87b opt]# cd postgresql14ts-rpm/
[root@1597f853e87b postgresql14ts-rpm]# ls
postgresql14-14.5-1PGDG.rhel8.x86_64.rpm timescaledb-2-loader-postgresql-14-2.7.0-0.el8.x86_64.rpm
postgresql14-libs-14.5-1PGDG.rhel8.x86_64.rpm timescaledb-2-postgresql-14-2.7.0-0.el8.x86_64.rpm
postgresql14-server-14.5-1PGDG.rhel8.x86_64.rpm timescaledb-tools-0.14.1-0.el8.x86_64.rpm
[root@1597f853e87b opt]# yum install glibc-common glibc-langpack-en -y
Failed to set locale, defaulting to C.UTF-8
Waiting for process with pid 125 to finish.
os 160 MB/s | 6.8 MB 00:00
baseos 168 MB/s | 2.2 MB 00:00
Package glibc-common-2.28-127.el8.x86_64 is already installed.
Dependencies resolved.
====================================================================================