OceanBase Offline Installation
Summary
I’m sharing the offline installation document I wrote back in August. I may publish a series of usage documents afterward.
This article aims to run OceanBase for production workloads and deploys the distributed version. If you just want to test and try out OceanBase quickly, please refer to https://open.oceanbase.com/quickStart
Installation Flow

Preparation Before Installation
Before installation, all operations are performed as root. During the installation process, you can use the corresponding regular user.
Terminology
- OBD: OceanBase Deployer, the OceanBase deployment tool
- Control machine: the machine running the OBD installation package
- OBServer: the OceanBase database process/service running on each physical machine where OceanBase is installed
- OBProxy: OceanBase Proxy, OceanBase’s high-performance reverse proxy server. It offers features such as preventing connection drops, masking back-end anomalies (crashes, upgrades, network jitter), MySQL protocol compatibility, strong validation, hot upgrade support, and multi-cluster support.
Deployment Model
This example uses the classic three-replica deployment model with 4 machines:
- 1 machine deploys OBProxy – it’s recommended to deploy the client application together with OBProxy to reduce the initial network latency.
- A 1-1-1 deployment of a 3-replica OceanBase cluster, where each zone represents one replica. In this example, a zone contains only one machine. In production, the three zones are often deployed in a “two regions, three centers” model: three data centers with three replicas, one replica per data center, with two of the data centers located close to each other.
Software and Hardware Requirements
| Item | Description |
|---|---|
| OS | Red Hat Enterprise Linux Server 7.x (kernel Linux 3.10.0 or above) CentOS Linux 7.x (kernel Linux 3.10.0 or above) Anolis OS 8.x (kernel Linux 3.10.0 or above) |
| CPU | Enterprise users: minimum 16 cores, 32 cores or above recommended Personal testing: minimum 2 cores, 8 cores or above recommended |
| Memory | Enterprise applications: minimum 64G, 256G or above recommended Personal testing: minimum 8G, 64G or above recommended |
| Disk type | SSD recommended |
| Disk space | 4 times the memory size or more |
| File system | ext4 or xfs; use xfs when the data volume exceeds 16TB |
| NIC | Gigabit interconnect or above |
Set Up Passwordless SSH Login
Before installation, you need to configure the environment on each machine. These settings must all be done as the superuser. It is recommended to set up trusted login (i.e., passwordless login) from the control machine to the OBServer and OBProxy machines. For how to set up passwordless SSH login, see https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/optional-set-password-free-ssh-logon
Two scripts are recommended to make it easy to run commands and copy files in batches across the cluster.
Batch copy files; you can replace the host list with your own actual machine list.
1 | #/usr/bin/bash |
Batch run commands; you can replace the host list with your own actual machine list.
1 | /usr/bin/bash |
Create the Operating User
For personal testing, you can use the root account directly. For enterprise users, it’s recommended to create a regular user to avoid security impact on the system. In this example, admin is used as a demonstration; enterprise users can use whatever account they typically use as needed.
1 | useradd -U admin -d /home/admin -s /bin/bash |
Set the password
1 | passwd admin |
Set sudo privileges
vi /etc/sudoers # add a line for oceanbase
1 |
|
Disk Planning
The OceanBase database server relies on 3 directories. For personal testing, you can put all data on a single disk, but for enterprise users you must mount 3 separate disks: the data disk, the transaction log disk, and the OBServer installation disk. When a machine doesn’t have 3 disks, or when using a RAID array, you need to partition the disk or the logical volume of the disk array into 3 partitions. For partition sizes, refer to the notes below:
Data disk
- The configuration parameter is data_dir. Plan the data disk well according to business needs. The data disk holds the baseline data; physically there is only one baseline data file, block_file, under the installation directory store/sstable. It is created in one shot when the OBServer process starts, with its size pre-allocated based on the startup parameter datafile_disk_percentage (default 95%), and it cannot be resized after creation. OceanBase scales out and in by adding and removing machines; single-node disk-level scale-up and scale-down are not currently supported.
Transaction log disk
- The configuration parameter is redo_dir. The recommended size is 3 to 4 times the OBServer memory or more. The transaction log disk contains multiple fixed-size small files, located in the installation directory store/{clog,ilog,slog}, automatically created and cleaned on demand. When the disk fills to 80%, self-cleanup logic is triggered, but only on the premise that the in-memory data corresponding to this log data has already been merged into the baseline data, allowing it to be deleted. For the same amount of data, the transaction log size is roughly three times the size of the in-memory data. So the upper limit of space required by the transaction log disk is proportional to the total business data between two merge operations. The empirical formula is: transaction log file size = 3 to 4 times the upper limit of incremental data in memory.
OBServer installation disk
- The configuration parameter is home_path. The recommended size is 200G or above (to keep 7 days or more of logs). The OceanBase rpm package installation directory is under /home/admin/oceanbase, where the baseline data file and transaction log file are linked via symbolic links to the two separate disks described above. There is also another continuously growing file, the OB runtime log, under the installation directory log. The OB process itself cannot self-delete the runtime logs; a scheduled task or operations script is needed to handle the deletion logic.
After partitioning the disks, you can check with the df -h command. The result is as follows:

