Install Docker and Image Repository

Before deploying the PolarDB-X database via PXD or Kubernetes methods, it is essential to first install the Docker container environment. If you plan to deploy PolarDB-X on an independent server cluster, we recommend setting up a private Docker registry on one of the servers, typically the operations server (referred to as the 'ops' machine).

Install Docker

Docker Community Edition version 19.03 or later must be installed.

We suggest installing Docker from Alibaba Cloud's software repository, or you can opt for the repository available on the Docker website: https://download.docker.com/linux/centos/docker-ce.repo For the installation process, please consult the following documentation: Install Docker Engine.

Set up the Yum Package Repository

Download the Docker repository configuration file from the Alibaba Cloud mirror site using the following link and command:

wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O $HOME/docker-ce.repo

If the deployment is on an Alibaba Cloud ECS server without internet access, replace the URL https://mirrors.aliyun.com with http://mirrors.cloud.aliyuncs.com. If internet access is available, retain the original content of the file as is:

sed -i 's/https:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' $HOME/docker-ce.repo

Copy the configuration file to all servers using the following command:

ansible -i ${ini_file} all -m synchronize -a " src=$HOME/docker-ce.repo dest=/etc/yum.repos.d/ " -u root

Directory Mapping

The /var/lib/docker directory holds image files which demand substantial disk space. It is advisable to symlink this directory to a data drive for expanded storage capacity:

ansible -i ${ini_file} all -m shell -a " mkdir -p /polarx/docker "
ansible -i ${ini_file} all -m shell -a " ln -s /polarx/docker /var/lib/docker "

Install Software Components

Install Docker and associated components using the following steps or commands:

ansible -i ${ini_file} all -m shell -a " yum install docker-ce-19.03.15-3.el7 docker-ce-cli-19.03.15-3.el7 containerd.io-1.3.7-3.1.el7 docker-compose-plugin -y "

Launch the Docker Service

When setting up a private Docker image registry, it’s necessary to include specific configurations within the daemon.json file:

echo "{ \"insecure-registries\":[\"registry:5000\"] }" > $HOME/daemon.json

ansible -i ${ini_file} all -m shell -a " mkdir /etc/docker "
ansible -i ${ini_file} all -m synchronize -a " src=$HOME/daemon.json dest=/etc/docker/daemon.json " -u root

To launch the Docker daemon, run the following command:

ansible -i ${ini_file} all -m shell -a " systemctl enable docker "
ansible -i ${ini_file} all -m shell -a " systemctl start docker "

Verify that the service has started successfully using the following command:

ansible -i ${ini_file} all -m shell -a " docker ps -a "

Launching a Docker Image Registry

A private image registry is required to be run on only one server, and it is commonly deployed on the operations machine (ops). The deployment process is straightforward, involving just three steps:

  1. First, download the container image for the Docker image registry:
docker pull registry
  1. Execute the following command to instantiate a Docker container:
docker run -d --net=host -p 5000:5000 --restart=always --name registry registry
  1. Verify that the image registry's Docker container is functioning correctly:
docker ps

results matching ""

    No results matching ""