Verifying the LUN Protected Group Consistency Script(MySQL)

The customized script is not provided by eReplication. The script provider must ensure that the script is correct. Before configuring the script, ensure that the script has been verified.

During the script verification, the database is frozen and unfrozen repeatedly, which affects services. Therefore, you are advised to create a non-service MySQL database for the verification.

Deploying the eReplication Server Component

For details, see Installing the eReplication Server (Linux) Using a Software Package.

Deploying the eReplication Agent Component

For details, see Installing the eReplication Agent (Protecting Application Systems). Use the SUSE operating system to install the eReplication Agent component.

The eReplication Agent and eReplication Server components cannot be installed on the same VM.

Deploying the expect Component (Non-LVM Scenario)

  1. Installing the tcl Component

    During the installation, retain the default values for other parameters except the following three steps.

    1. Use a browser to open the https://www.activestate.com/activetcl/downloads page. Download version 8.6.7.0 of the Linux (x86_64) platform type.

    2. Upload the software package to the VM and run the install.sh command to install the software package.
    3. To accept the license, enter A. The following information is displayed:
      Accept License [yes] => 'A' >>A
    4. When the system asks you whether to download IDE, enter n. The following information is displayed:
      Do you want to download a free trial of Komodo IDE? [Y/n] 
      n     
  2. Installing the gcc Component

    For example, in the SUSE operating system, run the which gcc command to check whether the gcc component exists.

    • If the gcc component exists, you do not need to install it again.
    • If it is not installed, perform the following steps to install it:
      #Add the zypper installation source.
      zipper as file://media/<path> iso 
      #Check whether the software package to be installed can be found.
      zypper se gcc-c++ 
      zypper se gcc 
      #Install the required software packages.
      zypper insall gcc-c++ 
      zypper install gcc     
  3. Compile and install the expect component.

    Use a browser to open the https://sourceforge.net/projects/expect/files/Expect/5.45.4/ page, and download the expect5.45.4.tar.gz source code package. Upload the file to the VM and run the following commands in sequence:

    ./configure --with-tclconfig=/opt/ActiveTcl-8.6/lib/ --with-tkconfig=/opt/ActiveTcl-8.6/lib/ 
    make 
    make install     
  4. Log in to the production application server as user root.
  5. Save the file in the /home/rdadmin/Agent/sbin/thirdparty/ directory. Table 1 describes the permission requirements of the file system. For details about the configuration, see Table 2.
    Table 1 Permission requirements of the file system

    File

    Permissions

    Function

    blanket.sh

    rdadmin: rdadmin 755

    Common script for array operations. This script is referenced in mysqlstart.sh/mysqlstop.sh and users must have the execute permission.

    mysql.conf

    rdadmin: rdadmin 644

    MySQL configuration file, which does not require the execute permission.

    mysqlstart.sh

    rdadmin: rdadmin 755

    MySQL startup script. This script is used to configure the file in the eReplication Server protection process. Users must have the execute permission on the script.

    mysqlstop.sh

    rdadmin: rdadmin 755

    Script for stopping the MySQL database. This script is configured in the eReplication Server protection process and requires the execute permission for users.

    mysqlquery.sh

    rdadmin: rdadmin 755

    This script is used to query the frozen status of the MySQL database. This script is used to configure the file in the eReplication Server protection process. Users must have the execute permission on the script.

    mysqlfreeze.sh

    rdadmin: rdadmin 755

    Script for freezing the MySQL database. This script is configured in the eReplication Server protection process and requires the execute permission.

    mysqlthaw.sh

    rdadmin: rdadmin 755

    Script for unfreezing the MySQL database. This script is configured in the eReplication Server protection process and requires the execute permission.

    storage

    rdadmin: rdadmin 755

    To encapsulate the expect script delivered by CLI commands, you must have the execute permission.

    Table 2 Description

    Item

    Configuration Description

    MYSQL_USER

    MySQL database user. The default user is root. This user is used to log in to the database and perform operations such as freezing and unfreezing.

    MYSQL_PASSWORD

    MySQL database password. The password is used to log in to the database and perform operations such as freezing and unfreezing.

    VG_NAME

    Name of VG used by the MySQL database. This parameter is used to mount and start the MySQL database. To start VG, set this parameter based on the VG name.

    LV_NAME

    Name of LV used by the MySQL database. The LV name is used to mount and start the MySQL database. To start VG, set this parameter to the name of LV used by the MySQL database.

    DATA_FILE_PATH

    Data directory of the MySQL database.

    VOL_TYPE

    Type of the disk used by the MySQL database. 0 indicates the simple volume and 1 indicates LVM.

    STORAGE_USER

    User name of the disk array used by the MySQL database.

    STORAGE_PASSWORD

    Password of the disk array used by the MySQL database.

    STORAGE_LOCATION

    IP address of the disk array used by the MySQL database.

    LUN_ID

    ID of the LUN used by the MySQL database.

    The following shows a configuration example:

    • In LVM scenarios:
      MYSQL_USER=root 
      MYSQL_PASSWORD=Psaaword 
      VOL_TYPE=1 
      DATA_FILE_PATH=/var/lib/mysql 
       
      [Simple Volume] 
      STORAGE_USER= 
      STORAGE_PASSWORD= 
      STORAGE_LOCATION= 
      LUN_ID=100 
       
      [LVM] 
      VG_NAME=vg_mysql 
      LV_NAME=lv_mysql 
           
    • In non-LVM scenarios:
      MYSQL_USER=root 
      MYSQL_PASSWORD=Password 
      VOL_TYPE=0 
      DATA_FILE_PATH=/var/lib/mysql 
       
      [Simple Volume] 
      STORAGE_USER=admin 
      STORAGE_PASSWORD=Password 
      STORAGE_LOCATION=10.10.10.10 
      LUN_ID=100 
       
      [LVM] 
      VG_NAME= 
      LV_NAME=     
  6. After configuring mysql.conf, check the following items:

