Sample Header Ad - 728x90

MySQL log_bin and relay_log base_name.extension

0 votes
0 answers
60 views
Some of the MySQL clusters I manage have the following my.cnf settings:
log_bin   = mysql-bin.log
relay_log = mysql-relay-bin.log
For the log_bin setting the .log extension is not needed because MySQL ignores and removes the extension from the file name. According to the binary-log documentation: > If you supply an extension in the log name (for example, --log-bin=base_name.extension), the extension is silently removed and ignored. I noticed that the relay_log setting behaves the same with extensions. MySQL also ignores and removes the extension but it seems this behaviour is (currently) not present in the replication-options documentation. When showing these variables in MySQL there is also a small difference. The log_bin value shows ON (instead of the file name) and the relay_log value shows the actual file name:
mysql> SHOW GLOBAL VARIABLES LIKE 'log_bin%';

| log_bin             | ON
| log_bin_basename    | /var/lib/mysql/mysql-bin

mysql> SHOW GLOBAL VARIABLES LIKE 'relay_log%';

| relay_log           | mysql-relay-bin.log
| relay_log_basename  | /var/lib/mysql/mysql-relay-bin
My questions are: 1. Why are the log_bin and relay_log values different (ON vs File Name)? 2. Will relay_log always behave the same as log_bin with extensions (is this by design)? If this is by design then the .log extensions could be removed in my.cnf for both settings:
log_bin   = mysql-bin
relay_log = mysql-relay-bin
Asked by tomputer (1 rep)
Sep 11, 2024, 11:38 AM
Last activity: Sep 11, 2024, 12:00 PM