1、操作系统信息
\[root@localhost ~\]# cat /etc/redhat-releaseCentOS Linux release 7.6.1810 (Core)\[root@localhost ~\]# free -htotal used free shared buff/cache availableMem: 31G 7.4G 19G 28M 4.7G 23GSwap: 15G 0B 15G\[root@localhost ~\]# df -ThFilesystem Type Size Used Avail Use% Mounted on/dev/sda3 xfs 184G 13G 172G 7% /devtmpfs devtmpfs 16G 0 16G 0% /devtmpfs tmpfs 16G 0 16G 0% /dev/shmtmpfs tmpfs 16G 13M 16G 1% /runtmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup/dev/sda1 xfs 297M 157M 140M 53% /boottmpfs tmpfs 3.2G 8.0K 3.2G 1% /run/user/42tmpfs tmpfs 3.2G 52K 3.2G 1% /run/user/1000tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0overlay overlay 184G 13G 172G 7% /var/lib/docker/overlay2/75b994560a6c064ee11e7c8a0865186ffd1c5ad1e88df29c86ab50f9a884880c/merged
2、安装docker

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile\* base: mirrors.bupt.edu.cn\* extras: mirrors.bupt.edu.cn\* updates: mirrors.bupt.edu.cnResolving Dependencies\--> Running transaction check\---> Package device-mapper-persistent-data.x86\_64 0:0.7.3-3.el7 will be updated\---> Package device-mapper-persistent-data.x86\_64 0:0.8.5-3.el7\_9.2 will be an update\---> Package lvm2.x86\_64 7:2.02.180-8.el7 will be updated\---> Package lvm2.x86\_64 7:2.02.187-6.el7\_9.5 will be an update\--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7\_9.5 for package: 7:lvm2-2.02.187-6.el7\_9.5.x86\_64\---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated\---> Package yum-utils.noarch 0:1.1.31-54.el7\_8 will be an update\--> Running transaction check\---> Package lvm2-libs.x86\_64 7:2.02.180-8.el7 will be updated\---> Package lvm2-libs.x86\_64 7:2.02.187-6.el7\_9.5 will be an update\--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7\_9.5 for package: 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64\--> Running transaction check\---> Package device-mapper-event.x86\_64 7:1.02.149-8.el7 will be updated\---> Package device-mapper-event.x86\_64 7:1.02.170-6.el7\_9.5 will be an update\--> Processing Dependency: device-mapper-event-libs = 7:1.02.170-6.el7\_9.5 for package: 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64\--> Processing Dependency: device-mapper = 7:1.02.170-6.el7\_9.5 for package: 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64\--> Running transaction check\---> Package device-mapper.x86\_64 7:1.02.149-8.el7 will be updated\--> Processing Dependency: device-mapper = 7:1.02.149-8.el7 for package: 7:device-mapper-libs-1.02.149-8.el7.x86\_64\---> Package device-mapper.x86\_64 7:1.02.170-6.el7\_9.5 will be an update\---> Package device-mapper-event-libs.x86\_64 7:1.02.149-8.el7 will be updated\---> Package device-mapper-event-libs.x86\_64 7:1.02.170-6.el7\_9.5 will be an update\--> Running transaction check\---> Package device-mapper-libs.x86\_64 7:1.02.149-8.el7 will be updated\---> Package device-mapper-libs.x86\_64 7:1.02.170-6.el7\_9.5 will be an update\--> Finished Dependency ResolutionDependencies Resolved\======================================================================================================================Package Arch Version Repository Size\======================================================================================================================Updating:device-mapper-persistent-data x86\_64 0.8.5-3.el7\_9.2 updates 423 klvm2 x86\_64 7:2.02.187-6.el7\_9.5 updates 1.3 Myum-utils noarch 1.1.31-54.el7\_8 base 122 kUpdating for dependencies:device-mapper x86\_64 7:1.02.170-6.el7\_9.5 updates 297 kdevice-mapper-event x86\_64 7:1.02.170-6.el7\_9.5 updates 192 kdevice-mapper-event-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 192 kdevice-mapper-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 325 klvm2-libs x86\_64 7:2.02.187-6.el7\_9.5 updates 1.1 MTransaction Summary\======================================================================================================================Upgrade 3 Packages (+5 Dependent packages)Total size: 3.9 MDownloading packages:warning: /var/cache/yum/x86\_64/7/updates/packages/device-mapper-event-1.02.170-6.el7\_9.5.x86\_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7Importing GPG key 0xF4A80EB5:Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5Package : centos-release-7-6.1810.2.el7.centos.x86\_64 (@anaconda)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7Running transaction checkRunning transaction testTransaction test succeededRunning transactionUpdating : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 1/16Updating : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 2/16Updating : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 3/16Updating : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 4/16Updating : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 5/16Updating : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 6/16Updating : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 7/16Updating : yum-utils-1.1.31-54.el7\_8.noarch 8/16Cleanup : 7:lvm2-2.02.180-8.el7.x86\_64 9/16Cleanup : yum-utils-1.1.31-50.el7.noarch 10/16Cleanup : 7:lvm2-libs-2.02.180-8.el7.x86\_64 11/16Cleanup : 7:device-mapper-event-1.02.149-8.el7.x86\_64 12/16Cleanup : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 13/16Cleanup : 7:device-mapper-1.02.149-8.el7.x86\_64 14/16Cleanup : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 15/16Cleanup : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 16/16Verifying : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 1/16Verifying : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 2/16Verifying : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 3/16Verifying : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 4/16Verifying : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 5/16Verifying : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 6/16Verifying : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 7/16Verifying : yum-utils-1.1.31-54.el7\_8.noarch 8/16Verifying : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 9/16Verifying : 7:lvm2-2.02.180-8.el7.x86\_64 10/16Verifying : yum-utils-1.1.31-50.el7.noarch 11/16Verifying : 7:lvm2-libs-2.02.180-8.el7.x86\_64 12/16Verifying : 7:device-mapper-1.02.149-8.el7.x86\_64 13/16Verifying : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 14/16Verifying : 7:device-mapper-event-1.02.149-8.el7.x86\_64 15/16Verifying : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 16/16Updated:device-mapper-persistent-data.x86\_64 0:0.8.5-3.el7\_9.2 lvm2.x86\_64 7:2.02.187-6.el7\_9.5yum-utils.noarch 0:1.1.31-54.el7\_8Dependency Updated:device-mapper.x86\_64 7:1.02.170-6.el7\_9.5 device-mapper-event.x86\_64 7:1.02.170-6.el7\_9.5device-mapper-event-libs.x86\_64 7:1.02.170-6.el7\_9.5 device-mapper-libs.x86\_64 7:1.02.170-6.el7\_9.5lvm2-libs.x86\_64 7:2.02.187-6.el7\_9.5Complete!
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacksadding repo from: https://download.docker.com/linux/centos/docker-ce.repograbbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.reporepo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
\* updates: mirrors.bupt.edu.cnLoading mirror speeds from cached hostfileLoaded plugins: fastestmirror, langpacks\* extras: mirrors.bupt.edu.cndocker-ce.x86\_64 3:20.10.9-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.8-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.7-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.6-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.5-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.4-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.3-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.2-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.1-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.11-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.10-3.el7 docker-ce-stabledocker-ce.x86\_64 3:20.10.0-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.9-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.8-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.7-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.6-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.5-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.4-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.3-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.2-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.15-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.14-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.1-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.13-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.12-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.11-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.10-3.el7 docker-ce-stabledocker-ce.x86\_64 3:19.03.0-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.9-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.8-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.7-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.6-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.5-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.4-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.3-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.2-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.1-3.el7 docker-ce-stabledocker-ce.x86\_64 3:18.09.0-3.el7 docker-ce-stabledocker-ce.x86\_64 18.06.3.ce-3.el7 docker-ce-stabledocker-ce.x86\_64 18.06.2.ce-3.el7 docker-ce-stabledocker-ce.x86\_64 18.06.1.ce-3.el7 docker-ce-stabledocker-ce.x86\_64 18.06.0.ce-3.el7 docker-ce-stabledocker-ce.x86\_64 18.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 18.03.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.12.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.12.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.09.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.09.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.06.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.06.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.06.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.03.3.ce-1.el7 docker-ce-stabledocker-ce.x86\_64 17.03.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86\_64 17.03.0.ce-1.el7.centos docker-ce-stable\* base: mirrors.bupt.edu.cnAvailable Packages

