1、操作系统信息
\[root@localhost ~\]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
\[root@localhost ~\]# free -h
total used free shared buff/cache available
Mem: 31G 7.4G 19G 28M 4.7G 23G
Swap: 15G 0B 15G
\[root@localhost ~\]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 xfs 184G 13G 172G 7% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 13M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 xfs 297M 157M 140M 53% /boot
tmpfs tmpfs 3.2G 8.0K 3.2G 1% /run/user/42
tmpfs tmpfs 3.2G 52K 3.2G 1% /run/user/1000
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
overlay 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, langpacks
Loading mirror speeds from cached hostfile
\* base: mirrors.bupt.edu.cn
\* extras: mirrors.bupt.edu.cn
\* updates: mirrors.bupt.edu.cn
Resolving 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 Resolution
Dependencies Resolved
\======================================================================================================================
Package Arch Version Repository Size
\======================================================================================================================
Updating:
device-mapper-persistent-data x86\_64 0.8.5-3.el7\_9.2 updates 423 k
lvm2 x86\_64 7:2.02.187-6.el7\_9.5 updates 1.3 M
yum-utils noarch 1.1.31-54.el7\_8 base 122 k
Updating for dependencies:
device-mapper x86\_64 7:1.02.170-6.el7\_9.5 updates 297 k
device-mapper-event x86\_64 7:1.02.170-6.el7\_9.5 updates 192 k
device-mapper-event-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 192 k
device-mapper-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 325 k
lvm2-libs x86\_64 7:2.02.187-6.el7\_9.5 updates 1.1 M
Transaction Summary
\======================================================================================================================
Upgrade 3 Packages (+5 Dependent packages)
Total size: 3.9 M
Downloading 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: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing 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 0eb5
Package : centos-release-7-6.1810.2.el7.centos.x86\_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 1/16
Updating : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 2/16
Updating : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 3/16
Updating : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 4/16
Updating : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 5/16
Updating : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 6/16
Updating : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 7/16
Updating : yum-utils-1.1.31-54.el7\_8.noarch 8/16
Cleanup : 7:lvm2-2.02.180-8.el7.x86\_64 9/16
Cleanup : yum-utils-1.1.31-50.el7.noarch 10/16
Cleanup : 7:lvm2-libs-2.02.180-8.el7.x86\_64 11/16
Cleanup : 7:device-mapper-event-1.02.149-8.el7.x86\_64 12/16
Cleanup : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 13/16
Cleanup : 7:device-mapper-1.02.149-8.el7.x86\_64 14/16
Cleanup : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 15/16
Cleanup : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 16/16
Verifying : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 1/16
Verifying : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 2/16
Verifying : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 3/16
Verifying : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 4/16
Verifying : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 5/16
Verifying : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 6/16
Verifying : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 7/16
Verifying : yum-utils-1.1.31-54.el7\_8.noarch 8/16
Verifying : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 9/16
Verifying : 7:lvm2-2.02.180-8.el7.x86\_64 10/16
Verifying : yum-utils-1.1.31-50.el7.noarch 11/16
Verifying : 7:lvm2-libs-2.02.180-8.el7.x86\_64 12/16
Verifying : 7:device-mapper-1.02.149-8.el7.x86\_64 13/16
Verifying : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 14/16
Verifying : 7:device-mapper-event-1.02.149-8.el7.x86\_64 15/16
Verifying : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 16/16
Updated:
device-mapper-persistent-data.x86\_64 0:0.8.5-3.el7\_9.2 lvm2.x86\_64 7:2.02.187-6.el7\_9.5
yum-utils.noarch 0:1.1.31-54.el7\_8
Dependency 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.5
device-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.5
lvm2-libs.x86\_64 7:2.02.187-6.el7\_9.5
Complete!
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
\* updates: mirrors.bupt.edu.cn
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror, langpacks
\* extras: mirrors.bupt.edu.cn
docker-ce.x86\_64 3:20.10.9-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.8-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.7-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.6-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.5-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.4-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.3-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.2-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.1-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.11-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.10-3.el7 docker-ce-stable
docker-ce.x86\_64 3:20.10.0-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.9-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.8-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.7-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.6-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.15-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.14-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.13-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.12-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.11-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.10-3.el7 docker-ce-stable
docker-ce.x86\_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.8-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86\_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86\_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86\_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86\_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86\_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86\_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86\_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86\_64 17.03.0.ce-1.el7.centos docker-ce-stable
\* base: mirrors.bupt.edu.cn
Available Packages
[root@localhost ~]# yum install docker-ce-19.03.5 docker-ce-cli-19.03.5 containerd.io
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
\* base: mirrors.bupt.edu.cn
\* extras: mirrors.bupt.edu.cn
\* updates: mirrors.bupt.edu.cn
Resolving 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 Resolution
Dependencies Resolved
\======================================================================================================================
Package Arch Version Repository Size
\======================================================================================================================
Installing:
containerd.io x86\_64 1.4.12-3.1.el7 docker-ce-stable 28 M
docker-ce x86\_64 3:19.03.5-3.el7 docker-ce-stable 24 M
docker-ce-cli x86\_64 1:19.03.5-3.el7 docker-ce-stable 39 M
Installing for dependencies:
container-selinux noarch 2:2.119.2-1.911c772.el7\_8 extras 40 k
Transaction Summary
\======================================================================================================================
Install 3 Packages (+1 Dependent package)
Total download size: 92 M
Installed size: 381 M
Is this ok \[y/d/N\]: y
Downloading packages:
(1/4): container-selinux-2.119.2-1.911c772.el7\_8.noarch.rpm | 40 kB 00:00:00
warning: /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: NOKEY
Public 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:11
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
Is this ok \[y/N\]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 1/4
Installing : containerd.io-1.4.12-3.1.el7.x86\_64 2/4
Installing : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4
Installing : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4
Verifying : containerd.io-1.4.12-3.1.el7.x86\_64 1/4
Verifying : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 2/4
Verifying : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4
Verifying : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4
Installed:
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.el7
Dependency Installed:
container-selinux.noarch 2:2.119.2-1.911c772.el7\_8
Complete!
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker info
Client:
Debug Mode: false
Server:
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 Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2021-12-04 20:20:30 PST; 4s ago
Docs: https://docs.docker.com
Main PID: 24363 (dockerd)
Tasks: 24
Memory: 48.7M
CGroup: /system.slice/docker.service
└─24363 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080143468-08:00" level=info msg...grpc
Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080167167-08:00" level=info msg...grpc
Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080177798-08:00" level=info msg...grpc
Dec 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.5
Dec 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 AUTOMATED
oceanbase/oceanbase-xe OceanBase Database 2.2 Express Edition 3
oceanbase/obce-mini obce-mini is a mini standalone test image fo… 2
obpilot/oceanbase-ce 3 steps to run an OceanBase-CE docker in you… 2
zibuyu886/oceanbase-ce-cluster OceanBase ce cluster 1
oceanbase/oceanbase-ce OceanBase is open source now. This is the do… 1
huweijie/oceanbase-ce-deploy 0
oceanbase/centos7 0
superbigfu/oceanbase 0
hongweiqin/anolisos-oceanbase A tentative deploy of oceanbase. 0
stutiredboy/centos\_ob Build environment for OceanBase 3.1 CE. Crea… 0
3、下载镜像
[root@localhost ~]# docker pull obpilot/oceanbase-ce
Using default tag: latest
latest: Pulling from obpilot/oceanbase-ce
7a0437f04f83: Pull complete
615dc48ac9f1: Pull complete
b10c1cdae3af: Pull complete
4f4fb700ef54: Pull complete
c0f6c94a6a6a: Pull complete
792630f35e24: Pull complete
Digest: sha256:7ac28415cf27ba19cb47acb67a55ebf9848ad73a63d80b7e2e85d653233dbaeb
Status: Downloaded newer image for obpilot/oceanbase-ce:latest
docker.io/obpilot/oceanbase-ce:latest
4、查看镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
obpilot/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:latest
213992b864c831141e12fc269721fc5bb9d3a003001c2eeb6a65931d4bca4883
6、查看运行状态
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
213992b864c8 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 \]ls
bmsql.sql obproxy oceanbase-ce readme.md
[admin@213992b864c8 ~]$ obd cluster start obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap ok
Wait for observer init ok
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster
+---------------------------------------------+
| obproxy |
+-----------+------+-----------------+--------+
| ip | port | prometheus\_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884 | active |
+-----------+------+-----------------+--------+
obdemo running
9、查看ob集群运行状态
[admin@213992b864c8 ~]$ obd cluster display obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait 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 |
+-----------+------+-----------------+--------+
10、进入集群测试
[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 4
Server 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 unit
MySQL [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]> exit
Bye
[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@tenantsixlens#obce-single -P2883 -c -A oceanbase
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 7
Server 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]> exit
Bye
[admin@213992b864c8 ~]$ obclient -h127.1 -uusersixlens@tenantsixlens#obce-single -P2883 -p123#abc -c -A
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 8
Server 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 selected
MySQL [(none)]> use testdb
Database changed
MySQL [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]$ ls
admin 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_file
13 directories, 21 files
[admin@213992b864c8 ~]$ obd cluster stop obdemo 关闭集群
Get local repositories and plugins ok
Open ssh connection ok
Stop observer ok
Stop obproxy ok
obdemo stopped
[admin@213992b864c8 ~]$ obd cluster display obdemo 查看
Deploy "obdemo" is stopped
[admin@213992b864c8 ~]$ obd cluster start obdemo -0--启动
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Wait for observer init ok
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
Start obproxy ok
obproxy 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 ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Wait for observer init ok
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize 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 ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait 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 obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
[ERROR] Some of the servers in the cluster have been stopped
127.0.0.1 oceanbase-ce is stopped
127.0.0.1 obproxy is stopped
[admin@213992b864c8 ~]$ obd cluster start obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Wait for observer init ok
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster
+---------------------------------------------+
| obproxy |
+-----------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884 | active |
+-----------+------+-----------------+--------+
obdemo running
[admin@213992b864c8 ~]$ obd cluster display obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait 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 |
+-----------+------+-----------------+--------+