通过 OceanBase Docker 容器,快速的体验 OceanBase 的 自动化部署过程,以及了解 OceanBase 集群安装成功后的目录特点和使用方法。
1台OCP 5台OBSERVER
aarch64 Kylin Linux Advanced Server release V10 (Sword)
CPU 16核
内存 64G
磁盘划分(lvm、fdisk)
用途 实验环境
/docker docker安装目录 200G
/home ob的安装目录 100G
/data/1 数据盘 110G
/data/log1 日志盘(事务日志) 200G
ocp:
sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
# local clock
server 127.127.1.0
fudge 127.127.1.0 stratum 10
启动时钟服务器 Systemctl start chronyc
更新最新时钟 chronyc sources
cd /etc/sysconfig/network-scripts
cat ifcfg-enp1s0
ocp-ob-obp-odc-antman_20220506_arm/common/ssh/
vi address.txt 编辑IP、用户名、密码、hostname
./step1_init.sh
./step2_testlogin.sh
./step3_sethostname.sh
./step4_obssh.sh
1、安装t-oceanbase-antman
2、创建admin用户
/root/t-oceanbase-antman/clonescripts/clone.sh -u
3、配置内核参数(/etc/sysctl.conf)
/root/t-oceanbase-antman/clonescripts/clone.sh -c -r ocp
4、安装依赖包
/root/t-oceanbase-antman/clonescripts/clone.sh -m -r ocp
5、安装docker
/root/t-oceanbase-antman/clonescripts/clone.sh -i
6、上传docker镜像
docker load -i ocp323.arm.tar.gz
7、配置obcluster.conf文件
/root/t-oceanbase-antman/init_obcluster_conf.sh 选1
8、安装部署前预检查
/root/t-oceanbase-antman/clonescripts/precheck.sh -m ocp
9、安装
sh install.sh -i 1-8
wget https://download.docker.com/linux/static/stable/aarch64/docker-24.0.6.tgz
tar xf docker-24.0.6.tgz
mv docker/* /usr/bin/
dockerd
下载地址https://open.oceanbase.com/softwareCenter/community
Rpm –ivh ob-deploy-2.3.0-4.el7.aarch64.rpm
obd mirror clone obproxy-ce-4.2.0.0-7.el7.aarch64.rpm obproxy-ce-4.2.0.0-7.el7.aarch64.rpm libobclient-2.2.2-3.el7.aarch64.rpm
[root@ob1 obtools]# cat mini-distributed-with-obproxy-example.yaml
## Only need to configure when remote login is required
user:
username: root <===========
password: root <===========
# key_file: your ssh-key file path if need
# port: your ssh port, default 22
# timeout: ssh connection timeout (second), default 30
oceanbase-ce:
servers:
- name: z1
# Please don't use hostname, only IP can be supported
ip: 192.168.0.1 <===========
- name: z2
ip: 192.168.0.2 <===========
- name: z3
ip: 192.168.0.3 <===========
- name: z4
ip: 192.168.0.4 <===========
- name: z5
ip: 192.168.0.5 <===========
global:
# Please set devname as the network adaptor's name whose ip is in the setting of severs.
# if set severs as "127.0.0.1", please set devname as "lo"
# if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0"
devname: ens192 <===========
cluster_id: 1
# please set memory limit to a suitable value which is matching resource.
memory_limit: 8G
system_memory: 4G
stack_size: 512K
cpu_count: 16
cache_wash_threshold: 1G
__min_full_resource_pool_memory: 268435456
workers_per_cpu_quota: 10
schema_history_expire_time: 1d
# The value of net_thread_count had better be same as cpu's core number.
net_thread_count: 4
major_freeze_duty_time: Disable
minor_freeze_times: 10
enable_separate_sys_clog: 0
enable_merge_by_turn: FALSE
datafile_disk_percentage: 20
syslog_level: INFO
enable_syslog_recycle: true
max_syslog_file_count: 4
# observer cluster name, consistent with obproxy's cluster_name
appname: ob_cluster
root_password: 123456 <===========
proxyro_password: 123456 <===========
z1:
mysql_port: 2881
rpc_port: 2882
home_path: /root/observer
zone: zone1
z2:
mysql_port: 2881
rpc_port: 2882
home_path: /root/observer
zone: zone2
z3:
mysql_port: 2881
rpc_port: 2882
home_path: /root/observer
zone: zone3
z4:
mysql_port: 2881
rpc_port: 2882
home_path: /root/observer
zone: zone4
z5:
mysql_port: 2881
rpc_port: 2882
home_path: /root/observer
zone: zone5
obproxy:
servers:
- 192.168.0.1 <===========
global:
listen_port: 2883
prometheus_listen_port: 2884
home_path: /root/obproxy
# oceanbase root server list
# format: ip:mysql_port,ip:mysql_port
rs_list: 192.168.0.1:2881;192.168.0.2:2881;192.168.0.3:2881;192.168.0.4:2881;192.168.0.5:2881 <===========
enable_cluster_checkout: false
# observer cluster name, consistent with oceanbase-ce's appname
cluster_name: ob_cluster
obproxy_sys_password: 123456 <===========
observer_sys_password: 123456 <===========
obd cluster deploy ob-cluster -c ./mini-distributed-with-obproxy-example.yaml
obd cluster start ob-cluste
create resource unit mini max_cpu=5, min_cpu=5, max_memory='2G', min_memory='2G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='10G';
create resource pool mini_pool_t1 unit=mini ,unit_num=1;
create resource pool mini_pool_t2 unit=mini ,unit_num=1;
create tenant test charset='utf8mb4', replica_num=1,
zone_list=('zone1,zone2,zone3,zone4,zone5'), primary_zone='zone1,zone2;zone3,zone4;zone5',
resource_pool_list=('mini_pool_t1') set ob_tcp_invited_nodes='%';
create tenant test2 charset='utf8mb4', replica_num=1,
zone_list=('zone1,zone2,zone3,zone4,zone5'), primary_zone='zone1,zone2;zone3,zone4’zone5',
resource_pool_list=('mini_pool_t2') set ob_tcp_invited_nodes='%',
ob_compatibility_mode='oracle';
obclient –h192.168.0.2 -P2883 -uroot@test#admin:1673835228 –p
创建数据库
创建表