diff --git a/Documentation/Routers/Binlogrouter.md b/Documentation/Routers/Binlogrouter.md index 87eee1c33..69a11b4c3 100644 --- a/Documentation/Routers/Binlogrouter.md +++ b/Documentation/Routers/Binlogrouter.md @@ -159,15 +159,39 @@ the router options. ### `mariadb10-compatibility` This parameter allows binlogrouter to replicate from a MariaDB 10.0 master -server. If `mariadb10_slave_gtid` is not enabled GTID will not be used in the -replication. This parameter is enabled by default since MaxScale 2.2.0. In -earlier versions the parameter was disabled by default. +server: this parameter is enabled by default since MaxScale 2.2.0. +In earlier versions the parameter was disabled by default. ``` # Example router_options=mariadb10-compatibility=1 ``` + +Additionally, since MaxScale 2.2.1, MariaDB 10.x slave servers +can connect to binlog server using GTID value instead of binlog name and position. + +Example of a MariaDB 10.x slave connection to MaxScale + +``` +MariaDB> SET @@global.gtid_slave_pos='0-10122-230'; +MariaDB> CHANGE MASTER TO + MASTER_HOST='192.168.10.8', + MASTER_PORT=5306, + MASTER_USE_GTID=Slave_pos; +MariaDB> START SLAVE; +``` + +**Note:** + +- Slave servers can connect either with _file_ and _pos_ or GTID. + +- MaxScale saves all the incoming MariaDB GTIDs (DDLs and DMLs) +in a sqlite3 database located in _binlogdir_ (`gtid_maps.db`). +When a slave server connects with a GTID request a lookup is made for +the value match and following binlog events will be sent. + + ### `transaction_safety` This parameter is used to enable/disable incomplete transactions detection in @@ -271,29 +295,6 @@ Example: 3;bbbbbbbbbaaaaaaabbbbbccccceeeddddd3333333ddddaaaaffffffeeeeecccd ``` - -### `mariadb10_slave_gtid` -If enabled this option allows MariaDB 10.x slave servers to connect to binlog -server using GTID value instead of binlog_file name and position. -MaxScale saves all the incoming MariaDB GTIDs (DDLs and DMLs) -in a sqlite3 database located in _binlogdir_ (`gtid_maps.db`). -When a slave server connects with a GTID request a lookup is made for -the value match and following binlog events will be sent. -Default option value is _off_. - -Example of a MariaDB 10.x slave connection to MaxScale - -``` -MariaDB> SET @@global.gtid_slave_pos='0-10122-230'; -MariaDB> CHANGE MASTER TO - MASTER_HOST='192.168.10.8', - MASTER_PORT=5306, - MASTER_USE_GTID=Slave_pos; -MariaDB> START SLAVE; -``` - -**Note:** Slave servers can connect either with _file_ and _pos_ or GTID. - ### `mariadb10_master_gtid` This option allows MaxScale binlog router to register with MariaDB 10.X master using GTID instead of _binlog_file_ name @@ -374,7 +375,6 @@ follows. encrypt_binlog=1, encryption_algorithm=aes_ctr, encryption_key_file=/var/binlogs/enc_key.txt, - mariadb10_slave_gtid=On, mariadb10_master_gtid=Off, slave_hostname=maxscale-blr-1, master_retry_count=1000, diff --git a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md index 40f89cb30..a53a6a949 100644 --- a/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md +++ b/Documentation/Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md @@ -66,7 +66,6 @@ A **complete example** of a service entry for a binlog router service would be a encrypt_binlog=On, encryption_algorithm=aes_ctr, encryption_key_file=/var/binlogs/enc_key.txt, - mariadb10_slave_gtid=On, mariadb10_master_gtid=Off, slave_hostname=maxscale-blr-1, master_retry_count=1000, @@ -198,7 +197,7 @@ If a slave is connected to MaxScale with SSL, an entry will be present in the Sl Slave connected with SSL: Established ``` -If option `mariadb10_slave_gtid=On` last seen GTID is shown: +If option `mariadb10-compatibility=On` last seen GTID is shown: ``` Last seen MariaDB GTID: 0-10124-282 @@ -253,7 +252,7 @@ Master_SSL_Verify_Server_Cert: No Master_Info_File: /home/maxscale/binlog/first/binlogs/master.ini ``` -If the option `mariadb10_slave_gtid` is set to On, the last seen GTID is shown: +If the option `mariadb10-compatibility` is set to On, the last seen GTID is shown: ``` Using_Gtid: No @@ -277,11 +276,8 @@ slaves must not use *MASTER_AUTO_POSITION = 1* option. It also works with a MariaDB 10.X setup (master and slaves). -Starting from MaxScale 2.2 the slave connections may include **GTID** feature -`MASTER_USE_GTID=Slave_pos` if option *mariadb10_slave_gtid* has been set. - -The default is that a slave connection must not include any GTID -feature: `MASTER_USE_GTID=no` +Starting from MaxScale 2.2.1 the slave connections might optionally include +**GTID** feature `MASTER_USE_GTID=Slave_pos`: only option *mariadb10-compatibility* is required. Starting from MaxScale 2.2 it's also possible to register to MariaDB 10.X master using **GTID** using the new option *mariadb10_master_gtid*. @@ -545,8 +541,8 @@ be issued for the new configuration. ### Removing binary logs from binlogdir -Since version 2.2, if `mariadb10_slave_gtid` or `mariadb10_master_gtid` -are set to On, it's possible to remove the binlog files from _binlogdir_ +Since version 2.2.1, if `mariadb10-compatibility`is set to On, +it's possible to remove the binlog files from _binlogdir_ and delete related entries in GTID repository using the admin command `PURGE BINARY LOGS TO 'file'` @@ -653,8 +649,8 @@ Example: ``` ##### MariaDB 10 GTID -If connecting slaves are MariaDB 10.x it's also possible to connect with GTID, -*mariadb10_slave_gtid=On* has to be set in configuration before starting MaxScale. +Since MaxScale 2.2.1 the MariaDB 10.x connecting slaves can optionally connect with GTID, +*mariadb10-compatibility=On* has to be set in configuration before starting MaxScale. ``` SET @@global.gtid_slave_pos=''; @@ -688,7 +684,7 @@ MariaDB> CHANGE MASTER TO MariaDB> START SLAVE; ``` -Additionally, if *mariadb10_slave_gtid=On*, it's also possible to retrieve the list of binlog files downloaded from the master with the new admin command _SHOW BINARY LOGS_: +Additionally it's also possible to retrieve the list of binlog files downloaded from the master with the new admin command _SHOW BINARY LOGS_: ``` MariaDB> SHOW BINARY LOGS; diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index e102ed24a..e7c485b67 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -190,7 +190,6 @@ MXS_MODULE* MXS_CREATE_MODULE() MXS_MODULE_OPT_NONE, enc_algo_values }, {"encryption_key_file", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, - {"mariadb10_slave_gtid", MXS_MODULE_PARAM_BOOL, "false"}, {"mariadb10_master_gtid", MXS_MODULE_PARAM_BOOL, "false"}, { "binlog_structure", MXS_MODULE_PARAM_ENUM, "flat", @@ -359,8 +358,8 @@ createInstance(SERVICE *service, char **options) inst->request_semi_sync = config_get_bool(params, "semisync"); inst->master_semi_sync = 0; - /* Enable MariaDB GTID tracking for slaves */ - inst->mariadb10_gtid = config_get_bool(params, "mariadb10_slave_gtid"); + /* Enable MariaDB GTID tracking for slaves if MariaDB 10 compat is set */ + inst->mariadb10_gtid = inst->mariadb10_compat; /* Enable MariaDB GTID registration to master */ inst->mariadb10_master_gtid = config_get_bool(params, "mariadb10_master_gtid"); @@ -539,10 +538,6 @@ createInstance(SERVICE *service, char **options) { inst->encryption.enabled = config_truth_value(value); } - else if (strcmp(options[i], "mariadb10_slave_gtid") == 0) - { - inst->mariadb10_gtid = config_truth_value(value); - } else if (strcmp(options[i], "mariadb10_master_gtid") == 0) { inst->mariadb10_master_gtid = config_truth_value(value);