Before you use MyBase in an offline scenario, you must prepare the runtime environment as required.
Prerequisites
You have created a project.
Resource planning
For more information about resource planning, see Resource planning.
On all machines, the /apsara and /apsaradb directories must be created exactly as instructed in Create logical volumes.
Control plane machines
Item |
Production recommendation |
POC recommendation |
Specifications and quantity |
Resource requirements vary based on the combination of database kernels and tools. For information about specifications, quantity, and parameter requirements, see the estimates in Resource planning. |
|
Network |
10 Gigabit network interface card (NIC). |
|
For information about default ports, see Default ports. |
||
Storage |
Mount target
|
Mount target
|
System |
All machines, including the local machine (127.0.0.1), must meet one of the following requirements:
|
|
The default permission for operating system directories is |
||
The time on all machines must be synchronized. |
||
The hostnames of the machines cannot be the same. |
||
Data plane machines
The specifications for data plane machines are for reference only. The actual requirements vary based on the database product.
Product |
Item |
Production recommendation |
POC recommendation |
||
PolarDB for PostgreSQL with local disks (three nodes) |
Specifications and quantity |
Three machines, each with 3 cores and 9 GB of memory. |
|
Three machines, each with 3 cores and 9 GB of memory. |
|
Storage |
Mount target Mount target |
Mount target Mount target |
|||
PolarDB-X |
Specifications and quantity |
Three machines, each with 10 cores and 40 GB of memory. |
Three machines, each with 10 cores and 40 GB of memory. |
||
Storage |
Mount target Mount target |
Mount target Mount target |
|||
Tair |
Specifications and quantity |
Three machines, each with 32 cores and 64 GB of memory. |
Three machines, each with 32 cores and 64 GB of memory. |
||
Storage |
Mount target Mount target |
Mount target Mount target |
|||
Component overhead details
MyBase automatically allocates the services that are deployed on each machine. On the Project Details page, you can go to the Resource Estimation tab to view the Component overhead details. This section shows the component distribution and overhead.
Create logical volumes
This section describes how to create the /apsara and /apsaradb directories.
Logical Volume Manager (LVM) is a disk management tool for Linux that creates a logical layer over physical disks and partitions to simplify disk management. You can resize logical volumes without losing data. You can also add new disks without changing the existing logical volumes.
This topic describes how to use LVM to create a logical volume on multiple disks. The following example uses two new disks: /dev/vdb and /dev/vdc. The following figure shows the LVM configuration.
The procedure is as follows:
Create physical volumes (PVs).
Create and attach two new disks to the destination instance. Do not format the disks.
Remotely connect to the destination instance.
Run the following command to install the LVM tool.
sudo yum install -y lvm2Run the following command to view all disks on the destination instance.
lsblkThe following example output shows two disks: vdb and vdc. You can use LVM to create a scalable logical volume.

Run the following command to create physical volumes from the disk devices. If you want to specify multiple device names, separate them with spaces.
sudo pvcreate <device_name> ... <device_name>The following example shows how to use the
/dev/vdband/dev/vdcdevices to create two physical volumes.sudo pvcreate /dev/vdb /dev/vdcThe following example output indicates that the physical volumes are created.

Create a volume group (VG).
Run the following command to create a volume group.
Mount target
Product
Command
/apsara
General
sudo vgcreate vg_apsara <physical_volume_name> <physical_volume_name>In this topic, the example command is as follows:
sudo vgcreate vg_apsara /dev/vdb /dev/vdc/apsaradb
PolarDB-X
sudo vgcreate -s 32 vg_apsaradb <physical_volume_name> <physical_volume_name>Others
sudo vgcreate vg_apsaradb <physical_volume_name> <physical_volume_name>The following example output indicates that the volume group is created.


Run the following command to view information about the volume group.
sudo vgsThe following result shows that the vg_apsara volume group is created with a capacity of approximately 999 GB. The file system consumes some storage space.

