SoFunction
Updated on 2025-03-02

Docker deploys OceanBase-ce cluster method

OceanBase-ce cluster

In some cases, there is no root user password, or the old machine reuses.

Can be deployed in docker on the machine

0. Machine preparation

During the test, I prepared three machines and installed docker-ce

yum -y install docker-ce

Notes:

  • root user password: admin
  • admin user password: admin

1. Pull down from dockerhub

zibuyu886 is my dockerhub account, which is in the original centos7

oceanbase-ce deployed in docker image. Refer to another article:Deploy OceanBase-ce

Of course, you can also use the official image provided

docker pull zibuyu886/oceanbase-ce-cluster

2. Run up

docker run -dit --net=host --privileged=true --name obce01 /zibuyu886/oceanbase-ce-cluster:latest /usr/sbin/init

/usr/sbin/init You can use the systemctl method after starting the container

-privileged=true Get host root permissions (special permissions-)

The biggest essential difference between su command and su - command is:

The former just switches the root identity, but the shell environment is still the shell of ordinary users;

The latter switches to root identity with the user and the shell environment.

If not added--privileged=trueThe sshd service may not be started due to permission issues.

All three machines must be run.

3. Modify the configuration file

Enter docker

docker exec -it obce01 bash

The configuration file is in/etc/, you can view and modify the configuration.

Pay attention to modifying the IP address and the corresponding passwords, and also creating the data directory.

 mkdir -p /data/data
 mkdir -p /data/redo

4. Start deploy

  • -c Specify configuration file
  • -v Show detailed information about deployment steps
obd cluster deploy obcluster -c /etc/ -v

5. start ob service

obd cluster start obcluster

6. Use obclient to connect to the database

obclient -h127.0.0.1 -P 2883 -uroot@sys#obcluster -p'your passwor' -Doceanbase -A

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.