OceanBase Single-Node Deployment, Configuration, and Performance Comparison with MySQL
This article provides a comprehensive guide to installing and configuring OceanBase single-node (centralized) clusters, explains primary‑standby tenant architectures, details performance benchmarking against MySQL using sysbench and fio, and offers recommended resource settings and diagnostic procedures for optimal operation.
Introduction
OceanBase single-node (centralized) clusters are a lightweight database architecture without multi‑replica or scaling capabilities, suitable for development, testing, and low‑risk production environments. Both the community and enterprise editions support this deployment mode.
Installation Methods
Three deployment options are available:
All‑in‑One OBD package (recommended for lightweight deployment).
Manual command‑line installation.
OCP community platform deployment (suitable for larger scale and production).
All‑in‑One Package Deployment
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.shDisable Remote Repository
obd mirror disable remote
obd mirror list
# Verify that Type=remote Enabled is FalsePrepare Configuration File
cd ~/.oceanbase-all-in-one/obd/usr/obd/example/
cp mini-single-example.yaml mini-single-20240221.yaml
vim mini-single-20240221.yamlAdd the following parameters (excerpt):
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_123Deploy the Database
obd cluster deploy obtest -c mini-single-20240221.yamlOutput obtest deployed indicates successful creation.
Primary‑Standby Architecture
OceanBase single‑node supports primary‑standby tenant architecture with asynchronous data sync. Three deployment patterns are described:
Only a primary or only a standby tenant in the cluster.
Both primary and standby tenants coexist.
Primary and standby tenants reside in the same cluster.
Deployment steps using the OCP platform are illustrated, including adding hosts, uploading RPM packages, creating clusters, and configuring tenants.
Performance Benchmarking
Benchmarks compare OceanBase 4.2.2 single‑node with MySQL 8.0.35 on the same server using fio for disk I/O and sysbench for CPU. Key results:
Low‑concurrency workloads: OB performance ~50% lower than MySQL.
Mixed read/write on a 12c16g VM: OB performance comparable to MySQL.
Pure write on the same VM: OB ~15% faster than MySQL.
Disk I/O Test (fio)
# 4K seq read
fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kR -rw=read
# 4K seq write
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
# 4K rand read
fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kRR -rw=randread
# 4K rand write
fio -filename=/data/disktest/file -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=iotest4kRW -rw=randwriteCPU Test (sysbench)
[root@host ~]# /root/sysbench-1.0.20/src/sysbench cpu --time=60 --threads=4 --report-interval=2 runResource Configuration and Diagnostics
After deployment, the obdiag tool can inspect cluster health and provide recommendations. Example commands:
cd ~/oceanbase-all-in-one/rpms/
obd mirror clone oceanbase-diagnostic-tool-1.6.0-22024020410.el7.x86_64.rpm
obd obdiag deploy
obd obdiag check
cat ./check_report//check_report_observer_2024-02-27-14-16-19.tableTypical warnings include insufficient CPU/memory ratios and disk allocation issues.
Minimum Stable Environment
Recommended minimal specs:
Server: 2 CPU cores, >4 GB memory, 100 GB disk.
System tenant: 1 CPU, 2 GB memory.
Business tenant: 1 CPU, 1 GB memory.
# Example minimal config (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#Recommended Parameter Settings
Based on Sysbench results, the following system and tenant parameters improve performance:
# System parameters
alter system set __min_full_resource_pool_memory=1073741824;
alter system set large_query_threshold='600s';
alter system set enable_sql_audit=false;
alter system set enable_perf_event=false;
alter system set enable_record_trace_log=false;
alter system set syslog_level='INFO';
# Tenant parameters
alter system set ob_enable_batched_multi_statement=true;
alter system set log_transport_compress_all=true;
# Tenant variables
set global parallel_degree_policy=AUTO;
set global ob_sql_work_area_percentage=20;
set global ob_query_timeout=13888000000;
set global max_allowed_packet=41943040;Conclusion
The guide walks through end‑to‑end deployment of OceanBase single‑node clusters, demonstrates how to configure primary‑standby tenants, benchmark against MySQL, and tune resources for stable and high‑performance operation.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.