[root@localhost ~]# yum install docker-ce-19.03.5 docker-ce-cli-19.03.5 containerd.io
Loaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile\* base: mirrors.bupt.edu.cn\* extras: mirrors.bupt.edu.cn\* updates: mirrors.bupt.edu.cnResolving Dependencies\--> Running transaction check\---> Package containerd.io.x86\_64 0:1.4.12-3.1.el7 will be installed\--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.12-3.1.el7.x86\_64\---> Package docker-ce.x86\_64 3:19.03.5-3.el7 will be installed\---> Package docker-ce-cli.x86\_64 1:19.03.5-3.el7 will be installed\--> Running transaction check\---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7\_8 will be installed\--> Finished Dependency ResolutionDependencies Resolved\======================================================================================================================Package Arch Version Repository Size\======================================================================================================================Installing:containerd.io x86\_64 1.4.12-3.1.el7 docker-ce-stable 28 Mdocker-ce x86\_64 3:19.03.5-3.el7 docker-ce-stable 24 Mdocker-ce-cli x86\_64 1:19.03.5-3.el7 docker-ce-stable 39 MInstalling for dependencies:container-selinux noarch 2:2.119.2-1.911c772.el7\_8 extras 40 kTransaction Summary\======================================================================================================================Install 3 Packages (+1 Dependent package)Total download size: 92 MInstalled size: 381 MIs this ok \[y/d/N\]: yDownloading packages:(1/4): container-selinux-2.119.2-1.911c772.el7\_8.noarch.rpm | 40 kB 00:00:00warning: /var/cache/yum/x86\_64/7/docker-ce-stable/packages/containerd.io-1.4.12-3.1.el7.x86\_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEYPublic key for containerd.io-1.4.12-3.1.el7.x86\_64.rpm is not installed(2/4): containerd.io-1.4.12-3.1.el7.x86\_64.rpm | 28 MB 00:00:06(3/4): docker-ce-19.03.5-3.el7.x86\_64.rpm | 24 MB 00:00:07(4/4): docker-ce-cli-19.03.5-3.el7.x86\_64.rpm | 39 MB 00:00:05\----------------------------------------------------------------------------------------------------------------------Total 8.2 MB/s | 92 MB 00:00:11Retrieving key from https://download.docker.com/linux/centos/gpgImporting GPG key 0x621E9F35:Userid : "Docker Release (CE rpm) <docker@docker.com>"Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35From : https://download.docker.com/linux/centos/gpgIs this ok \[y/N\]: yRunning transaction checkRunning transaction testTransaction test succeededRunning transactionInstalling : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 1/4Installing : containerd.io-1.4.12-3.1.el7.x86\_64 2/4Installing : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4Installing : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4Verifying : containerd.io-1.4.12-3.1.el7.x86\_64 1/4Verifying : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 2/4Verifying : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4Verifying : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4Installed:containerd.io.x86\_64 0:1.4.12-3.1.el7 docker-ce.x86\_64 3:19.03.5-3.el7 docker-ce-cli.x86\_64 1:19.03.5-3.el7Dependency Installed:container-selinux.noarch 2:2.119.2-1.911c772.el7\_8Complete!
[root@localhost ~]# docker version

