硬件环境:virtual box虚拟机,16G内存
操作系统:ubuntu
frank@frank:~$ sudo apt install docker.io
frank@frank:~$ sudo systemctl start docker
frank@frank:~$ ps -ef | grep docker
root 16728 1 0 09:32 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
frank 18244 15670 0 09:33 pts/0 00:00:00 grep --color=auto docker
frank@frank:~$
- 拉取镜像
frank@frank:~$ sudo docker pull oceanbase/obce-mini
frank@frank:~$ sudo docker images
[sudo] frank 的密码:
REPOSITORY TAG IMAGE ID CREATED SIZE
obpilot/oceanbase-ce latest 943379e0b05b 8 weeks ago 2.25GB
oceanbase/obce-mini latest 1a5ca6d233a7 5 months ago 690MB
frank@frank:~$ sudo docker run -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: libmariadb.so.3
[WARN] 127.0.0.1 oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e require: libaio.so.1
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!
frank@frank:~$ mycli -h172.17.0.2 -uroot@sys -P2881
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Anonymous
mysql root@sys@172.17.0.2:(none)> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
+--------------------+
7 rows in set
Time: 0.012s
mysql root@sys@172.17.0.2:(none)>
frank@frank:~$ mycli -h172.17.0.2 -uroot@sys -P2881
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Magnus udd
mysql root@sys@172.17.0.2:(none)> create resource unit ocp_unit min_cpu=3, max_cpu=3, min_memory=1073741824, max_memory=1073741824, max_iops=256, min_iops=128, max_disk_size=1000000000, max_session_num=64;
mysql root@sys@172.17.0.2:(none)> create resource pool ocp_frank unit='ocp_unit', zone_list=('zone1'), unit_num=1;
Query OK, 0 rows affected
Time: 0.010s
mysql root@sys@172.17.0.2:(none)> create tenant frank resource_pool_list = ('ocp_frank') set variables ob_compatibility_mode='mysql', ob_tcp_invited_nodes='%';
Query OK, 0 rows affected
Time: 1.002s
mysql root@sys@172.17.0.2:(none)>
frank@frank:~$ mycli -h172.17.0.2 -uroot@frank -P2881
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - zer09
mysql root@frank@172.17.0.2:(none)> create user ob_user identified by '123456';
Query OK, 0 rows affected
Time: 0.021s
mysql root@frank@172.17.0.2:(none)> exit
Goodbye!
frank@frank:~$ mycli -h172.17.0.2 -uob_user@frank -P2881 -p123456
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Angelo Lupo
mysql ob_user@frank@172.17.0.2:(none)>
frank@frank:~$ mycli -h172.17.0.2 -uroot@frank -P2881
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Chris Anderton
mysql root@frank@172.17.0.2:(none)> create database obtest;
Query OK, 1 row affected
Time: 0.023s
mysql root@frank@172.17.0.2:(none)> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| test |
| obtest |
+--------------------+
5 rows in set
Time: 0.007s
mysql root@frank@172.17.0.2:(none)> grant all privileges on *.* to 'ob_user'@'%' with grant option;
Query OK, 0 rows affected
Time: 0.018
frank@frank:~$ mycli -h172.17.0.2 -uob_user@frank -P2881 -p123456
mysql 3.1.0
mycli 1.20.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Matheus Rosa
mysql ob_user@frank@172.17.0.2:(none)> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| test |
| obtest |
+--------------------+
5 rows in set
Time: 0.008s
mysql ob_user@frank@172.17.0.2:(none)> use obtest;
You are now connected to database "obtest" as user "ob_user@frank"
Time: 0.005s
mysql ob_user@frank@172.17.0.2:obtest> CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT, c3 INT, c4 INT, INDEX k1(c2,c3));
Query OK, 0 rows affected
Time: 0.069s
mysql ob_user@frank@172.17.0.2:obtest> CREATE TABLE t2(c1 INT, c2 INT);
Query OK, 0 rows affected
Time: 0.050s
mysql ob_user@frank@172.17.0.2:obtest> INSERT INTO t2 VALUES(1, 1);
Query OK, 1 row affected
Time: 0.017s
mysql ob_user@frank@172.17.0.2:obtest> INSERT INTO t2 VALUES(3, 3);
Query OK, 1 row affected
Time: 0.005s
mysql ob_user@frank@172.17.0.2:obtest> INSERT INTO t2 VALUES(5, 5);
Query OK, 1 row affected
Time: 0.006s
mysql ob_user@frank@172.17.0.2:obtest> select * from t2;
+----+----+
| c1 | c2 |
+----+----+
| 1 | 1 |
| 3 | 3 |
| 5 | 5 |
+----+----+
3 rows in set
Time: 0.012s
由于使用PC环境虚拟机,整个过程主要的问题都集中在资源上,CPU、内存、硬盘在各实践阶段都出现了不同程度的问题,以下记录几个典型问题:
整个过程相对顺利,大部分遇到的问题都是资源问题,不得不说OB对资源的要求还是比较高的,想单机玩一玩需要注意资源上可能会遇到一些坑。通过以上的实践,对基本的OB安装、部署、创建租户/用户等操作有了一个比较直观的认识,后续还有很多内容值得学习,期待~~~