Generally, updating the MySQL configuration my.cnf requires a restart of MySQL to take effect, but sometimes MySQL is on the line and does not necessarily allow you to reboot.
Look at an example:
mysql> show variables like ' log_slave_updates ';
+-------------------+-------+
| variable_name | Value |
+-------------------+-------+
| log_slave_updates | off |
+-------------------+-------+
Row in Set (0.00 sec)
Mysql> set global Log_slave_updates=1
ERROR 1238 (HY000): Variable ' Log_slave_updates ' is a read only Variable
See? It's an error!
Later checked the data, found that there is a thing called gdb, feel pretty cow x, you can achieve online change MySQL parameters, see examples:
mysql> system Gdb-p $ (pidof mysqld)-ex "Set Opt_log _slave_updates=1 "-batch
mysql> show variables like ' log_slave_updates ';
+-------------------+-------+
| variable_name | Value |
+-------------------+-------+
| log_slave_updates | on |
+-------------------+-------+
Row in Set (0.00 sec)
But in some repeatable parameters that cannot be changed directly with the set, what then? The foreigner gave a solution:
Copy Code code as follows:
Mysql> Show Slave status \g
...
Replicate_do_db:test
...
Mysql> system Gdb-p $ (pidof mysqld)
-ex ' Call rpl_filter->add_do_db (StrDup ("hehehe")) '-batch
Mysql> Show Slave status \g
...
Replicate_do_db:test,hehehe
...