Guide to Expanding an OceanBase Cluster: Adding Zones and Resources
This article provides a step‑by‑step guide for scaling an OceanBase cluster, covering both white‑screen and black‑screen methods to add zones (replicas) and resources (OBServers), including configuration file preparation, deployment commands, zone addition, verification queries, and procedures for both expansion and contraction.
1. Environment Description
Cluster expansion can be done by expanding replicas (zones) or resources (OBServers). The original deployment mode is 1‑1‑1.
2. White‑screen Expansion
To expand replicas: OCP → target cluster → Overview → Add zone.
To expand resources: OCP → target cluster → Overview → Add OBServer.
3. Black‑screen Expansion
3.1 Expand Replicas (Zone)
Automated expansion using OBD:
vi /data/5zones.yaml
# Only need to configure when remote login is required
user:
username: admin
#password: admin
key_file: /home/admin/.ssh/id_rsa.pub
#port: your ssh port, default 22
# timeout: ssh connection timeout (second), default 30
oceanbase-ce:
servers:
# Please don use hostname, only IP can be supported
- name: observer4
ip: 10.186.60.175
- name: observer5
ip: 10.186.60.176
global:
......
appname: ywob2
......
observer4:
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
home_path: /home/admin/oceanbase-ce
data_dir: /data
redo_dir: /redo
zone: zone4
observer5:
mysql_port: 2881
rpc_port: 2882
home_path: /home/admin/oceanbase-ce
data_dir: /data
redo_dir: /redo
zone: zone5Deploy the cluster:
obd cluster deploy ywob2 -c 5zones.yamlMerge configuration, start the original cluster, and add new zones:
obd cluster start ywob
+------------------------------------------------+
| observer |
+--------------+---------+------+-------+--------+
|ip | version | port | zone | status |
+--------------+---------+------+-------+--------+
|10.186.60.85 | 3.2.2 | 2881 | zone1 | active |
|10.186.60.173 | 3.2.2 | 2881 | zone2 | active |
|10.186.60.174 | 3.2.2 | 2881 | zone3 | active |
+------------------------------------------------+Check processes, add new nodes, and verify:
mysql> alter system add zone 'zone4' region 'sys_region';
mysql> alter system add zone 'zone5' region 'sys_region';
mysql> alter system start zone 'zone4';
mysql> alter system start zone 'zone5';
mysql> alter system add server '10.186.60.175:2882' zone 'zone4';
mysql> alter system add server '10.186.60.176:2882' zone 'zone5';
mysql> alter system start server '10.186.60.175:2882' zone 'zone4';
mysql> alter system start server '10.186.60.176:2882' zone 'zone5';
obd cluster display ywob
+------------------------------------------------+
| observer |
+--------------+---------+------+-------+--------+
|ip | version | port | zone | status |
+--------------+---------+------+-------+--------+
|10.186.60.85 | 3.2.2 | 2881 | zone1 | active |
|10.186.60.173 | 3.2.2 | 2881 | zone2 | active |
|10.186.60.174 | 3.2.2 | 2881 | zone3 | active |
|10.186.60.175 | 3.2.2 | 2881 | zone4 | active |
|10.186.60.176 | 3.2.2 | 2881 | zone5 | active |
+------------------------------------------------+For tenant data‑replica expansion, follow the same steps; to shrink, remove nodes and adjust locality.
3.2 Expand Resources (OBServer)
Install and start observer processes on new hosts (example for 10.186.60.175, .176, .177):
su - admin
sudo rpm -ivh /tmp/oceanbase-ce-*.rpm
cd ~/oceanbase && bin/observer -i eth0 -p 2881 -P 2882 -z zone1 \
-d ~/oceanbase/store/ywob \
-r '10.186.65.85:2882:2881;10.186.60.173:2882:2881;10.186.60.174:2882:2881;10.186.60.175:2882:2881;10.186.60.176:2882:2881;10.186.60.177:2882:2881' \
-c 20230131 -n ywob \
-o "memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=12,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/ywob/etc3;/redo/ywob/etc2"
... (similar commands for other zones)Verify processes and ports, add new servers to zones, and check cluster status with SQL queries such as:
select zone,svr_port,inner_port,with_rootserver,status from __all_server order by zone, svr_ip;3.3 Shrink Resources (OBServer)
Reduce the cluster from a 2‑2‑2 to a 1‑1‑1 configuration by decreasing unit numbers and deleting observers:
alter resource pool pool_yw1 unit_num = 1;
alter system delete server '10.186.60.175:2882' zone zone3;
alter system delete server '10.186.60.176:2882' zone zone2;
alter system delete server '10.186.60.177:2882' zone zone1;Check the final node list and tenant partition distribution to confirm data re‑balancing.
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.