The running of an OBServer node relies on the data disk, clog disk, and installation disk where OceanBase Database is installed. If you are an individual user, you can put all the data on a single disk and skip this topic. If you are an enterprise user, we recommend that you mount your data to three separate disks.
If you do not have three disks for a server, or if you are using Redundant Array of Independent Disks (RAID), you need to partition the disk or disk array into logical volumes. The recommended partitioning method is as follows:
Data disk
The data disk is used to store baseline data, and its path is specified by the
data_dirparameter. When you start the OceanBase cluster for the first time,${data_dir}/{sstable,slog}will be created automatically. The size of the data disk is determined by parametersdatafile_disk_percentageanddatafile_size. Additionally, after deployment, you can perform dynamic expansion of disk files through thedatafile_nextanddatafile_maxsizeparameters. For more information, see Configure automatic scale-out of disk space for data files.Note
The current version of OceanBase Database supports separating
slogfrom the data disk, meaningslogand data files do not need to be on the same disk. For more information about the OceanBase installation directory, see Installation directory structure of an OBServer node.Clog disk
The path of the clog disk is specified by the
clog_dirparameter. We recommend that you set the size of the clog disk to 3 to 4 times or more of the memory for OceanBase Database. When you start the OceanBase cluster for the first time,${clog_dir}will be created automatically. The clog disk contains multiple fixed-size files, which can be automatically created and cleared based on your needs. Automatic clearance is triggered when the clog reaches 80% of the total disk capacity. However, the clog can only be deleted when the corresponding memory data has been merged into the baseline data.For a given size of memory data, the size of clog files is approximately three times larger. Therefore, the maximum space required for the clog disk is directly proportional to the total amount of data after two major compactions. You can use the empirical formula for evaluation: Size of clog files = Maximum memory space for incremental data × 3 or 4.
OceanBase Database installation disk
The path of the installation disk is specified by the
home_pathparameter. We recommend that you reserve at least 200 GB to save log files for 7 or more days. The RPM package of OceanBase Database is located in the${home_path}directory. The baseline data files and clog files are mapped to the preceding data disk and clog disk through soft links. The operational logs of OceanBase Database are located in the${home_path}/logdirectory. The number of operational logs will keep increasing because OceanBase Database cannot automatically delete them. Therefore, you need to regularly delete the operational logs.
Disk mounting
Mounting requirements
Disk mount point requirements for OceanBase Cloud Platform (OCP) servers are shown in the following table.
Mount point Size Purpose File system format /home 100 GB~300 GB Runtime log disk for components ext4 or xfs recommended /data/log1 3~4 times the memory allocated to observer OCP metadata database log disk ext4 or xfs recommended /data/1 Depends on the required data storage size OCP metadata database data disk ext4 or xfs recommended Disk mount point requirements for OBServer nodes are shown in the following table.
Directory Size Purpose File system format /home 100 GB~300 GB observer database installation disk ext4 or xfs recommended /data/log1 3~4 times the memory allocated to observer observer process log disk ext4 or xfs recommended /data/1 Depends on the required data storage size observer process data disk ext4 or xfs recommended Note
We recommend that the root directory be at least 50 GB. If you use LVM, use striping parameters when creating. Example:
lvcreate -n data -L 3000G obvg --stripes=3 --stripesize=128.We recommend that you use different disks for the data disk, log disk, and installation disk in production to avoid performance issues.
Mount operations
Disk mounting must be performed as the root user. You can choose one of the following methods based on your environment:
- Use LVM tools to mount disks (recommended).
- Use the fdisk tool to mount disks.
View disk information
Use the
fdisk -lcommand to identify available disks and partitions and confirm the target device (for example,/dev/sdb1).[root@test001 ~]# fdisk -l(Optional) Install LVM tools
If LVM is not preinstalled, run the following command to install it. If LVM is already installed, skip this step.
Debian/Ubuntu systems
[root@test001 ~]# apt-get install lvm2CentOS/RHEL systems
[root@test001 ~]# yum install lvm2
Create a physical volume (PV)
Initialize the partition as a physical volume.
Notice
Initializing a partition as a physical volume will reformat the partition (data will be lost). Proceed with caution.
[root@test001 ~]# pvcreate /dev/sdb1You can run the
pvscommand to verify the physical volume creation result.Create a volume group (VG)
Combine multiple physical volumes into one VG.
[root@test001 ~]# vgcreate vg01 /dev/sdb1 /dev/sdc1You can run the
vgscommand to view the volume group information.Create a logical volume (LV)
Create a 100G logical volume from the VG. This is only an example; you can set the logical volume size based on your needs.
[root@test001 ~]# lvcreate -L 100G -n lv01 vg01You can run the
lvscommand to view the logical volume information.Format and mount
Format as ext4 file system:
[root@test001 ~]# mkfs.ext4 /dev/vg01/lv01Create a mount point:
[root@test001 ~]# mkdir -p /data/1Mount temporarily:
[root@test001 ~]# mount /dev/vg01/lv01 /data/1
Enable automatic mounting at boot
Edit the
/etc/fstabfile and add the mount configuration:[root@test001 ~]# vim /etc/fstabAdd the following content to the
/etc/fstabfile:/dev/vg01/lv01 /data/1 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0 0 0
View disk information
Use the
fdisk -lcommand to identify available disks and partitions and confirm the target device (for example,/dev/sdb1).[root@test001 ~]# fdisk -lCreate partitions
Use the fdisk tool to create a new partition. For example, run
fdisk /dev/sdb1, enternto create a primary partition, and finally save withw.[root@test001 ~]# fdisk /dev/sdb1Format and mount
Format as ext4 file system:
[root@test001 ~]# mkfs.ext4 /dev/sdb1Create a mount point:
[root@test001 ~]# mkdir -p /data/1Mount temporarily:
[root@test001 ~]# mount /dev/sdb1 /data/1
Enable automatic mounting at boot
Edit the
/etc/fstabfile and add the mount configuration:[root@test001 ~]# vim /etc/fstabAdd the following content to the
/etc/fstabfile:/dev/sdb1 /data/1 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0 0 0
View disks
After mounting the disks, run the following command to check the disk layout:
[root@test001 ~]# df -h
The result is as follows:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 31G 0 31G 0% /dev
tmpfs 31G 0 31G 0% /dev/shm
tmpfs 31G 516K 31G 1% /run
tmpfs 31G 0 31G 0% /sys/fs/cgroup
/dev/vda1 493G 171G 302G 37% /
tmpfs 6.2G 0 6.2G 0% /run/user/0
/dev/sdb1 984G 77M 934G 1% /data/1
/dev/vdc1 196G 61M 186G 1% /data/log1
/dev/vdb1 492G 73M 467G 1% /home/admin/oceanbase
Result description:
/data/1is the data disk with a size of 1 TB./data/log1stores the logs./home/admin/oceanbasestores the binary files and operational logs of OceanBase Database.
Ensure that the disks for data_dir, redo_dir (or clog_dir), and home_path in the configuration file have been mounted. The directories for data_dir and redo_dir must be empty. The disk usage for the data_dir directory must be less than 4%.
Set directory permissions
After mounting the disks, you need to check the permissions of the directories corresponding to the disk mount points. Run the following command to check the directory permissions of cluster-related files.
Taking the data directory as an example:
[root@test001 data]# ls -al
The following result indicates that the directory owner is the admin user in the admin group:
drwxr-xr-x 2 admin admin 4096 02/09 18:43 .
drwxr-xr-x 2 admin admin 4096 02/09 18:43 log1
If the admin user does not have the necessary privilege for the related files, run the following commands to change the file ownership:
[root@test001 ~]# chown -R admin:admin /data/log1
[root@test001 ~]# chown -R admin:admin /data
Here, /data/log1 and /data are example mount directories. You need to replace them with your actual mount directories.