Bringing a Resource In Service (restore)
Start the MySQL resource in the following order.
- Check the same items as in the monitoring process described later to confirm that MySQL is running. If it is determined that MySQL is running, the startup process ends successfully.
- Start MySQL using the following command.
# /usr/bin/systemctl start <Service name>
- Check the same items as in the monitoring process described later to confirm that MySQL is running. If the check fails, it exits with an error.
Taking a Resource Out of Service (remove)
Obtain the information from the MySQL configuration file (my.cnf) specified when creating the resource to start monitoring the MySQL resource.
- Check the same items as in the monitoring process described later to confirm that MySQL is running. If it is determined that MySQL is running, stop MySQL with the following command. If the return value indicates that the stop command was successful, the stop process ends successfully.
# mysqladimin -u <Username> --password=<Password> --socket=<Socket> shutdown
Username
: the [user] value in the [client] section of my.cnf
Password
: the [password] value in the [client] section of my.cnf
Socket
: the [socket] value in the [mysqld] section of my.cnf
- If the return value from step 1 indicates that the stop command failed, check whether the process does not exist based on the existence of the MySQL PID file as follows. If the check is successful, the stop process ends successfully.
- If the PID file exists, verify that there are no processes with the number listed in the MySQL PID file in the output of the ps command.
PID file
: the [pid-file] value in the [mysqld] section of my.cnf
- If the PID file does not exist, verify that there are no processes using the MySQL port number and socket in the output of the ps command.
Port number
: the [port] value in the [mysqld] section of my.cnf
Socket
: the [socket] value in the [mysqld] section of my.cnf
- If the PID file exists, verify that there are no processes with the number listed in the MySQL PID file in the output of the ps command.
- Check the parent process using the ps command based on the process ID confirmed in step 2, issue SIGTERM to the parent process and wait for 5 seconds.
- If the parent process identified in step 3 exists in the ps command output, it is determined that the process is not yet stopped. Issue SIGKILL to the parent process and wait for 5 seconds.
- Issue SIGTERM to the process ID confirmed in step 2 and wait for 5 seconds. The process is terminated as a success or failure of the remove process depending on the success or failure of SIGTERM.
Monitoring (quickCheck)
Obtain the information from the MySQL configuration file (my.cnf) specified when creating the resource to start monitoring the MySQL resource.
- Refer to VARIABLES with the following command. If the reference is successful, the command exits successfully.
# mysqladimin -u <Username> --password=<Password> --socket=<Socket> variables
Username
: the [user] value in the [client] section of my.cnf
Password
: the [password] value in the [client] section of my.cnf
Socket
: the [socket] value in the [mysqld] section of my.cnf
- If VARIABLES cannot be referenced in step 1, check that the process exists based on the existence of the MySQL PID file. If the check fails, the process exits with an error.
- If a PID file exists, verify that the output of the ps command contains a process with the number listed in the MySQL PID file.
PID file
: the [pid-file] value in the [mysqld] section of my.cnf
- If the PID file does not exist, verify that the output of the ps command contains the MySQL port number and the process using the socket.
Port number
: the [port] value in the [mysqld] section of my.cnf
Socket
: the [socket] value in the [mysqld] section of my.cnf
Recovery (recover)
- Perform the stop and start processes above in the described order to recover MySQL resources.
Post your comment on this topic.