Clear cgroup configurations

2025-01-02 01:58:40  Updated

After OceanBase Database is upgraded, the directory structure of the control group (cgroup) may change. Therefore, before upgrading OceanBase Database, you must clear the previously configured cgroup system directory.

Prerequisites

The OBServer node where the cgroup system directory is configured has been stopped. For the steps to stop an OBServer node, see Restart a node.

Procedure

  1. Log in to the server where the OBServer node is located using the admin user.

  2. Remove the soft link between the OceanBase Database software installation directory and the cgroup system directory.

    [admin@xxx /home/admin/oceanbase]
    $ll cgroup
    lrwxrwxrwx 1 admin admin 29 Dec  8 11:09 cgroup -> /sys/fs/cgroup/cpu/oceanbase/
    
    [admin@xxx /home/admin/oceanbase]
    $ rm -rf cgroup
    
  3. Delete the cgroup system directory /sys/fs/cgroup/cpu/oceanbase.

    Since the files in the cgroup system directory must be recursively deleted from a lower-level directory to an upper-level directory, you can create a script file named deletecgroupdir.sh to delete the cgroup system directory and its subdirectories in batches.

    1. Create a script file and save it with the following content.

      [admin@xxx /home/admin]$ vim deletecgroupdir.sh
      

      The content to be filled in the file is as follows:

      #! /bin/bash
      function read_dir(){
              for file in `ls $1`
                      do
                              if [ -d $1"/"$file ]
                                      then
                                              read_dir $1"/"$file
      
                              fi
              done
              string=$1
              echo rmdir $string
              rmdir $string
      }
      # Read the first parameter.
      read_dir /sys/fs/cgroup/cpu/oceanbase
      
    2. Execute the script to delete the cgroup system directory.

      [admin@xxx /home/admin]
      $sudo /bin/bash deletecgroupdir.sh
      

References

Configure cgroups

Contact Us