Client: Docker Engine - CommunityVersion: 19.03.5API version: 1.40Go version: go1.12.12Git commit: 633a0eaBuilt: Wed Nov 13 07:25:41 2019OS/Arch: linux/amd64Experimental: falseCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker info
Client:Debug Mode: falseServer:ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?errors pretty printing info
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: active (running) since Sat 2021-12-04 20:20:30 PST; 4s agoDocs: https://docs.docker.comMain PID: 24363 (dockerd)Tasks: 24Memory: 48.7MCGroup: /system.slice/docker.service└─24363 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sockDec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080143468-08:00" level=info msg...grpcDec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080167167-08:00" level=info msg...grpcDec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080177798-08:00" level=info msg...grpcDec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.118578486-08:00" level=info msg...rt."Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.666832705-08:00" level=info msg...ess"Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.247902471-08:00" level=info msg...ne."Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.279908386-08:00" level=info msg...03.5Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.280111055-08:00" level=info msg...ion"Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.310555121-08:00" level=info msg...ock"Dec 04 20:20:30 localhost.localdomain systemd\[1\]: Started Docker Application Container Engine.Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# docker search oceanbase
NAME DESCRIPTION STARS OFFICIAL AUTOMATEDoceanbase/oceanbase-xe OceanBase Database 2.2 Express Edition 3oceanbase/obce-mini obce-mini is a mini standalone test image fo… 2obpilot/oceanbase-ce 3 steps to run an OceanBase-CE docker in you… 2zibuyu886/oceanbase-ce-cluster OceanBase ce cluster 1oceanbase/oceanbase-ce OceanBase is open source now. This is the do… 1huweijie/oceanbase-ce-deploy 0oceanbase/centos7 0superbigfu/oceanbase 0hongweiqin/anolisos-oceanbase A tentative deploy of oceanbase. 0stutiredboy/centos\_ob Build environment for OceanBase 3.1 CE. Crea… 0
3、下载镜像

