本地最小测试集群
1.卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
2.设置存储库
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
3.安装 Docker 引擎
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
ps -ef | grep docker
sudo docker run hello-world
4.启动 OceanBase 数据库实例
sudo docker pull oceanbase/obce-mini
sudo docker images
# sudo docker stop obce-mini # 关闭
# sudo docker rm obce-mini # 删除
# sudo docker ps -a
# sudo docker start obce-mini
#(base) cwj0@ubuntu:~$ sudo docker run -it -p 2881:2881 --name obce-mini oceanbase/obce-mini
(base) cwj0@ubuntu:~$ sudo docker run --privileged -it -p 2881:2881 --name obce-mini oceanbase/obce-mini
generate boot.yaml ...
create boot dirs and deploy ob cluster ...
Package oceanbase-ce-3.1.0 is available.
install oceanbase-ce-3.1.0 for local ok
+-----------------------------------------------------------------------------+
| Packages |
+--------------+---------+---------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+---------+------------------------------------------+
| oceanbase-ce | 3.1.0 | 2.el7 | afd11d52f83eef4b456d77969fde620c4bfba85e |
+--------------+---------+---------+------------------------------------------+
Open ssh connection ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository install ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository lib check !!
[WARN] 127.0.0.1 oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e require: libaio.so.1
[WARN] 127.0.0.1 oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e require: libmariadb.so.3
Try to get lib-repository
Package oceanbase-ce-libs-3.1.0 is available.
install oceanbase-ce-libs-3.1.0 for local ok
Use oceanbase-ce-libs-3.1.0-47300ca1ac4c62493caf3e9235b105e242e533b5 for oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e
Remote oceanbase-ce-libs-3.1.0-47300ca1ac4c62493caf3e9235b105e242e533b5 repository install ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository lib check ok
Cluster status check ok
127.0.0.1 initializes cluster work home
mini-ce deployed
start ob cluster ...
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
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.0 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
mini-ce running
generate init_tenant.sql ...
init tenant and sysbench database ...
boot success!
注意: 如果提示no enough memory,设置内存高于8G,注意是内存,不是硬盘大小
启动预计需要 2-5 分钟。如果返回 boot success!
,则启动成功。
# 进入到容器内部
sudo docker exec -it obce-mini bash
# 获取集群信息
obd cluster list
+--------------------------------------------------------+
| Cluster List |
+---------+----------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+---------+----------------------------+-----------------+
| mini-ce | /root/.obd/cluster/mini-ce | running |
+---------+----------------------------+-----------------+
# 启动集群
obd cluster start mini-ce
5.连接OceanBase
mysql -h127.0.0.1 -uroot -P2881
6.superset连接OceanBase
mysql://root@127.0.0.1:2881/mysql
7.下次连接
sudo docker ps -a
sudo docker start obce-mini