引言
OceanBase 单机集中式集群(即单机版,后文不再称“单机集中式集群”)是OceanBase 推出的极简数据库架构,区别于分布式集群架构,单机版无多副本和扩缩容能力,适用于开发测试环境及数据安全性要求不高的业务系统。
OceanBase 社区版和企业版都支持单机版部署,相关区别如下。
-
主备集群: OceanBase v4.1.0 之前,物理备库的产品形态为集群级主备。
集群有两种角色:主集群和备集群。主集群下面所有用户租户都是主租户;备集群下面所有用户租户都是备租户,备集群会自动同步主集群的租户变更操作。
-
主备租户: OceanBase v4.1.0 之后,物理备库的产品形态变更为租户级主备,即主或备的角色信息属于租户,分为主租户和备租户,集群不再有主备角色的概念,而只是承载租户的容器。
1安装部署
1.1 OceanBase 单机版部署方式
OceanBase 单机社区版部署方式有 3 种,分别是:
-
通过 OBD ALL-IN-ONE 包部署
- 推荐,轻量级部署,所需资源少(OBD 和 OceanBase 单机版数据库可复用1台服务器),方便快速
通过命令行方式部署
- 需纯手工命令行操作
通过 OCP 社区版平台部署
-
适合规模化部署,需要额外资源部署 OCP 云平台,运维方便
-
生产环境推荐
1.2 OceanBase 单机版最简部署
需要提前在 OceanBase 官网上下载 OBD all-in-one 安装包,下载地址:https://www.oceanbase.com/softwarecenter[1]
1. 通过 all-in-one 安装包部署 OBD 环境
su - admin
tar -xzf oceanbase-all-in-one-*.tar.gz
cd oceanbase-all-in-one/bin/
./install.sh
source ~/.oceanbase-all-in-one/bin/env.sh
2. 禁用远程仓库
obd mirror disable remote
obd mirror list
# 查看 Type=remote 对应的 Enabled 变成了 False,说明已关闭远程镜像源
3. 查看本地镜像中安装包列表
obd mirror list local
4. 准备配置文件
cd ~/.oceanbase-all-in-one/obd/usr/obd/example/
cp mini-single-example.yaml mini-single-20240221.yaml
vim mini-single-20240221.yaml
添加如下参数到配置文件。
user:
username: admin
password: OceanBase_123#
port: 22
oceanbase-ce:
servers:
- 10.186.58.87
global:
home_path: /home/admin/observer
data_dir: /data/1
redo_dir: /data/log1
devname: eth0
mysql_port: 2881
rpc_port: 2882
zone: zone1
cluster_id: 1
memory_limit: 12G
system_memory: 1G
datafile_size: 10G
datafile_next: 2G
datafile_maxsize: 20G
log_disk_size: 20G
cpu_count: 12
production_mode: false
enable_syslog_wf: false
enable_syslog_recycle: true
max_syslog_file_count: 4
root_password: OceanBase_123#
5. 部署 OceanBase 数据库
下述命令创建一个名字为 obtest 的单节点集群
obd cluster deploy obtest -c mini-single-20240221.yaml
输出 obtest deployed
表示该集群创建完成。
6. 配置 lib 环境变量
通过 OCP 社区版或 OBD 启动时不会有环境变量问题(启动时带了相关库),手工启动或执行 observer
命令将报错,解决方式如下。
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/observer/lib' >> ~/.bash_profile
source ~/.bash_profile
7. 检查和启动数据库
确认 observer 程序在目标机器安装成功。
/home/admin/observer/bin/observer --version
结果为 observer (OceanBase_CE 4.2.2.0)。
启动 OceanBase 数据库。
obd cluster start obtest
启动完成后,使用 root
登录数据库(默认登录 sys
租户)进行创建业务租户等操作。
mysql -h10.186.58.87 -P2881 -uroot -p'OceanBase_123#' -Doceanbase -A
show full processlist;
2主备架构
2.1 单机版主备租户简述
OceanBase 单机版支持主备租户架构,并采用异步方式做数据同步。由于 OceanBase 集群支持部署多个业务租户,所以主备租户架构有三种部署方式:
-
集群中仅有主租户或备租户
- 典型场景,适用于两地容灾等多种业务场景
-
集群中既有主租户又有备租户
- 适用于两地多写(容灾)场景
-
主租户和备租户在同一个集群中
- 适用于业务升级(保留数据镜像)场景
2.2 单机版主备租户部署
本章以经典架构(集群中仅有主租户或备租户)为例进行部署,部署方式使用相对简便的 OCP 社区版云平台进行部署。
2.2.1 部署 OCP 社区版
使用 OBD 白屏工具部署 OCP 社区版,具体步骤略。
-
安装包下载
-
https://www.oceanbase.com/softwarecenter
-
安装包:ocp-all-in-one-4.2.1-20231208144448.el7.x86_64.tar.gz
-
安装步骤
- 参考:https://www.oceanbase.com/docs/common-ocp-1000000000584989[2]
2.2.2 添加主备主机
OCP 社区版部署完成后,登录到 OCP Web 控制台,添加 2 台主备服务器。
2.2.3 安装两个集群
上传需要部署的 OceanBase 数据库安装包到 OCP 中,需要上传的包如下(具体版本以实际为准):
-
oceanbase-ce-utils-4.2.2.0-100000192024011915.el7.x86_64.rpm
-
oceanbase-ce-libs-4.2.2.0-100000192024011915.el7.x86_64.rpm
-
oceanbase-ce-4.2.2.0-100000192024011915.el7.x86_64.rpm
安装包上传完成后,分别创建 2 个单机集中式集群。
2.2.4 创建主备租户
第一步,集群 1 中创建示例主租户 tmysql
。
第二步,集群 2 中创建实例备租户 tmysql
。
2.2.5 数据同步验证
安装完成后可通过 OCP - 租户 - 拓扑图 界面验证主备关系,查看同步延时。
业务数据写入验证如下:
- 主库写入数据。
- 备库查看数据。
- 备库同步延时查看(需要使用备租户所在集群的
sys
租户)。
MySQL [oceanbase]> SELECT TENANT_NAME, TENANT_ID, TENANT_ROLE, SCN_TO_TIMESTAMP(SYNC_SCN),NOW() FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'tmysql';
+-------------+-----------+-------------+----------------------------+---------------------+
| TENANT_NAME | TENANT_ID | TENANT_ROLE | SCN_TO_TIMESTAMP(SYNC_SCN) | NOW() |
+-------------+-----------+-------------+----------------------------+---------------------+
| tmysql | 1004 | STANDBY | 2024-02-23 17:07:06.028739 | 2024-02-23 17:07:06 |
+-------------+-----------+-------------+----------------------------+---------------------+
1 row in set (0.02 sec)
2.2.6 故障切换验证
测试 OceanBase 单机版主备租户模式的高可用能力,检查是否支持故障转移。
- 主库 kill 前状态,
tmysql
租户主角色在集群 singlecluster 上。
- 主库 kill 后状态,异步同步链路中断。
- 通过手工进行容灾切换的方式进行故障转移。
- 手工容灾切换后,
tmysql
租户主角色切换到集群 singleClusterSlave。
3对比 MySQL 单机版
校正性能基准
3.1 测试命令
本章测试目的是在获取测试服务器 CPU、磁盘基准性能的情况下,对 OceanBase 4.2.2 单机(社区)版和 MySQL 8.0.35 单机(社区)版数据库性能对比测试环境和命令如下。
注意:为减少不同服务器之间误差,本次测试 MySQL 和 OB 数据库都在同一台服务器上进行测试,测试交替进行,MySQL 测试完毕后就关闭 mysqld 服务,启动 OB 数据库进行测试。
3.2 测试机基准测试
3.2.1 磁盘 FIO 测试
使用 Fio 工具测试服务器的磁盘性能指标如下。
-
4K seq read
- IOPS: 4975
-
4K seq write
- IOPS: 3919
-
4K rand read
- IOPS: 4768
-
4k rand write
- IOPS: 3074
# 4k seq read
[root@10-186-58-85 disktest]# fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kW -rw=read
fio-3.7
...
iops : min= 3822, max= 5786, avg=4975.06, stdev=262.95, samples=3591
...
# 4K seq write
[root@10-186-58-85 disktest]# fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kW -rw=write
...
iops : min= 2370, max= 5004, avg=3919.07, stdev=481.46, samples=3577
...
# 4K rand read
[root@10-186-58-85 data]# fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kW -rw=randread
...
iops : min= 3746, max= 5390, avg=4768.96, stdev=259.29, samples=3583
...
# 4K rand write
[root@10-186-58-85 data]# fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kW -rw=randwrite
...
iops : min= 784, max= 4416, avg=3074.03, stdev=636.20, samples=3574
...
3.2.2 CPU 测试
使用 Sysbench 工具测试服务器的 CPU 性能指标如下。
[root@10-186-58-85 ~]# /root/sysbench-1.0.20/src/sysbench cpu --time=60 --threads=4 --report-interval=2 run
...
CPU speed:
events per second: 16316.69
General statistics:
total time: 60.0011s
total number of events: 979033
Latency (ms):
min: 0.23
avg: 0.24
max: 40.26
95th percentile: 0.25
sum: 239493.26
Threads fairness:
events (avg/stddev): 244758.2500/1500.12
execution time (avg/stddev): 59.8733/0.01
3.3 4c8g 对比测试结果
同一服务器(配置为 4c8g)下测试 OB 和 MySQL 单机版的对比结果。
通过上述测试,在校准测试服务器性能偏差的情况下,对比 OceanBase 单机版和 MySQL 单机版的测试结果结论如下:
低并发场景,OB 单机版性能比 MySQL 单机版低 50% 左右。
3.4 12c16g 对比测试结果
同一服务器(扩容虚机配置为 12c16g)下测试 OB 和 MySQL 单机版的对比结果。
通过上述测试,在校准测试服务器性能偏差的情况下,对比 OceanBase单机版和 MySQL 单机版的测试结果结论如下
混合读写场景,OB 单机版性能与 MySQL 单机版持平(虚拟机多次测试结果上下差 ±2000 左右,所以该场景 OB 与 MySQL 的性能结果相差不大)。
纯写场景,OB 单机版性能与 MySQL 单机版略高 15% 左右。
4对比 OBD 自带测试工具
OBD test
命令可以一键进行 sysbench 测试,原理上还是需要调用 sysbench 测试工具的 bin 文件和 LUA Scripts,仅在最外层包装了一层 Python 脚本进行调用,调用文件存储在:/oceanbase-all-in-one/obd/usr/obd/plugins/sysbench/4.0.0.0/run_test.py
。
4.1 测试命令
4.2 测试结果
使用 OBD test sysbench 与 直接使用 sysbench 测试 OceanBase 单机版结果差不多,部分测试结果如下:
5OB 单机版资源配置
5.1 单机版集群配置巡检
本节适用于集群做 Sysbench 测试前,对单机版集群的资源规格和集群配置等做一轮巡检,已提供更好的性能表现。
本节适用于集群做 Sysbench 测试前,对单机版集群的资源规格和集群配置等做一轮巡检,已提供更好的性能表现。
在部署 OceanBase 单机版集群之后,可以使用 obdiag (OceanBase Diagnose )工具对部署好的集群巡检,步骤如下。
5.1.1 安装 obdiag 工具
Obdiag 工具在 OBD ALL-IN-ONE 包中已提供,可直接使用 obd
进行安装。
cd ~/oceanbase-all-in-one/rpms/
obd mirror clone oceanbase-diagnostic-tool-1.6.0-22024020410.el7.x86_64.rpm
obd obdiag deploy
5.1.2 巡检集群输出报告
odb obdiag check
# 巡检正常完成,会有如下提示:Check observer finished. For more details, please run cmd' cat ./check_report//check_report_observer_2024-02-27-14-16-19.table '
- 直接复制命令,粘贴执行即可查看配置建议。
[root@10-186-58-75 oceanbase-diagnostic-tool]# cat ./check_report//check_report_observer_2024-02-27-14-16-19.table
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| fail-tasks-report |
+-------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| task | task_report |
+-------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| sysbench.sysbench_free_test_network_speed | [fail] [remote:10.186.58.86] network_speed is and the type is , not int or float ordecimal ! |
+-------------------------------------------+--------------------------------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------+
| critical-tasks-report |
+-------------------------------------------+--------------------------------------------------------------------------------------------+
| task | task_report |
+-------------------------------------------+--------------------------------------------------------------------------------------------+
| sysbench.sysbench_free_test_cpu_count | [critical] [remote:10.186.58.86] cpu_count/os_cpu_count is 8%,is not between 80 and 100 |
| sysbench.sysbench_free_test_memory_limit | [critical] [remote:10.186.58.86] memory_limit/os_memory is 26%,is not between 80 and 100 |
| sysbench.sysbench_test_cluster_parameters | [critical] [cluster:obcluster] cluster's enable_perf_event is true , need to change False |
+-------------------------------------------+--------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| warning-tasks-report |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| task | task_report |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sysbench.sysbench_free_test_cpu_count | [warning] [cluster:obcluster] cpu_count is 2 , need to calculate the relationship between cpu_count and the number of system CPUs |
| sysbench.sysbench_test_cluster_datafile_size | [warning] [remote:10.186.58.86] When the data disk and log disk are on the same disk, the log disk needs to occupy more than 30% of the disk space. now it is 11% |
| | [warning] [remote:10.186.58.86] When the data disk and log disk are on the same disk, the data disk needs to occupy more than 60% of the disk space. now it is 5% |
| sysbench.sysbench_test_cluster_log_disk_size | [warning] [cluster:obcluster] log_disk_size 20G |
| sysbench.sysbench_test_tenant_cpu_parameters | [warning] [cluster:obcluster] cpu_count is 2. the min_cpu of tenant should cpu_count/2 ~ cpu_count. tenant: sys,trenzy need check |
| | [warning] [cluster:obcluster] the MAX_IOPS of tenant should max_cpu * 10000 ~ max_cpu * 1000000 . tenant: trenzy need check |
| | [warning] [cluster:obcluster] the MIN_IOPS of tenant should max_cpu * 10000 ~ max_cpu * 1000000 . tenant: trenzy need check |
| | [warning] [cluster:obcluster] cpu_count is 2. the max_cpu of tenant should cpu_count/2 ~ cpu_count. tenant: sys,trenzy need check |
| sysbench.sysbench_test_tenant_log_disk_size | [warning] [cluster:obcluster] log_disk_size 20G |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| all-tasks-report |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| task | task_report |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sysbench.sysbench_free_test_cpu_count | [critical] [remote:10.186.58.86] cpu_count/os_cpu_count is 8%,is not between 80 and 100 |
| | [warning] [cluster:obcluster] cpu_count is 2 , need to calculate the relationship between cpu_count and the number of system CPUs |
| sysbench.sysbench_free_test_memory_limit | [critical] [remote:10.186.58.86] memory_limit/os_memory is 26%,is not between 80 and 100 |
| sysbench.sysbench_free_test_network_speed | [fail] [remote:10.186.58.86] network_speed is and the type is , not int or float ordecimal ! |
| sysbench.sysbench_test_cluster_datafile_size | [warning] [remote:10.186.58.86] When the data disk and log disk are on the same disk, the log disk needs to occupy more than 30% of the disk space. now it is 11% |
| | [warning] [remote:10.186.58.86] When the data disk and log disk are on the same disk, the data disk needs to occupy more than 60% of the disk space. now it is 5% |
| sysbench.sysbench_test_cluster_log_disk_size | [warning] [cluster:obcluster] log_disk_size 20G |
| sysbench.sysbench_test_cluster_parameters | [critical] [cluster:obcluster] cluster's enable_perf_event is true , need to change False |
| sysbench.sysbench_test_cpu_quota_concurrency | all pass |
| sysbench.sysbench_test_log_level | all pass |
| sysbench.sysbench_test_sql_net_thread_count | all pass |
| sysbench.sysbench_test_tenant_cpu_parameters | [warning] [cluster:obcluster] cpu_count is 2. the min_cpu of tenant should cpu_count/2 ~ cpu_count. tenant: sys,trenzy need check |
| | [warning] [cluster:obcluster] the MAX_IOPS of tenant should max_cpu * 10000 ~ max_cpu * 1000000 . tenant: trenzy need check |
| | [warning] [cluster:obcluster] the MIN_IOPS of tenant should max_cpu * 10000 ~ max_cpu * 1000000 . tenant: trenzy need check |
| | [warning] [cluster:obcluster] cpu_count is 2. the max_cpu of tenant should cpu_count/2 ~ cpu_count. tenant: sys,trenzy need check |
| sysbench.sysbench_test_tenant_log_disk_size | [warning] [cluster:obcluster] log_disk_size 20G |
| sysbench.sysbench_test_tenant_primary_zone | all pass |
+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5.2 最低稳定运行环境
经过测试,OceanBase 单机版最少资源规格稳定运行所需的环境如下。
-
服务器规格
- CPU 2C,内存 5G(确保可用内存大于 4G),磁盘 100G
-
系统租户规格
- CPU 1G,内存 2G
-
业务租户规格
- CPU 1G,内存 1G
-
集群配置文件
# cat min-2c4g.yaml
user:
username: admin
password: OceanBase_123#
port: 22
oceanbase-ce:
servers:
- 10.186.56.101
global:
home_path: /home/admin/observer
data_dir: /data/1
redo_dir: /data/log1
devname: eth0
mysql_port: 2881
rpc_port: 2882
zone: zone1
cluster_id: 1
memory_limit: 4G
system_memory: 1G
datafile_size: 10G
datafile_next: 2G
datafile_maxsize: 20G
log_disk_size: 20G
cpu_count: 2
production_mode: false
enable_syslog_wf: false
enable_syslog_recycle: true
max_syslog_file_count: 4
__min_full_resource_pool_memory: 1073741824
root_password: OceanBase_123#
5.2.1 最低运行环境下启动 OB
部署的Linux服务器规格如下
[root@10-186-56-101 admin]# grep process /proc/cpuinfo
processor : 0
processor : 1
[root@10-186-56-101 admin]# free -m
total used free shared buff/cache available
Mem: 4797 2624 979 16 1194 1917
Swap: 0 0 0
[root@10-186-56-101 admin]# ps -ef | grep obs
admin 2636 1 29 07:25 ? 00:08:29 /home/admin/observer/bin/observer -r 10.186.56.101:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /data/1 -i eth0 -o __min_full_resource_pool_memory=1073741824,memory_limit=4G,system_memory=1G,datafile_size=10G,datafile_next=2G,datafile_maxsize=20G,log_disk_size=20G,cpu_count=2,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4
5.2.2 最低运行环境下 Sysbench 持续测试
[root@10-186-58-75 example]# sysbench /root/sysbench-1.0.20/src/lua/oltp_read_write.lua --tables=5 --table_size=1000 --mysql-host=10.186.56.101 --mysql-port=2881 --mysql-user='root@trenzy' --mysql-password='OceanBase_123#' --mysql-db=sbtest --report-interval=2 --time=3600 --threads=1 run
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 1
Report intermediate results every 2 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 2s ] thds: 1 tps: 37.42 qps: 749.45 (r/w/o: 524.42/149.69/75.34) lat (ms,95%): 42.61 err/s: 0.00 reconn/s: 0.00
...
[ 342s ] thds: 1 tps: 60.50 qps: 1215.48 (r/w/o: 851.48/243.00/121.00) lat (ms,95%): 24.38 err/s: 0.00 reconn/s: 0.00
[ 344s ] thds: 1 tps: 58.01 qps: 1159.20 (r/w/o: 812.14/231.04/116.02) lat (ms,95%): 23.95 err/s: 0.00 reconn/s: 0.00
注意:
- 业务规格为 1c1g 情况下,持续写入很容易打满内存。报如下错误,但不影响 observer 运行。
- 可以调整
alter system set memstore\_limit\_percentage=80;
将内存适度调大。
FATAL: mysql_stmt_execute() returned error 4013 (No memory or reach tenant memory limit) for query 'SELECT c FROM sbtest4 WHERE id BETWEEN ? AND ? ORDER BY c'
FATAL: `thread_run' function failed: /usr/local/share/sysbench/oltp_common.lua:432: SQL error, errno = 4013, state = 'HY001': No memory or reach tenant memory limit
FATAL: mysql_stmt_execute() returned error 4013 (No memory or reach tenant memory limit) for query 'SELECT c FROM sbtest2 WHERE id BETWEEN ? AND ? ORDER BY c'
5.3 单机版推荐参数配置
结合 Sysbench 性能压测,推荐的集群、租户的参数或变量设置如下(适应于性能要求较高的测试环境)。
- 集群参数配置
# 默认 2G,可创建 unit 的最小内存阈值,若不设置创建 1G 内存规格的 unit 将失败。
alter system set __min_full_resource_pool_memory=1073741824;
# 默认 5s,设置查询执行时间的阈值。超过时间的请求可能被暂停,暂停后自动被判断为大查询,执行大查询调度策略
alter system set large_query_threshold='600s';
# 默认 true,是否开启审计日志;开发或性能要求高的场景可关闭,生产环境需开启
alter system set enable_sql_audit=false;
# 默认 true,是否开启信息采集;开发或性能要求高的场景可关闭,生产环境需开启
alter system set enable_perf_event=false;
# 默认 true,是否开启 Trace Log 功能
alter system set enable_record_trace_log=false;
# 默认 WDIAG,系统日志的日志级别
alter system set syslog_level='INFO';
- 业务租户参数配置
# 默认 false,是否启用批处理功能的成组执行优化
alter system set ob_enable_batched_multi_statement=true;
# 默认 false,用于对日志传输是否使用压缩,建议开启减少网卡压力
alter system set log_transport_compress_all=true;
- 业务租户变量配置
# 默认 MANUAL,用于设置并行度选择策略。
set global parallel_degree_policy=AUTO;
# 默认 5,SQL 执行的租户内存百分比限制
set global ob_sql_work_area_percentage=20;
# 默认 10000000,设置 SQL 最大执行时间,单位是微秒
set global ob_query_timeout=13888000000;
# 默认 16777216,设置最大网络包大小,单位是 Byte
set global max_allowed_packet=41943040;
6附件
MySQL 配置文件
章节三对比测试中,用到的 MySQL 8.0.35 配置文件如下。
[mysql]
default-character-set = utf8mb4
user = root
password =
[mysqld]
# Basic Settings
server-id = 1019938001
port = 8001
pid-file = mysqld.pid
socket = mysqld.sock
mysqlx_socket = mysqldx.sock
character_set_server = utf8mb4
default_storage_engine = InnoDB
lower_case_table_names = 1
skip_name_resolve = 1
skip_external_locking = 1
skip_slave_start = 1
basedir = /data/mysql/8001/base
datadir = /data/mysql/8001/data
tmpdir = /data/mysql/8001/tmp
# P_S Settings
performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'
# Session Memory Settins
join_buffer_size = 2M
sort_buffer_size = 2M
tmp_table_size = 8M
max_heap_table_size = 8M
max_allowed_packet = 128M
# Global Memory and Cache Settings
temptable_max_ram = 1G
open_files_limit = 65535
max_connections = 1024
table_open_cache = 2048
# InnoDB Settings
innodb_buffer_pool_size = 8G
innodb_data_file_path = ibdata1:12M:autoextend
innodb_buffer_pool_instances = 1
innodb_file_per_table = 1
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_flush_log_at_trx_commit = 1
innodb_io_capacity = 2000
innodb_io_capacity_max = 10000
innodb_flush_method = O_DIRECT
innodb_strict_mode = 1
innodb_flush_neighbors = 1
innodb_page_cleaners = 8
innodb_purge_threads = 8
innodb_log_file_size = 1024M
innodb_log_buffer_size = 16777216
innodb_print_all_deadlocks = 1
innodb_sort_buffer_size = 67108864
# Log Settings
log_error = mysql-error.log
log_bin = mysql-bin.log
slow_query_log_file = mysql-slow.log
relay_log = mysql-relay.log
log_slave_updates = 1
sync_binlog = 1
relay_log_recovery = 1
binlog_format = row
binlog_expire_logs_seconds = 2592000
slow_query_log = 1
long_query_time = 3
log_slow_admin_statements = 1
log_slow_slave_statements = 1
# Replication Settings
slave_skip_errors = ddl_exist_errors
master_info_repository = TABLE
relay_log_info_repository = TABLE
gtid_mode = on
enforce_gtid_consistency = 1
binlog_gtid_simple_recovery = 1
binlog_rows_query_log_events = 1
slave-parallel-type = LOGICAL_CLOCK
slave-parallel-workers = 8
slave_preserve_commit_order = 1
binlog_group_commit_sync_delay=10000
binlog_group_commit_sync_no_delay_count=32
参考资料
[1]
OBD 安装包: https://www.oceanbase.com/softwarecenter
[2]
OBD 部署安装 OCP 社区版步骤: https://www.oceanbase.com/docs/common-ocp-1000000000584989