Freezing Script (Non-Windows)

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to go to the directory where the script is stored.
  3. Run the sh mysqlfreeze.sh command to unfreeze the script.
  4. Run the su - mysql command to switch to the MySQL user.
  5. Run the mysql -uroot -p Password command to log in to the database.

     
    Warning: Using a password on the command line interface can be insecure. 
    Welcome to the MySQL monitor.  Commands end with ; or \g. 
    Your MySQL connection id is 309 
    Server version: 5.6.22 MySQL Community Server (GPL) 
     
    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 
     
    Oracle is a registered trademark of Oracle Corporation and/or its 
    affiliates. Other names may be trademarks of their respective 
    owners. 
     
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.     

  6. Run the show processlist; command to check the status of the MySQL database.

     
    mysql> show processlist; 
    +-----+------+-----------+------+---------+------+-------+------------------------+ 
    | Id  | User | Host      | db   | Command | Time | State | Info                   | 
    +-----+------+-----------+------+---------+------+-------+------------------------+ 
    | 334 | root | localhost | NULL | Query   |    0 | init  | select 1 and sleep(60) | 
    +-----+------+-----------+------+---------+------+-------+------------------------+ 
    1 row in set (0.00 sec) 
         

    If the value of Info is select 1 and sleep(60), the MySQL database has been frozen.

Unfreezing Script (Non-Windows)

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to go to the directory where the script is stored.
  3. Run the sh mysqlfreeze.sh command to unfreeze the script.
  4. Run the sh mysqlthaw.sh command to unfreeze the script.
  5. Run the su - mysql command to switch to the MySQL user.
  6. Run the mysql -uroot -p Password command to log in to the database.

     
    Warning: Using a password on the command line interface can be insecure. 
    Welcome to the MySQL monitor.  Commands end with ; or \g. 
    Your MySQL connection id is 309 
    Server version: 5.6.22 MySQL Community Server (GPL) 
     
    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 
     
    Oracle is a registered trademark of Oracle Corporation and/or its 
    affiliates. Other names may be trademarks of their respective 
    owners. 
     
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.     

  7. Run the show processlist; command to check whether the script is successfully executed.

     
    mysql> show processlist; 
    +-----+------+-----------+------+---------+------+-------+------------------+ 
    | Id  | User | Host      | db   | Command | Time | State | Info             | 
    +-----+------+-----------+------+---------+------+-------+------------------+ 
    | 334 | root | localhost | NULL | Query   |    0 | init  |                  | 
    +-----+------+-----------+------+---------+------+-------+------------------+ 
    1 row in set (0.00 sec) 
         

Frozen/Unfrozen State Query Script (Non-Windows)

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/tmp/ command to go to the tmp directory.
  3. Run the sh mysqlquery.sh command to execute the frozen/unfrozen state query script (non-windows).

     
    linux2:/home/rdadmin/Agent/sbin/thirdparty # cat ../../tmp/RST.txt  
    0 
    linux2:/home/rdadmin/Agent/sbin/thirdparty #     

    View the RST.txt file. If 0 is displayed, the MySQL database has been frozen. If 1 is displayed, the MySQL database has been frozen.

Starting Script (Non-Windows)

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to go to the directory where the script is stored.
  3. Run the sh mysqlstart.sh command to start the script.

    180611 18:28:33 mysqld_safe Logging to '/var/lib/mysql/mysql01.err'. 
    180611 18:28:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql     

  4. Run the service mysql status command to check the script status.

    SUCCESS! MySQL running (25995)     

Stopping Script (Non-Windows)

  1. Log in to the production application server as user root.
  2. Run the cd /home/rdadmin/Agent/sbin/thirtparty command to go to the directory where the script is stored.
  3. Run the sh mysqlstop.sh command to stop the script.
  4. Run the service mysql status command to check the script status.

     ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists


Copyright © Huawei Technologies Co., Ltd.