Install a CPFS-POSIX client on Alibaba Cloud Linux 2 and use the client to mount a CPFS file system.
Background
-
The target ECS instances mentioned in this topic refer to the compute nodes that mount and access the CPFS file system.
-
Cloud Parallel File Storage (CPFS) is compatible with the POSIX interface. You can use CPFS by installing the CPFS-POSIX client and mounting a file system. The CPFS-POSIX client provides customized services and supports installation on Alibaba Cloud Linux 2. If you want to access the CPFS file system by using the NFS protocol, see Mount a file system by using a CPFS-NFS client.
-
After you add a POSIX mount point, CPFS automatically creates three management node ECS instances: <FSID>-<GENID>-qr-001, <FSID>-<GENID>-qr-002, and <FSID>-<GENID>-qr-003. The first management node ECS instance (<FSID>-<GENID>-qr-001) in the list is the default CPFS-POSIX client installation node.
Prerequisites
-
A file system is created. For more information, see Create a file system.
-
A POSIX mount point is added. For more information, see Add a POSIX mount target.
-
One or more Alibaba Cloud Linux 2 ECS instances are created, and the instance specifications are as follows.
-
Version: Alibaba Cloud Linux 2.1903 LTS 64-bit
-
Kernel version: 4.19.91-27.4.al7.x86_64 or earlier.
You can run the uname -r command to check the kernel version.
-
Step 1: Configure the security group for the target ECS instances
Before you mount a file system to the ECS instances created in the prerequisites, you must add the security group of the CPFS-POSIX management node ECS instances to the target ECS instances. This prevents failures in remote connections and data transmission between the target ECS instances and the CPFS cluster.
Obtain the security group ID of the CPFS-POSIX control node.
Log on to the NAS console.
In the left-side navigation pane, choose .
In the upper-left corner of the page, select the resource group and region of the target file system.

