1. 下载一个 all-in-one 包,约330M
wget https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/7/x86_64/oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1679311481&OSSAccessKeyId=LTAI5tGVLeRRycCRGerZJMNC&Signature=eBZoWUq8bsRExzF4Zx8ZBkcbnIM%3D
2.重命名mv A B
MV oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1679311481
oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz
3.解压压缩包
tar -zxvf oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz
4.cd oceanbase-all-in-one 执行bin/install.sh
5.source ~/.oceanbase-all-in-one/bin/env.sh 然后执行 obd demo
这个步骤可能报错可能内存,磁盘/内存不足,修改一下重新执行obd demo ,看ok就通过
检测OBD是否安装成功
执行 which obd 和 which obclient 检测是否安装成功,如果可以找到 obd 和 obclient 则表示安装
[root@test .obd]# which obd
/root/.oceanbase-all-in-one/obd/usr/bin/obd
[root@test .obd]# which obclient
/root/.oceanbase-all-in-one/obclient/u01/obclient/bin/obclient
6.登录 OceanBase,建立资源单元 unitfish 绑定资源池 poolfish,poolfish 再与租户 tenantfish 完成映射。
obclient -h127.0.0.1 -P2881 -uroot
use oceanbase;
创建15个CPU,3G内存的资源单位unitfish
CREATE RESOURCE UNIT unitfish MAX_CPU 15, MEMORY_SIZE '3G', MAX_IOPS 1280,LOG_DISK_SIZE '10G', MIN_IOPS=1024;
资源单位unitfish绑定资源池poolfish
CREATE RESOURCE POOL poolfish UNIT = 'unitfish', UNIT_NUM = 1,ZONE_LIST = ('zone1');
资源池poolfish绑定租户tenantfish
create tenant tenantfish resource_pool_list=('poolfish'), charset=utf8mb4, replica_num=3, zone_list('zone1'), primary_zone=RANDOM, locality='F@zone1' set variables ob_compatibility_mode='mysql', ob_tcp_invited_nodes='%';
SELECT unit_config_id,name,max_cpu,min_cpu,memory_size/1024/1024/1024 FROM __all_unit_config;
7. 以 root 的身份登录租户 tenantfish,创建用户名和密码,并授权访问。
obclient -h IP -uroot@tenantfish -P2883 -c -A oceanbase
查看仓库的 RPM 列表
obd mirror list local
obd mirror list
使用 cluster + list 命令来显示我们安装的 OceanBase的数据库,obd cluster list 会把我们本机部署的zone节点都展示出来,我们根据所需要对节点进行启动或停止即可
#obd cluster start 本机部署的zone节点
obd cluster start demo
如果关闭的话也很简单,可以使用 obd cluster stop oceanbase 即可
端口是否开启
netstat -an|grep 2883
ps -ef | grep oceanbase