0% found this document useful (0 votes)
40 views3 pages

BPMS Database Switchover Steps 1

The document outlines a series of steps for shutting down and reconfiguring a MySQL database cluster, including commands for locking tables, adjusting server settings, and renaming hosts. It details the process of syncing replicas with the master server, performing clean shutdowns, and updating configuration files. Finally, it instructs on restarting the application and monitoring for anomalies post-configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

BPMS Database Switchover Steps 1

The document outlines a series of steps for shutting down and reconfiguring a MySQL database cluster, including commands for locking tables, adjusting server settings, and renaming hosts. It details the process of syncing replicas with the master server, performing clean shutdowns, and updating configuration files. Finally, it instructs on restarting the application and monitoring for anomalies post-configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1.

Application shutdown
2. Run on the master server: [Link]:
mysql> flush tables with read lock;
mysql> set global read_only=1; set global super_read_only=1;
mysql> show master status;
3. Note the file name and position:
master@[Link]: (none)>show master status;
+------------------+-----------+--------------+------------------
+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
Executed_Gtid_Set |
+------------------+-----------+--------------+------------------
+-------------------+
| mysql-bin.338622 | 262776281 | | |
|
+------------------+-----------+--------------+------------------
+-------------------+
1 row in set (0.00 sec)

master@[Link]: (none)>

4. Allow all the replicas to sync to the same file and position. Run the following
on each of the following hosts to check sync status:
[Link]
[Link]
[Link]
mysql> show slave status;
Relay_Master_Log_File: mysql-bin.338258
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 876089268

5. Once the replicas have all synced up, run the following commands on each of them
to perform a clean shutdown:
mysql> set global innodb_fast_shutdown=0;
$ sudo systemctl stop mysqld
6. Run the following commands on the master ([Link]):
mysql> set global innodb_fast_shutdown=0;
$ sudo systemctl stop mysqld
7. Adjust /etc/[Link] of the master server ([Link]) to with the
configuration below:
expire_logs_days=0
read_only=1
super_read_only=1
8. Poweroff the following set of hosts:
[Link]
[Link]
[Link]
9. Rename the hosts as follows:
svdchpemakerdb01 ([Link]) -> svdcpmakerdb02 ([Link])
svdchpemakerdb02 ([Link]) -> svdcpmakerdb03 ([Link])
svdrpmakerdb01 ([Link]) -> svdrpmakerdbstby ([Link])
10. Create new /etc/[Link] files on each of the hosts above. Run the following set
of commands on the hosts [Link], [Link], [Link]
$ mv /etc/[Link] /etc/my.cnf_08042025_before_switchover
$ cp -a /app/bpmsdatabase/mysql/[Link] /etc/[Link]
10. Restart mysql in READONLY mode on the following hosts: [Link],
[Link], [Link]
$ sudo systemctl start mysqld
11. On the master node ([Link]), run the command below and note the file
name and position:
mysql> show master status;
master@[Link]: (none)>show master status;
+---------------------------+----------+--------------+------------------
+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
Executed_Gtid_Set |
+---------------------------+----------+--------------+------------------
+-------------------+
| svdcpmakerdb02-bin.000001 | 157 | | |
|
+---------------------------+----------+--------------+------------------
+-------------------+

12. On each of the replicas ([Link], [Link]), run the following


commands:
mysql> reset slave;
mysql>
CHANGE MASTER TO MASTER_HOST='[Link]', MASTER_USER='repl',
MASTER_PASSWORD='R3pl1c9t1_tbd0n', MASTER_LOG_FILE='svdcpmakerdb02-bin.000001',
MASTER_LOG_POS=157;
mysql> start slave;
13. Check the sync between the master and the replica by running the following on
hosts [Link] and [Link]:
mysql> show slave status;
Relay_Master_Log_File: mysql-bin.338258
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 876089268
14. If the syncing is okay, put the master host ([Link]) in READ-WRITE
mode:
mysql> set global read_only=0; set global super_read_only=0;
15. Comment the read_only and super_read_only variables in the /etc/[Link] of the
master host [Link] by prepending the variables with a hash symbol
16. Start the application and test
17. Comment the skip_slave_start variable in the /etc/[Link] of the replicas
([Link] and [Link])
19. Map the ZFS mountpoint [Link]:/export/BFUBPRD/pmakerapp to /backup on
the following hosts [Link], [Link], and [Link]
20. Monitor the database and application for any anomalies

You might also like