zhinian@192 ~ % docker pull centos:7
zhinian@192 ~ % mkdir -p ~/Desktop/docker_test
zhinian@192 ~ % cd ~/Desktop/docker_test
zhinian@192 docker_test % mkdir script ob_rpm
zhinian@192 docker_test % touch Dockerfile
zhinian@192 ob_rpm % wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/oceanbase-ce-3.1.3-10100032022041510.el7.aarch64.rpm
zhinian@192 ob_rpm % wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/oceanbase-ce-libs-3.1.3-10100032022041510.el7.aarch64.rpm
zhinian@192 ob_rpm % wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/libatomic-8.3.1-2.1.1.el7.aarch64.rpm
zhinian@192 ob_rpm % wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/libobclient-2.0.1-3.el7.aarch64.rpm
zhinian@192 ob_rpm % wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/aarch64/obclient-2.0.1-2.el7.aarch64.rpm
zhinian@192 docker_test % ls -lrt ob_rpm
total 424152
-rw-r--r--@ 1 zhinian staff 148136 12 13 00:30 oceanbase-ce-libs-3.1.3-10100032022041510.el7.aarch64.rpm
-rw-r--r--@ 1 zhinian staff 35284 12 13 00:30 libatomic-8.3.1-2.1.1.el7.aarch64.rpm
-rw-r--r--@ 1 zhinian staff 38365872 12 13 00:30 oceanbase-ce-3.1.3-10100032022041510.el7.aarch64.rpm
-rw-r--r--@ 1 zhinian staff 859640 12 13 00:30 libobclient-2.0.1-3.el7.aarch64.rpm
-rw-r--r--@ 1 zhinian staff 177748640 12 13 00:34 obclient-2.0.1-2.el7.aarch64.rpm
zhinian@192 script % vim mkdir_ob.sh
mkdir -p /home/admin/oceanbase/store/obtest/{sstable,clog,ilog,slog}
chown -R admin:admin /home/admin/oceanbase
zhinian@192 script % vim mkdir_ob.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/oceanbase/lib' >> ~/.bash_profile
source ~/.bash_profile
cd ~/oceanbase && bin/observer -i lo -p 2881 -P 2882 -z zone1 -d ~/oceanbase/store/obtest -r '127.0.0.1' -c 1 -n obtest -o "memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=4G,memory_chunk_cache_size=128M,cpu_count=16,net_thread_count=4,datafile_size=10G,stack_size=1536K"
zhinian@192 docker_test % vim Dockerfile
FROM centos:7
RUN useradd -ms /bin/bash admin
ADD ./ob_rpm/*.rpm /opt/ob_rpm/
RUN yum install -y /opt/ob_rpm/*.rpm && yum clean all && rm -rf /opt/ob_rpm
COPY ./script/mkdir_ob.sh /home/admin
RUN sh /home/admin/mkdir_ob.sh
USER admin
COPY ./script/init_ob.sh /home/admin
WORKDIR /home/admin
RUN sh /home/admin/init_ob.sh
CMD ["/bin/bash"]
zhinian@192 docker_test % mv obce-3.1.3-for-mac-m1-v1 Dockerfile
zhinian@192 docker_test % docker run -itd --name obce-3.1.3-bp1 --privileged obce-3.1.3-for-mac-m1-v1
2b5d75e03403bc8bd5bff1ed6cd7c3e87305e256dd2624b6510097cfdb25679c
docker exec -it obce-3.1.3-bp1 /bin/bash
sh init_ob.sh
[admin@2b5d75e03403 ~]$ obclient -h127.0.0.1 -P2881 -uroot -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 3221225472
Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:17)
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)]> set ob_query_timeout=100000000000;
Query OK, 0 rows affected (0.002 sec)
MySQL [(none)]> alter system bootstrap ZONE 'zone1' SERVER '127.0.0.1:2882';
Query OK, 0 rows affected (14.895 sec)
MySQL [(none)]> select version();
+--------------------+
| version() |
+--------------------+
| 3.1.3-OceanBase CE |
+--------------------+
1 row in set (0.001 sec)
测试登录
设置密码
SET PASSWORD = PASSWORD('xxx');
参考
如何在MAC M1玩OceanBase
关于Docker中failed to solve with frontend dockerfile.v0: failed to read dockerfile:报错
Navicat 现已支持 OceanBase 企业版
OceanBase 社区版图形化客户端推荐
噗…
# 根据当前容器部署最大规格的实例
docker run -p 2881:2881 --name obstandalone -d oceanbase/oceanbase-ce
## 部署 mini 的独立实例
docker run -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d oceanbase/oceanbase-ce
$ docker logs obstandalone | tail -1
boot success!
docker exec -it obstandalone ob-mysql sys # 连接 sys 租户的 root 用户
docker exec -it obstandalone ob-mysql root # 连接 test 租户的 root 用户
docker exec -it obstandalone ob-mysql test # 连接 test 租户的 test 用户
set password = Password('your password');
参考: 安装OB navicat连接ob
Navicat连接OB成功!