Prepare the environment

更新时间:
复制 MD 格式

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.

Important

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 /apsara:

  • Capacity: Greater than 768 GB.

  • Physical server: Use one or more SSDs to create a logical volume management (LVM) volume.

  • Virtual machine: Use one SSD or ultra disk.

Mount target /apsara:

  • Capacity: Greater than 768 GB.

  • Physical server: Use one SSD.

  • Virtual machine: Use one SSD or ultra disk.

System

All machines, including the local machine (127.0.0.1), must meet one of the following requirements:

  • Configure passwordless SSH access for the root user among all machines.

  • Configure the same SSH account and password on all machines. Use the root account or another privileged account.

The default permission for operating system directories is umask 022. This means that the umask value set in /etc/profile is 022.

The time on all machines must be synchronized.

The hostnames of the machines cannot be the same.

Data plane machines

Note

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.

  • Mount target /apsara:

    • Physical server: Use one or more SSDs to create a logical volume management (LVM) volume.

    • Virtual machine: Use one SSD or ultra disk.

  • Mount target /apsaradb:

    • Physical server: Use one or more NVMe disks to create an LVM volume.

    • Virtual machine: Use one or more NVMe disks to create an LVM volume.

Three machines, each with 3 cores and 9 GB of memory.

  • Mount target /apsara:

    • Physical server: Use one SSD.

    • Virtual machine: Use one SSD or ultra disk.

  • Mount target /apsaradb:

    • Physical server: Use one or more NVMe disks with a total capacity of 1 TB or more.

      Note
      • This applies only to co-located deployments.

      • This must be separate from the control plane disk.

    • Virtual machine: Use one or more SSDs or ultra disks.

Storage

Mount target /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 10 GB.

Mount target /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 10 GB.

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 /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 850 GB.

Mount target /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 850 GB.

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 /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 320 GB.

Mount target /apsara: Greater than 250 GB.

Mount target /apsaradb: Greater than 320 GB.

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.

image

The procedure is as follows:

  1. Create physical volumes (PVs).

    Create and attach two new disks to the destination instance. Do not format the disks.

    1. Remotely connect to the destination instance.

    2. Run the following command to install the LVM tool.

      sudo yum install -y lvm2
    3. Run the following command to view all disks on the destination instance.

      lsblk

      The following example output shows two disks: vdb and vdc. You can use LVM to create a scalable logical volume.

      image

    4. 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/vdb and /dev/vdc devices to create two physical volumes.

      sudo pvcreate /dev/vdb /dev/vdc

      The following example output indicates that the physical volumes are created.

      image

  2. Create a volume group (VG).

    1. 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.

      imageimage

    2. Run the following command to view information about the volume group.

      sudo vgs

      The 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.

      image

  3. Create a logical volume (LV).

    1. 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_apsaradb

      When 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.

      image

      image

    2. Run the following command to verify that the data striping parameters are correct. The following figure shows that stripe_len is 4 and stripe_size is `128k`.

      sudo lvs -o stripes,stripesize -S "lv_name=lv_apsaradb"

      image

  4. Create and mount a file system.

    1. 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

      image

      • 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.

    2. 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 ext4 file 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=4096

      Others

      sudo mkfs -t ext4 -m 0 -q -J size=4096 -T largefile -i 16384 /dev/vg_apsaradb/lv_apsaradb
    3. You can create a new mount target.

      sudo mkdir /apsara
      sudo mkdir /apsaradb
    4. Run 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_apsaradb to the /apsaradb directory.

      sudo mount /dev/vg_apsara/lv_apsara /apsara
      sudo mount /dev/vg_apsaradb/lv_apsaradb /apsaradb
    5. Check the mount result.

      Run the following command to check whether the logical volume is mounted.

      df -h

      The 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.

      image

  5. Configure automatic mounting at startup.

    To automatically mount the logical volume at startup, you must add its mount information to the /etc/fstab file.

    1. Run the following command to back up the /etc/fstab file.

      sudo cp /etc/fstab /etc/fstab.bak
    2. Run the following command to add the mount information of the destination logical volume to the /etc/fstab file.

      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/fstab

      Others

      sudo sh -c "echo `blkid /dev/vg_apsaradb/lv_apsaradb | awk '{print $2}' | sed 's/\"//g'` /apsaradb ext4 defaults 0 0 >> /etc/fstab"
    3. Run the following command to check whether the mount information of the logical volume is added.

      cat /etc/fstab

      The following result shows that the information of the destination logical volume is displayed. This indicates that the mount information is added to the /etc/fstab file.

      image

    4. 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 -a
    5. Run the following command to check the device or partition to which the logical volume is mounted.

      df -Th