openGauss container installation
Tags: opengauss
Published: 2023-03-28 03:30:12

container installation
This chapter mainly introduces the installation of openGauss through Docker to facilitate the installation, configuration and environment settings of DevOps users.

Supported Architectures and OS Versions
x86-64 CentOS 7.6

ARM64 openEuler 20.03 LTS

configuration preparation
Build the docker image using the buildDockerImage.sh script, which is a handy shell script that provides SHA256 checks.

Create openGauss docker image
illustrate:

Before installation, you need to provide the openGauss binary installation package. After decompression, put the package ending in bz2 (openGauss-XXX-CentOS-64bit.tar.bz2) into the dockerfiles/<version> folder. The binary package can be downloaded from  https://www.opengauss.org/zh/download/ , make sure you have the correct yum source.

When running the buildDockerImage.sh script, if the -i parameter is not specified, the SHA256 check is provided by default, and you need to manually write the check result to the sha256_file_amd64 file.

## 修改sha256校验文件内容
cd /soft/openGauss-server/docker/dockerfiles/3.0.0
sha256sum openGauss-3.0.0-CentOS-64bit.tar.bz2 > sha256_file_amd64 
Before installation, you need to obtain the openEuler_aarch64.repo file from the Huawei open source image site, and put it in the openGauss-server-master/docker/dockerfiles/3.0.0 folder. openEuler_aarch64.repo acquisition method:
wget -O openEuler_aarch64.repo https://mirrors.huaweicloud.com/repository/conf/openeuler_aarch64.repo
Run the buildDockerImage.sh script in the dockerfiles folder.

[root@ecs-complie dockerfiles]# ./buildDockerImage.sh
Usage: buildDockerImage.sh -v [version] [-i] [Docker build option]
Builds a Docker Image for openGauss
Parameters:
   -v: version to build
       Choose one of: 3.0.0
   -i: ignores the SHA256 checksums

LICENSE UPL 1.0
environment variable
In order to use the openGauss image more flexibly, additional parameters can be set. In the future, we will expand more controllable parameters. The current version supports the setting of the following variables.

GS_PASSWORD

When using the openGauss image, this parameter must be set. The parameter value cannot be empty or undefined. This parameter sets the passwords of the super user omm of the openGauss database and the test user gaussdb. The omm super user is created by default when openGauss is installed, and this user name cannot be modified temporarily. The test user gaussdb is a user created in entrypoint.sh.

The openGauss image is configured with a local trust mechanism, so no password is required to connect to the database in the container, but if you want to connect from outside the container (other hosts or other containers), you must enter a password.

The password of openGauss has complexity requirements

The password must be more than 8 characters long and must contain both uppercase letters, lowercase letters, numbers, and special symbols (special symbols only include "#?!@$%^&*-", and "!$&" needs to be escaped "\" to escape).

GS_NODENAME

Specify the database node name, the default is gaussdb.

GS_USERNAME

Specify the database connection user name, the default is gaussdb.

GS_PORT

Specify the database port, the default is 5432.

start instance
$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=Enmo@123 opengauss:2.0.0
Connect to the database from the operating system level
$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=Enmo@123 -p8888:5432 opengauss:2.0.0
$ gsql -d postgres -U gaussdb -W'Enmo@123' -h your-host-ip -p8888
data persistence
$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=Enmo@123 -v /opengauss:/var/lib/opengauss opengauss:2.0.0
illustrate

For building container images using databases of other versions, you can refer to openGauss-server/docker/dockerfiles/3.0.0the configuration file inside, and only need to modify it to the corresponding version number.

For the container image for building openEuler-arm, if openeuler-20.03-lts:latestthe image cannot be downloaded, you can http://121.36.97.194/openEuler-20.03-LTS/docker_img/aarch64/download the compressed container image package from the openEuler official website openEuler-docker.aarch64.tar.xz, and then use docker load -i openEuler-docker.aarch64.tar.xzit to import it to the local image list.

docker buildWhen building, if you encounter a yum source download timeout, please check the agent, or you can add --network hostthe network of the host machine after the command in the buildDockerImage.sh script .