[root@localhost ~]# docker pull obpilot/oceanbase-ce
Using default tag: latestlatest: Pulling from obpilot/oceanbase-ce7a0437f04f83: Pull complete615dc48ac9f1: Pull completeb10c1cdae3af: Pull complete4f4fb700ef54: Pull completec0f6c94a6a6a: Pull complete792630f35e24: Pull completeDigest: sha256:7ac28415cf27ba19cb47acb67a55ebf9848ad73a63d80b7e2e85d653233dbaebStatus: Downloaded newer image for obpilot/oceanbase-ce:latestdocker.io/obpilot/oceanbase-ce:latest
4、查看镜像
[root@localhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEobpilot/oceanbase-ce latest 943379e0b05b 2 days ago 2.25GB
5、运行容器
[root@localhost ~]# docker run -itd -m 40G -p 2881:2881 -p 2883:2883 --name oceanbase-ce obpilot/oceanbase-ce:latest213992b864c831141e12fc269721fc5bb9d3a003001c2eeb6a65931d4bca4883
6、查看运行状态
[root@localhost ~]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES213992b864c8 obpilot/oceanbase-ce:latest "/bin/bash" 7 seconds ago Up 6 seconds 0.0.0.0:2881->2881/tcp, 0.0.0.0:2883->2883/tcp oceanbase-ce
7、进入容器
[root@localhost ~]# docker exec -it oceanbase-ce bash
8、启动ob服务
[admin@213992b864c8 ~\]obd cluster list+−−−−−−−−+|ClusterList|+−−−−−−−−+|Name|ConfigurationPath|Status(Cached)|+−−−−−−−−obdemo|/home/admin/.obd/cluster/obdemo|deployed|+−−−−−[admin@213992b864c8 \]lsbmsql.sql obproxy oceanbase-ce readme.md
[admin@213992b864c8 ~]$ obd cluster start obdemo

9、查看ob集群运行状态
[admin@213992b864c8 ~]$ obd cluster display obdemo

10、进入集群测试
[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase

[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbaseWelcome to the OceanBase. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [oceanbase]> show databases;+--------------------+| Database |+--------------------+| oceanbase || information_schema || mysql || SYS || LBACSYS || ORAAUDITOR || test |+--------------------+7 rows in set (0.004 sec)MySQL [oceanbase]> SELECT * FROM __all_server;+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+| gmt_create | gmt_modified | svr_ip | svr_port | id | zone | inner_port | with_rootserver | status | block_migrate_in_time | build_version | stop_time | start_service_time | first_sessid | with_partition | last_offline_time |+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+| 2021-12-05 12:34:50.806137 | 2021-12-05 12:35:06.704563 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:52:05) | 0 | 1638678904706946 | 0 | 1 | 0 |+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+1 row in set (0.008 sec)MySQL [oceanbase]> SELECT * FROM __all_server;+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+| gmt_create | gmt_modified | svr_ip | svr_port | id | zone | inner_port | with_rootserver | status | block_migrate_in_time | build_version | stop_time | start_service_time | first_sessid | with_partition | last_offline_time |+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+| 2021-12-05 12:34:50.806137 | 2021-12-05 12:35:06.704563 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:52:05) | 0 | 1638678904706946 | 0 | 1 | 0 |+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+1 row in set (0.001 sec)MySQL [oceanbase]> SELECT svr_ip,svr_port, cpu_total, mem_total/1024/1024/1024, disk_total/1024/1024/1024, zone FROM __all_virtual_server_stat;+-----------+----------+-----------+--------------------------+---------------------------+-------+| svr_ip | svr_port | cpu_total | mem_total/1024/1024/1024 | disk_total/1024/1024/1024 | zone |+-----------+----------+-----------+--------------------------+---------------------------+-------+| 127.0.0.1 | 2882 | 14 | 4.000000000000 | 5.000000000000 | zone1 |+-----------+----------+-----------+--------------------------+---------------------------+-------+1 row in set (0.006 sec)MySQL [oceanbase]> SELECT sum(c.max_cpu), sum(c.max_memory)/1024/1024/1024 FROM __all_resource_pool as a, __all_unit_config AS c WHERE a.unit_config_id=c.unit_config_id;+----------------+----------------------------------+| sum(c.max_cpu) | sum(c.max_memory)/1024/1024/1024 |+----------------+----------------------------------+| 5 | 1.199999999255 |+----------------+----------------------------------+1 row in set (0.005 sec)MySQL [oceanbase]> CREATE RESOURCE UNIT unitsixlens max_cpu = 4, max_memory = '8G', min_memory = '8G', max_iops = 10000, min_iops = 10000, max_session_num = 30000, max_disk_size = '4G';Query OK, 0 rows affected (0.009 sec)MySQL [oceanbase]> SELECT * FROM __all_unit_config;+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | max_memory | min_memory | max_iops | min_iops | max_disk_size | max_session_num |+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+| 2021-12-05 12:35:03.074942 | 2021-12-05 12:35:03.074942 | 1 | sys_unit_config | 5 | 2.5 | 1288490188 | 1073741824 | 10000 | 5000 | 5368709120 | 9223372036854775807 || 2021-12-05 12:37:33.515276 | 2021-12-05 12:37:33.515276 | 1001 | unitsixlens | 4 | 4 | 8589934592 | 8589934592 | 10000 | 10000 | 4294967296 | 30000 |+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+2 rows in set (0.004 sec)MySQL [oceanbase]> CREATE RESOURCE POOL poolsixlens UNIT = 'unitsixlens', UNIT_NUM = 1,ZONE_LIST = ('zone1');ERROR 4624 (HY000): machine resource 'zone1' is not enough to hold a new unitMySQL [oceanbase]> alter resource unit unitsixlens max_cpu=4 , max_memory = '2G',min_memory = '1G', max_iops = 10000, min_iops = 10000, max_session_num = 30000, max_disk_size = '4G';Query OK, 0 rows affected (0.005 sec)MySQL [oceanbase]> CREATE RESOURCE POOL poolsixlens UNIT = 'unitsixlens', UNIT_NUM = 1,ZONE_LIST = ('zone1');Query OK, 0 rows affected (0.012 sec)MySQL [oceanbase]> CREATE TENANT IF NOT EXISTS tenantsixlens charset='utf8mb4', replica_num=1, zone_list=('zone1'), primary_zone='zone1', resource_pool_list=('poolsixlens');Query OK, 0 rows affected (0.743 sec)MySQL [oceanbase]> select tenant_id,tenant_name,primary_zone from __all_tenant;+-----------+---------------+--------------+| tenant_id | tenant_name | primary_zone |+-----------+---------------+--------------+| 1 | sys | zone1 || 1001 | tenantsixlens | zone1 |+-----------+---------------+--------------+2 rows in set (0.004 sec)MySQL [oceanbase]> exitBye[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@tenantsixlens#obce-single -P2883 -c -A oceanbaseWelcome to the OceanBase. Commands end with ; or \g.Your MySQL connection id is 7Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [oceanbase]> CREATE USER 'usersixlens' IDENTIFIED BY '123#abc';Query OK, 0 rows affected (0.025 sec)MySQL [oceanbase]> SELECT user FROM mysql.user;+-------------+| user |+-------------+| root || ORAAUDITOR || usersixlens |+-------------+3 rows in set (0.021 sec)MySQL [oceanbase]> grant all on *.* to 'usersixlens' WITH GRANT OPTION;Query OK, 0 rows affected (0.012 sec)MySQL [oceanbase]> show grants for usersixlens;+----------------------------------------------------------------+| Grants for usersixlens@% |+----------------------------------------------------------------+| GRANT ALL PRIVILEGES ON *.* TO 'usersixlens' WITH GRANT OPTION |+----------------------------------------------------------------+1 row in set (0.018 sec)MySQL [oceanbase]> exitBye[admin@213992b864c8 ~]$ obclient -h127.1 -uusersixlens@tenantsixlens#obce-single -P2883 -p123#abc -c -AWelcome to the OceanBase. Commands end with ; or \g.Your MySQL connection id is 8Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [(none)]> create database testdb;Query OK, 1 row affected (0.015 sec)MySQL [(none)]> show databases;+--------------------+| Database |+--------------------+| oceanbase || information_schema || mysql || test || testdb |+--------------------+5 rows in set (0.003 sec)MySQL [(none)]> CREATE TABLE t1 (id int,name varchar(20));ERROR 1046 (3D000): No database selectedMySQL [(none)]> use testdbDatabase changedMySQL [testdb]> CREATE TABLE t1 (id int,name varchar(20));Query OK, 0 rows affected (0.058 sec)MySQL [testdb]> insert into t1(id,name) values(88,"cjtom");Query OK, 1 row affected (0.014 sec)MySQL [testdb]> show tables;+------------------+| Tables_in_testdb |+------------------+| t1 |+------------------+1 row in set (0.007 sec)MySQL [testdb]>[admin@213992b864c8 ~]$ cd oceanbase-ce/[admin@213992b864c8 oceanbase-ce]$ lsadmin bin etc etc2 etc3 lib log run store[admin@213992b864c8 oceanbase-ce]$ tree.|-- admin|-- bin| `-- observer -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/bin/observer|-- etc| |-- observer.config.bin| `-- observer.config.bin.history|-- etc2| |-- observer.conf.bin| `-- observer.conf.bin.history|-- etc3| |-- observer.conf.bin| `-- observer.conf.bin.history|-- lib| |-- libaio.so -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so| |-- libaio.so.1 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so.1| |-- libaio.so.1.0.1 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so.1.0.1| |-- libmariadb.so -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libmariadb.so| `-- libmariadb.so.3 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libmariadb.so.3|-- log| |-- election.log| |-- election.log.wf| |-- observer.log| |-- observer.log.wf| |-- rootservice.log| `-- rootservice.log.wf|-- run| |-- mysql.sock| `-- observer.pid`-- store|-- clog -> /data/log1/clog|-- ilog -> /data/log1/ilog|-- slog -> /data/log1/slog`-- sstable`-- block_file13 directories, 21 files[admin@213992b864c8 ~]$ obd cluster stop obdemo 关闭集群Get local repositories and plugins okOpen ssh connection okStop observer okStop obproxy okobdemo stopped[admin@213992b864c8 ~]$ obd cluster display obdemo 查看Deploy "obdemo" is stopped[admin@213992b864c8 ~]$ obd cluster start obdemo -0--启动Get local repositories and plugins okOpen ssh connection okCluster param config check okCheck before start observer okCheck before start obproxy okStart observer okobserver program health check okConnect to observer okWait for observer init ok+---------------------------------------------+| observer |+-----------+---------+------+-------+--------+| ip | version | port | zone | status |+-----------+---------+------+-------+--------+| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |+-----------+---------+------+-------+--------+Start obproxy okobproxy program health check x[WARN] failed to start 127.0.0.1 obproxy[ERROR] obproxy start failed[admin@213992b864c8 ~]$ obd cluster start obdemo 启动失败,重新 启动Get local repositories and plugins okOpen ssh connection okCluster param config check okCheck before start observer okCheck before start obproxy okStart observer okobserver program health check okConnect to observer okWait for observer init ok+---------------------------------------------+| observer |+-----------+---------+------+-------+--------+| ip | version | port | zone | status |+-----------+---------+------+-------+--------+| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |+-----------+---------+------+-------+--------+Start obproxy okobproxy program health check okConnect to obproxy okInitialize cluster+---------------------------------------------+| obproxy |+-----------+------+-----------------+--------+| ip | port | prometheus_port | status |+-----------+------+-----------------+--------+| 127.0.0.1 | 2883 | 2884 | active |+-----------+------+-----------------+--------+obdemo running[admin@213992b864c8 ~]$ obd cluster display obdemo --查看ob集群运行状态Get local repositories and plugins okOpen ssh connection okCluster status check okConnect to observer okWait for observer init ok+---------------------------------------------+| observer |+-----------+---------+------+-------+--------+| ip | version | port | zone | status |+-----------+---------+------+-------+--------+| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |+-----------+---------+------+-------+--------+Connect to obproxy ok+---------------------------------------------+| obproxy |+-----------+------+-----------------+--------+| ip | port | prometheus_port | status |+-----------+------+-----------------+--------+| 127.0.0.1 | 2883 | 2884 | active |+-----------+------+-----------------+--------+[root@localhost ~]# docker exec -it oceanbase-ce bash[admin@213992b864c8 ~]$ obd cluster display odbemo[ERROR] No such deploy: odbemo.[admin@213992b864c8 ~]$ obd cluster display obdemoGet local repositories and plugins okOpen ssh connection okCluster status check ok[ERROR] Some of the servers in the cluster have been stopped127.0.0.1 oceanbase-ce is stopped127.0.0.1 obproxy is stopped[admin@213992b864c8 ~]$ obd cluster start obdemoGet local repositories and plugins okOpen ssh connection okCluster param config check okCheck before start observer okCheck before start obproxy okStart observer okobserver program health check okConnect to observer okWait for observer init ok+---------------------------------------------+| observer |+-----------+---------+------+-------+--------+| ip | version | port | zone | status |+-----------+---------+------+-------+--------+| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |+-----------+---------+------+-------+--------+Start obproxy okobproxy program health check okConnect to obproxy okInitialize cluster+---------------------------------------------+| obproxy |+-----------+------+-----------------+--------+| ip | port | prometheus_port | status |+-----------+------+-----------------+--------+| 127.0.0.1 | 2883 | 2884 | active |+-----------+------+-----------------+--------+obdemo running[admin@213992b864c8 ~]$ obd cluster display obdemoGet local repositories and plugins okOpen ssh connection okCluster status check okConnect to observer okWait for observer init ok+---------------------------------------------+| observer |+-----------+---------+------+-------+--------+| ip | version | port | zone | status |+-----------+---------+------+-------+--------+| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |+-----------+---------+------+-------+--------+Connect to obproxy ok+---------------------------------------------+| obproxy |+-----------+------+-----------------+--------+| ip | port | prometheus_port | status |+-----------+------+-----------------+--------+| 127.0.0.1 | 2883 | 2884 | active |+-----------+------+-----------------+--------+