Create a logical volume (LV).
Run the following command to create a logical volume.
Mount target
Product
Command
/apsara
General
sudo lvcreate -L 768g -n <logical_volume_name> <volume_group_name>In this topic, the example command is as follows:
sudo lvcreate -L 768g -n lv_apsara vg_apsara/apsaradb
General
sudo lvcreate -A y -I {stripe_size} -l 100%FREE -i {stripe_len} -n lv_apsaradb vg_apsaradbWhen you create /apsaradb, the recommended values for the
{stripe_size}and{stripe_len}parameters are as follows:Product name
stripe_size
stripe_len
AnalyticDB for PostgreSQL
64k
Number of available disks
PolarDB-X
128k
Number of available disks (4 is recommended)
PolarDB for PostgreSQL
8k
Number of available disks
Tair
128k
Number of available disks
Lindorm
128k
Number of available disks
Default
128k
Number of available disks
The following example output indicates that the logical volume is created.


Run the following command to verify that the data striping parameters are correct. The following figure shows that stripe_len is 4 and
stripe_sizeis `128k`.sudo lvs -o stripes,stripesize -S "lv_name=lv_apsaradb"
Create and mount a file system.
Run the following command to obtain information about the logical volume, such as its path, name, and volume group. This information is required for the subsequent steps.
sudo lvdisplay
LV Path: The path of the logical volume. Example:
/dev/vg_apsara/lv_apsara.LV Name: The name of the logical volume. Example:
lv_apsara.VG Name: The name of the volume group to which the logical volume belongs. Example:
vg_apsara.LV Size: The size of the logical volume. In the figure, the size is 768 GiB.
Run the following command to create a file system on the logical volume.
Mount target
Product
Command
/apsara
General
sudo mkfs.<file_system_format> <logical_volume_path>The following example uses the
ext4file system:sudo mkfs -t ext4 -m 0 -q -J size=4096 -T largefile -i 16384 /dev/vg_apsara/lv_apsara/apsaradb
PolarDB-X
sudo mkfs.ext4 /dev/vg_apsaradb/lv_apsaradb -m 0 -O extent,uninit_bg -E lazy_itable_init=1 -q -L apsaradb -J size=4096Others
sudo mkfs -t ext4 -m 0 -q -J size=4096 -T largefile -i 16384 /dev/vg_apsaradb/lv_apsaradbYou can create a new mount target.
sudo mkdir /apsara sudo mkdir /apsaradbRun the following command to mount the file system to the mount target.
sudo mount <logical_volume_path> <mount_target>The following example shows how to mount the logical volume at the path
/dev/vg_apsaradb/lv_apsaradbto the/apsaradbdirectory.sudo mount /dev/vg_apsara/lv_apsara /apsara sudo mount /dev/vg_apsaradb/lv_apsaradb /apsaradbCheck the mount result.
Run the following command to check whether the logical volume is mounted.
df -hThe following example output shows that /apsara and /apsaradb are displayed in the Mounted on column. This indicates that the mount is successful and the mount targets meet the requirements. A small amount of space is used because the file system consumes some storage space.

Configure automatic mounting at startup.
To automatically mount the logical volume at startup, you must add its mount information to the
/etc/fstabfile.Run the following command to back up the
/etc/fstabfile.sudo cp /etc/fstab /etc/fstab.bakRun the following command to add the mount information of the destination logical volume to the
/etc/fstabfile.Mount target
Product
Command
/apsara
General
sudo sh -c "echo `blkid <logical_volume_path> | awk '{print $2}' | sed 's/\"//g'` <logical_volume_mount_target> <file_system_type_of_logical_volume> defaults 0 0 >> /etc/fstab"In this topic, the example command is as follows:
sudo sh -c "echo `blkid /dev/vg_apsara/lv_apsara | awk '{print $2}' | sed 's/\"//g'` /apsara ext4 defaults 0 0 >> /etc/fstab"/apsaradb
PolarDB-X
echo "LABEL=apsaradb /apsaradb ext4 defaults,noatime,data=writeback,nodiratime,nodelalloc,barrier=0 0 0" >> /etc/fstabOthers
sudo sh -c "echo `blkid /dev/vg_apsaradb/lv_apsaradb | awk '{print $2}' | sed 's/\"//g'` /apsaradb ext4 defaults 0 0 >> /etc/fstab"Run the following command to check whether the mount information of the logical volume is added.
cat /etc/fstabThe following result shows that the information of the destination logical volume is displayed. This indicates that the mount information is added to the
/etc/fstabfile.
Verify that the automatic mount feature is enabled.
Run the following command to remount the file systems that are configured in
/etc/fstab. If no error is reported, the logical volume is mounted to the specified mount target.sudo mount -aRun the following command to check the device or partition to which the logical volume is mounted.
df -Th