Click the target file system. On the details page, click Mount Targets.
In the Client Management node section, click the first ECS instance in the list to go to the instance details page.
On the Instance Details page, click the Security Groups tab and note down the Security Group ID/Name of the control node.
The security group name of the control node follows this format: <FSID>-<GENID>-qr-sg.
In this format, <FSID> is the CPFS file system ID and <GENID> is the mount target sequence number, which increments each time a CPFS mount target is created.
Add the security group of the control node to the target ECS instance.
In the left-side navigation pane, choose Instances & Images > Instances.
On the Instance List page, click the ECS instance ID to be mounted, select the Security Groups tab, and click Change Security Group.
In the Change Security Group dialog box, select the control node security group (<FSID>-<GENID>-qr-sg) recorded in Step 1 from the Security Groups drop-down list, and click OK.
Step 2: Install a CPFS-POSIX client
-
Log on to the NAS console.
-
In the left-side navigation pane, choose .
-
In the upper-left corner of the page, select the resource group and region where the target file system resides.
To switch resource groups, use the All Resources drop-down list in the top navigation bar.
-
Click the target file system to go to the file system details page, and click Mount Targets.
-
In the Client Management node section, click the first management node ECS instance in the list to go to the details page of the instance.
-
Click Connect to log on to the CPFS-POSIX client installation node.
-
Configure password-free logon between the management node and the target ECS instances.
NoteBefore you configure password-free logon between CPFS management nodes and multiple ECS instances, we recommend that you set the logon passwords of the target ECS instances to the same password. Otherwise, you must create the client.list file multiple times and repeat Steps 10 to 12.
-
Create the client.list file and add the private IP addresses of the target ECS instances.
-
Create the client.list file
touch client.list -
Run the
vi client.listcommand to open the client.list file and add the private IP addresses of the target ECS instances.<Private IP address of target ECS instance 1> <Private IP address of target ECS instance 2> <Private IP address of target ECS instance 3>Example:
192.168.1.249 192.168.1.250 192.168.1.251NoteYou can add one or more ECS instances. When you add multiple ECS instances, enter the private IP addresses of the target ECS instances on separate lines.
-
Save and exit.
-
-
Create the qr.list file and add the management node IP addresses.
-
Create the qr.list file
touch qr.list -
Run the
vi qr.listcommand to open the qr.list file and add the management node IP addresses. The following example shows the content:10.0.2.41 10.0.2.42 10.0.2.43The Client Management node section lists the IP addresses of the CPFS-POSIX client management nodes.
-
Save and exit.
-
-
Configure the auto_ssh.sh script.
-
Create the auto_ssh.sh file.
touch auto_ssh.sh -
Run the
vi auto_ssh.shcommand to open the auto_ssh.sh file and add the following content.#!/usr/bin/expect set timeout 10 set username [lindex $argv 0] set password [lindex $argv 1] set hostname [lindex $argv 2] spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $username@$hostname expect { #first connect, no public key in ~/.ssh/known_hosts "Are you sure you want to continue connecting (yes/no)?" { send "yes\r" expect "password:" send "$password\r" } #already has public key in ~/.ssh/known_hosts "password:" { send "$password\r" } "Now try logging into the machine" { #it has authorized, do nothing! } "already exist on the remote" { #it has authorized, do nothing! } } expect eof -
Save and exit.
-
-
-
Run the following command to grant the user the execute permission on the auto_ssh.sh file.
chmod +x auto_ssh.sh -
Run the following command to record the PASSWD of the target ECS instances in client.list.
PASSWD='yourpassword'NoteIf the PASSWDs of the target ECS instances are different, you must create the client.list file multiple times and repeat Steps 8 to 10.
-
Run the following command to configure password-free logon for the management node.
cat client.list | xargs -I {} ./auto_ssh.sh root $PASSWD {} -
Run the following command to remotely install the CPFS client on the ECS instances recorded in client.list. The installation is successful when
Complete!is returned.region_id=`curl http://100.100.100.200/latest/meta-data/region-id`; wget https://cpfs-${region_id}-pre.oss-${region_id}-internal.aliyuncs.com/cpfs/CPFS2.3.4-CentOS.tar.gz -O /root/CPFS2.3.4-CentOS.tar.gz; cat client.list | xargs -I {} scp /root/CPFS2.3.4-CentOS.tar.gz {}:/root/ pssh -ih client.list "tar xzvf /root/CPFS2.3.4-CentOS.tar.gz" pssh -ih client.list "cd /root/CPFS2.3.4-CentOS/CentOS7;yum install -y gpfs.adv-*.x86_64.rpm gpfs.base-*.x86_64.rpm gpfs.docs-*.noarch.rpm gpfs.gpl-*.noarch.rpm gpfs.gskit-*.x86_64.rpm gpfs.gss.pmsensors-*.x86_64.rpm gpfs.license.dm-*.x86_64.rpm gpfs.msg.en_US-*.noarch.rpm" -
Run the following command to remotely compile the kernel extension on the ECS instances recorded in client.list.
pssh -ih client.list "/usr/bin/yum -y install cpp gcc-c++ elfutils-libelf-devel" pssh -ih client.list "export LINUX_DISTRIBUTION=KERNEL_ORG_LINUX; /usr/lpp/mmfs/bin/mmbuildgpl"To reuse this configuration on additional ECS instances, create a custom image from a configured instance. For more information about how to create a custom image, see Custom images.
Step 3: Mount the file system
-
In the left-side navigation pane, click Instances.
-
On the Instance List page, find the CPFS-POSIX client installation node ECS (qr-001), and click Connect in the Actions column to log on to the node.
The Client Management Nodes section displays the logon password for the CPFS-POSIX client installation node.
-
Run the following command to update the hosts file on the management node and the target ECS instances.
pssh -ih client.list "hostname;ifconfig eth0 | grep -v inet6 | grep inet | awk '{print \$2}'" | grep -v SUCC | sed 'N;s/\n/ /' > /tmp/ip-host-client.list pssh -ih qr.list "hostname;ifconfig eth0 | grep -v inet6 | grep inet | awk '{print \$2}'" | grep -v SUCC | sed 'N;s/\n/ /' > /tmp/ip-host-qr.list cat /tmp/ip-host-client.list | awk '{print $2,$1,$1"t_MAGICTAG"}' > /etc/client-hosts.append cat /tmp/ip-host-qr.list | awk '{print $2,$1,$1"t_MAGICTAG"}' > /etc/qr-hosts.append pssh -ih client.list "cp /etc/hosts hosts.bak" pssh -ih qr.list "cp /etc/hosts hosts.bak" cat client.list | xargs -I {} scp /etc/client-hosts.append {}:/etc/ cat client.list | xargs -I {} scp /etc/qr-hosts.append {}:/etc/ cat qr.list | xargs -I {} scp /etc/client-hosts.append {}:/etc/ pssh -ih client.list "cat /etc/client-hosts.append >> /etc/hosts" pssh -ih client.list "cat /etc/qr-hosts.append >> /etc/hosts" pssh -ih qr.list "cat /etc/client-hosts.append >> /etc/hosts" -
Run the following command to add the target ECS instances to the CPFS cluster.
-
Command
mmaddnode -N client.list mmchlicense client --accept -N client.list mmchnode --perfmon -N client.list mmstartup -N client.list mmgetstate -a -
Response example
The target ECS instance is successfully added to the CPFS cluster when the node state changes to
active.Node number Node name GPFS state --------------------------------------------------------------- 1 cpfs-2989198****323d3-000001-qr-001 active 2 cpfs-2989198****323d3-000001-qr-002 active 3 cpfs-2989198****323d3-000001-qr-003 active 4 iZ0jl91t3p5kehvr6i5**** active
-
-
Run the following command to verify that the node list includes the target ECS instances.
-
Command
mmlscluster -
Response example
Node Daemon node name IP address Admin node name Designation ----------------------------------------------------------------------------------------------------------- 1 cpfs-2989198****323d3-000001-qr-001 192.168.3.57 cpfs-2989198****323d3-000001-qr-001 quorum-manager-perfmon 2 cpfs-2989198****323d3-000001-qr-002 192.168.3.58 cpfs-2989198****323d3-000001-qr-002 quorum-manager-perfmon 3 cpfs-2989198****323d3-000001-qr-003 192.168.3.56 cpfs-2989198****323d3-000001-qr-003 quorum-manager-perfmon 4 iZ0jl91t3p5kehvr6i5**** 192.168.3.59 iZ0jl91t3p5kehvr6i5**** perfmon
-
-
(Optional) Query the default path.
After you add the target ECS instance to the CPFS-POSIX client management node, the file system is automatically mounted at the default path /cpfs/<FSID serial number>. Run the
mmlsfs <FSID serial number>-<GENID> -Tcommand to view the default mount path.-
Command example
mmlsfs 2989198****323d3-000001 -T -
Response example
flag value description ------------------- ------------------------ ----------------------------------- -T /cpfs/2989198****323d3-000001 Default mount point
To mount the CPFS file system at a custom path, run the
mount --bindcommand.mount --bind /cpfs/2989198****323d3-000001 /mnt/testIn this command, /cpfs/2989198****323d3-000001 is the default mount path of the CPFS file system, and /mnt/test is the custom mount path.
Note-
Custom mount paths are not allowed on the CPFS file system installation node.
-
Subdirectory mounting is not supported.
-
FAQ
For more FAQ and solutions about mounting CPFS, see Mount access FAQ.