In this example: /data is the data disk, 1TB in size; /redo stores the redo logs; /home/admin/oceanbase stores the OceanBase binary and runtime logs.
Check directory permissions
1 | ls –al # run this command |
Pre-check
For enterprise users, it’s recommended that the hardware configuration and software configuration (operating system, OS kernel, glibc, python, and other packages) of all machines running OBServer be consistent, and that the OBProxy machines and OBServer machines have consistent software configuration (operating system, OS kernel, glibc, python, and other packages).
Check the Operating System
The currently supported operating systems are:
Red Hat Enterprise Linux Server 7.x (kernel Linux 3.10.0 or above)
CentOS Linux 7.x (kernel Linux 3.10.0 or above)
- Log in to the server as the root user
- Check the OS version
RedHat7 displays as follows:
1 | [root@redhat-04 /root]#cat /etc/redhat-release |
CentOS7 displays as follows:
1 | [root@centos-01 /root]#cat /etc/redhat-release |
On an Anolis system:
1 | [root@anolis ~]# cat /etc/os-release |
Other systems, such as Debian9, display as follows:
1 | root@ob001:~# cat /etc/os-release |
On an Ubuntu system:
1 | NAME="Ubuntu" |
For some systems, such as Ubuntu/Debian, you need to install yum:
1 | sudo apt-get update |
- Check the kernel version. The OS is required to be 3.10.0 or above.
1 | [root@centos-01 /root]#uname -r |
Check Memory
1 | free -g |
Enterprise applications: minimum 64G, 256G or above recommended.
If free -g

shows that the memory in the free column is less than the memory_limit configured in the configuration file, you need to clear the cache or modify the memory_limit configuration so that memory_limit is smaller than the value in the free column. The cache-clearing operation is as follows:
1 | # echo 3 > /proc/sys/vm/drop_caches |
Check Disks
Make sure that the disks corresponding to data_dir, redo_dir, home_path in the configuration file have been mounted, that the directories corresponding to data_dir and redo_dir are empty, and that the disk usage of the directory corresponding to data_dir is below 4%.

Check the NIC Name

In the configuration file there is a configuration item “devname” that needs to specify the NIC. When starting the OBServer service, you need to specify the NIC with the “-i” parameter. A server may have multiple NICs and multiple IPs, and OBServers communicate with each other relying on the specified NIC and IP. You can use the ifconfig command to view the NIC name (you need to install the net-tools dependency package first); just make sure a valid NIC exists.
In this example:

Configure limits.conf
ulimit is used to limit the resources used by processes started by the shell. For personal testing you can skip this, but enterprise users must set it.
There are two ways to modify resource limits: one is to specify them at the session level at startup, and the other is to modify the /etc/security/limits.conf configuration file, which takes effect globally.
The limits involved by the OBServer process include the maximum thread stack space size (stack), the maximum number of file handles (open files), and the core file size (core file size).
As shown below, when starting the OBServer process, set the maximum stack space size to unlimited, the maximum number of file handles to 655350, and the core file size to unlimited, all at the session level.
1 | $vi /etc/security/limits.conf add |
Exit the current session and log in again.
Check whether the configuration has taken effect
1 | ulimit -a |
Configure the “sysctl.conf” File
To ensure OceanBase runs properly, please modify the “/etc/sysctl.conf” configuration on all physical machines before installing OceanBase (to improve Linux system performance).
Some parameters have already been set by the operating system in advance.
1 | # for oceanbase |
Here, in “kernel.core_pattern = /data/core-%e-%p-%t”, /data is the data directory of OceanBase. In addition, for personal testing you can also set only “fs.aio-max-nr=1048576”.
1 | # Make the configuration take effect |
Disable the Firewall and SELinux
Personal testing can skip this, but it’s recommended for enterprise users.
Disable firewalld
1 | # Run these 3 commands in order |
Disable SELinux
vi /etc/selinux/linux
1 |
|
Run this command
1 | setenforce 0 |
Set Up Clock Synchronization
You can skip setting up clock synchronization in any of the following situations:
- The NTP clock is already in sync
- Deployed as a standalone version
- Personal testing
The time on each server in an OceanBase cluster must stay consistent; otherwise, the OceanBase cluster will fail to start and faults will occur at runtime. For enterprise users, clock synchronization is extremely important. A deviation of under 50ms between the physical machine and the time server can be considered in sync, and the maximum tolerated deviation cannot exceed 200ms. When it exceeds 200ms, a no-leader situation occurs; after restoring clock synchronization, restarting the observer can recover the state.
Check Clock Synchronization
1 | sudo clockdiff $IP |
Configure Clock Synchronization
Installation
Installation Package Components
Download all installation packages from https://open.oceanbase.com/softwareCenter/community. The package versions shown in this article may already be outdated, so please download the latest version of the packages from the open-source OceanBase official site.

