01ShardingSphere-docker environment installation

Using docker to install the database is a very good choice. Subsequent databases with functions such as read-write separation and data sharding are all created by docker.

1. Installation preparation

1. Prerequisites

  • Docker can run on Windows, Mac, CentOS, Ubuntu and other operating systems

  • Docker supports the following CentOS versions:

    • CentOS 7 (64-bit)
    • CentOS 6.5 (64-bit) or higher
  • Currently, CentOS only supports Docker in the kernel in the distribution

    • Docker runs on CentOS 7, which requires the system to be 64-bit and the system kernel version to be 3.10 or above.

    • Docker runs on CentOS-6.5 or higher, which requires the system to be 64-bit and the system kernel version to be 2.6.32-431 or higher.

      Prepare a CentOS version of linux system

2. Check the system kernel

The uname command is used to print current system-related information (kernel version number, hardware architecture, host name, operating system type, etc.).

uname -r

image-20230802221123851

3. View the installed CentOS version information

cat /etc/redhat-release

image-20230802221143703

2. Install docker on CentOS7

Official website: http://www.docker.com

Installation manual: https://docs.docker.com/install/linux/docker-ce/centos (CE-Community Edition)

1. Install the required software packages

This is a command required to install Docker on a CentOS system. It installs the yum-utils, device-mapper-persistent-data and lvm2 packages to create logical volume management devices and manage image warehouses when using Docker.

yum install -y yum-utils \
               device-mapper-persistent-data \
               lvm2

2. Set up docker to download the image

Recommended Alibaba Cloud download address

This command is used to add the Alibaba Cloud image source to install Docker CE on the CentOS system. Specifically, it adds a file named docker-ce.repo to the CentOS yum configuration file and writes the source address of Alibaba Cloud's Docker CE image into the file. In this way, when executing the command to install Docker CE, the system will obtain the software package from Alibaba Cloud's image source, which is faster and more stable.

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3. Update yum package index

After we update or configure the yum source, we usually use yum makecache to generate a cache

This command is used to update the metadata cache of installed software packages and software package repositories on the system, and cache the software package information locally in advance to facilitate faster search, installation, and upgrade of software packages. Executing this command will download the metadata in the software package warehouse, including the software package list, dependencies, version information, etc. If you need to install, update, or uninstall a software package, execute this command first to ensure that the system has the latest package information.

yum makecache fast

4. Install docker ce

yum install -y docker-ce

5. Start docker

systemctl start docker

6. Version verification

[root@dongguo ~]# docker version
Client: Docker Engine - Community
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:39:02 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:38:05 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

7. Set up startup

#查看服务是否自动启动(是:enabled | 否:disabled)
systemctl list-unit-files|grep docker.service 

#设置开机启动:如不是enabled可以运行如下命令设置自启动
systemctl enable docker
#重新加载服务配置
systemctl daemon-reload 

#如果希望不进行自启动,运行如下命令设置
systemctl disable docker
#重新加载服务配置
systemctl daemon-reload 

image-20230802223536058

3. Uninstall

systemctl stop docker 
yum remove -y docker-ce
rm -rf /var/lib/docker

Guess you like

Origin blog.csdn.net/m0_37450089/article/details/132395262