If your machine can access the public network and add a third-party YUM software source, you can run the following commands to install OBD using OceanBase’s official software source:
1 | sudo yum install -y yum-utils |
scp all the software packages to the control machine.
Install OBD
Currently using the root user; this operation is performed only on the control machine.
Online Installation
1 | yum install -y ob-deploy |
Local Installation
CentOS or RedHat
1 | yum install ob-deploy-1.1.0-1.el7.x86_64.rpm |
Ubuntu/Debian
1 | alien -i ob-deploy-1.1.0-1.el7.x86_64.rpm |
Install OBLibs
Currently using the root user; this needs to be run on every machine.
Online Installation
1 | yum install -y oceanbase-ce-libs |
Local Installation
First copy oceanbase-ce-libs-3.1.0-3.el7.x86_64.rpm to each machine.
CentOS or RedHat or Anolis
1 | yum install oceanbase-ce-libs-3.1.0-3.el7.x86_64.rpm |
Ubuntu/Debian
1 | alien -i oceanbase-ce-libs-3.1.0-3.el7.x86_64.rpm |
Install OBServer & OBProxy
Switch to the admin user.
Add the OceanBase Database Offline Software Packages to the Local Mirror
1 | admin@obdriver:/data/rpm$ obd mirror clone *.rpm |
1 | admin@obdriver:~$ obd mirror list local |
Download the Configuration Files
Download all the configuration files from https://github.com/oceanbase/obdeploy/tree/master/example/autodeploy
There are several configuration files:
- distributed-example.yaml : distributed example
- distributed-with-obproxy-example.yaml : distributed example with obproxy
- single-example.yaml : standalone example
- single-with-obproxy-example.yaml : standalone example
In this example, we use the distributed example, and we scp the distributed configuration file to the control machine.
Modify the Configuration File
In this example, distributed-with-obproxy-example.yaml is used.
1 | ## Only need to configure when remote login is required |
1 | ## Only need to configure when remote login is required |
Modify the username and password.
Usually these few variables need to be set by hand: each machine’s ip, home_path, data_dir, and redo_dir. In this example, they are changed to /home/admin/oceanbase/ob, /data/ob, and /redo/ob respectively, corresponding to the disks mounted earlier.
1 | oceanbase-ce: |
Configure the proxy, modifying the ip and home_path.
1 | obproxy: |
Additionally, here’s a recommended site https://www.bejson.com/validators/yaml_editor/ that can run YAML validation on the configuration file. Quite often a configuration file has one extra space or one space too few, which is extremely hard to spot.
Start the Installation
For offline installation, there’s one extra step. When you can’t reach the server, you need to delete the remote repo configuration to avoid wasting time on connecting to the remote repo.
1 | rm -fr ~/.obd/mirror/remote/*.repo |
Start the installation
1 | admin@obdriver:~$ obd cluster autodeploy obtest -c distributed-with-obproxy-example.yaml |
Check whether the installation succeeded
1 | admin@obdriver:~$ obd cluster list |
1 | admin@obdriver:~$ obd cluster display obtest |
Modify the Configuration
The OceanBase database has hundreds of configuration items, and some of them are coupled. Before you’re familiar with the OceanBase database, it’s not recommended to modify the settings in the example configuration file. This example is meant to illustrate how to modify a configuration and make it take effect.
For an introduction to all parameters, please refer to
1 | https://github.com/oceanbase/obdeploy/blob/master/plugins/oceanbase/3.1.0/parameter.yaml |
1 | # Use the edit-config command to enter edit mode and modify the cluster configuration |
Verification
Install obclient
obclient is usually installed on the control machine; you need to switch to the root account.
Online Installation
1 | yum install -y libobclient |
Local Installation
CentOS or RedHat or Anolis
1 | yum install libobclient-2.0.0-2.el7.x86_64.rpm |
Ubuntu/Debian
1 | alien -i libobclient-2.0.0-2.el7.x86_64.rpm |
On Debian, you need to add the path to the system environment variable
1 | export PATH=/app/mariadb/bin:$PATH |
On Ubuntu, you need to add the path to the system environment variable
1 | export PATH=/u01/obclient/bin:$PATH |
Install the MySQL Development Packages
If you need to run programs like sysbench or tpch, you need to install the MySQL development packages.
CentOS or RedHat or Anolis
1 | yum install mariadb |
Ubuntu
1 | apt-get install mariadb-server |
Debian
1 | apt-get install mysql-server mysql-client libmariadbd18 libmariadbd-dev |
Check Tenants
To use OceanBase, you need to create a tenant; real user applications must run under a tenant.
There are 2 ways to create a tenant:
You can use obd to create a tenant. When you create a tenant with obd, it allocates all the resources.
1 | obd cluster tenant create ${cluster_name} -n ${tenant_name} |
To create a tenant, please refer to
https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/create-a-user-tenant
In this example:
1 | admin@obdriver:~$ mysql -h${obproxy_ip} -P${obproxy_port} -uroot |
Best Practices for Enterprise Users
Disks
The OB runtime logs, transaction logs, and data files must be kept separate. If there aren’t 3 disks available, you can partition one disk into 3 partitions.
Clock Dependency
The time on each server in an OceanBase cluster must stay consistent; otherwise, the OceanBase cluster will fail to start and faults will occur at runtime. For enterprise users, clock synchronization is extremely important. A deviation of under 50ms between the physical machine and the time server can be considered in sync, and the maximum tolerated deviation cannot exceed 200ms. When it exceeds 200ms, a no-leader situation occurs; after restoring clock synchronization, restarting the observer can recover the state.
Network Latency
The network latency between servers cannot exceed 200ms; otherwise, synchronization will lag severely and elections may be affected.
NIC settings:
It’s recommended to configure two 10-gigabit NICs in bond mode named bond0, using either mode1 or mode4. mode4 is recommended; if using mode4, the switch needs to be configured with 802.3ad. For NIC names, it’s recommended to use eth0 and eth1. It’s recommended to use the network service rather than NetworkManager.
Parameter Settings
- When the system write TPS is too high and exceeds the system’s capacity, to prevent the system from becoming unresponsive
1 | alter system set writing_throttling_trigger_percentage=75 tenant=all(or a specific tenant name); |
- Unless the business application is configured with reconnection retries, it’s recommended to disable rotating merge, since switching leaders cannot guarantee transactions won’t be killed
1 | ALTER SYSTEM SET enable_merge_by_turn = 'False'; |
- Memory settings
- The tenant’s CPU-to-memory ratio is recommended to be no lower than 1:4; otherwise OOM is likely;
- The minimum memory spec for a regular tenant is tentatively set to 5G or above;
- When a tenant’s memory is too small, it’s recommended to increase ob_sql_work_area_percentage (default 5%); for tenants with less than 10G of memory, configuring around 20% is recommended;
- Partition count limit: it’s recommended not to exceed 100,000 partitions per machine. In addition, the partition count is limited by memory; each replica reserves 168KB of memory, so 10,000 replicas require at least 1.68G of reserved memory. In other words, a 1G tenant can create at most around 6k partitions, so you need to set the tenant memory based on the planned number of partitions; also per-machine.
- Physical memory usage limit, default 80, the percentage of memstore memory available. It’s recommended to set it to 90 for servers with 256G of memory or more, and keep the default 50 for less than 256G.
1 | ALTER SYSTEM SET memstore_limit_percentage = '90'; |
- Slow query threshold adjustment: trace_log_slow_query_watermark defaults to 100ms and can be adjusted based on business characteristics. If the threshold is set too small, printing a large number of trace logs will affect performance. The MySQL default is 1s. The large query time is 10s.
1 |
|
- CPU concurrency adjustment
1 | -- CPU concurrency parameter, recommended to set to 4, and 2 for arm systems |
- Minor freeze / merge related
1 | -- Configure 50 minor freezes |
- Transaction related
1 | ALTER SYSTEM SET clog_sync_time_warn_threshold = '1s'; |
- Partition migration speed control. If the cluster load is very low, you can speed up partition migration by increasing the number of concurrent tasks; increase the migration concurrency
1 | alter system set data_copy_concurrency=40; |
- Compression related
1 | -- (the default is already zstd_1.0, no need to modify), but the system supports multiple compression algorithms |
- Cache refresh related
1 | ALTER SYSTEM SET autoinc_cache_refresh_interval = '43200s'; |
- Prepared statement: server-side ps is controlled by the _ob_enable_prepared_statement switch. Except for objdbc and oci users who can use server-side ps following the instructions in the documentation, it’s not recommended in other cases;
1 | -- Prepared Statement parameter, recommended to set to 0 for setups not building connections with Java |
- System related
1 | ALTER SYSTEM SET server_permanent_offline_time = '7200s'; |
- Cluster upgrade strategy: when performing a version upgrade or temporarily taking machines online/offline, you can first perform a minor freeze, which can reduce the recovery time when starting the observer
- Best strategy for bulk-importing large amounts of data: if the cluster is multi-tenant and a tenant needs to bulk-import data, to avoid affecting other tenants, you can restore the following two parameters after the import is done:
- Adjust cpu_quota_concurrency = 1 to prevent CPU contention between tenants
- Enable multi-round minor freezes to reduce merge triggers, which can improve import speed
- Tenant primary_zone configuration
- Set primary_zone to a specific zone. Applicable scenario: the business uses a single table, zone_name1 is in the same data center as the application, and zone_name2 and zone_name3 serve as follower replicas with no business traffic normally. The specific zone order should follow the data center priority and be configured according to the application’s and ob’s data center setup.
1 | ALTER TENANT SET PRIMARY_ZONE = 'zone_name1;zone_name2,zone_name3'; |
- Spread primary_zone across all full-featured zones. Usage scenario: the business uses partitioned tables, all replicas in the cluster are in the same data center, or the network latency between zones’ data centers is within 1ms, and all replicas are needed
1 | ALTER TENANT SET PRIMARY_ZONE = 'zone_name1,zone_name2,zone_name3'; |
Tenant Settings
- Concurrency settings
1 | -- Maximum concurrency, default 32. For businesses with large queries, it's recommended to set it to 128 |
- Recycle bin settings
1 | -- Recycle bin parameter. In scenarios with very frequent DDL execution, this must be disabled to avoid abnormal tenant performance caused by too much DDL execution |
- Client command length: the length of commands the OB client can send is limited by the tenant system variable max_allowed_packet (default 4M); you can increase it as appropriate;
obproxy Configuration
- obproxy liveness probing
1 | alter proxyconfig set sock_option_flag_out = 2; -- 2 stands for keepalive |