Specify the options either on the
command line or in an
option file. Many of the
options can be set while the server is running by using the
CHANGE MASTER TO statement. Specify
system variable values using
SET.
Server ID.
On the master and each slave, you must use the
server-id option to establish a
unique replication ID in the range from 1 to
232 − 1. “Unique”
means that each ID must be different from every other ID in use
by any other replication master or slave. Example
my.cnf file:
[mysqld]
server-id=3
This section explains startup options for controlling
replication slave servers. Many of these options can be set
while the server is running by using the
CHANGE MASTER TO statement.
Others, such as the --replicate-* options, can
be set only when the slave server starts. Replication-related
system variables are discussed later in this section.
-
Property Value Command-Line Format --abort-slave-event-count=#Type Integer Default Value 0Minimum Value 0When this option is set to some positive integer
valueother than 0 (the default) it affects replication behavior as follows: After the slave SQL thread has started,valuelog events are permitted to be executed; after that, the slave SQL thread does not receive any more events, just as if the network connection from the master were cut. The slave thread continues to run, and the output fromSHOW SLAVE STATUSdisplaysYesin both theSlave_IO_Runningand theSlave_SQL_Runningcolumns, but no further events are read from the relay log.This option is used internally by the MySQL test suite for replication testing and debugging. It is not intended for use in a production setting.
--disconnect-slave-event-countProperty Value Command-Line Format --disconnect-slave-event-count=#Type Integer Default Value 0This option is used internally by the MySQL test suite for replication testing and debugging.
-
Property Value Command-Line Format --log-slave-updatesSystem Variable log_slave_updatesScope Global Dynamic No Type Boolean Default Value OFFNormally, a slave does not write to its own binary log any updates that are received from a master server. This option causes the slave to write the updates performed by its SQL thread to its own binary log. For this option to have any effect, the slave must also be started with the
--log-binoption to enable binary logging. Prior to MySQL 5.5, the server would not start when using the--log-slave-updatesoption without also starting the server with the--log-binoption, and would fail with an error; in MySQL 5.6, only a warning is generated. (Bug #44663)--log-slave-updatesis used when you want to chain replication servers. For example, you might want to set up replication servers using this arrangement:A -> B -> CHere,
Aserves as the master for the slaveB, andBserves as the master for the slaveC. For this to work,Bmust be both a master and a slave. You must start bothAandBwith--log-binto enable binary logging, andBwith the--log-slave-updatesoption so that updates received fromAare logged byBto its binary log. -
Property Value Command-Line Format --log-slow-slave-statements(<= 5.6.10)Removed 5.6.11 Type Boolean Default Value OFFWhen the slow query log is enabled, this option enables logging for queries that have taken more than
long_query_timeseconds to execute on the slave.Note that all statements logged in row format in the master will not be logged in the slave's slow log, even if this option is enabled.
This command-line option was removed in MySQL 5.6.11 and replaced by the
log_slow_slave_statementssystem variable. The system variable can be set on the command line or in option files the same way as the option, so there is no need for any changes at server startup, but the system variable also makes it possible to examine or set the value at runtime. -
Property Value Command-Line Format --log-warnings[=#]System Variable log_warningsScope (>= 5.6.4) Global Scope (<= 5.6.3) Global, Session Dynamic Yes Type Integer Default Value 1Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295Causes the server to record more messages to the error log about what it is doing. With respect to replication, the server generates warnings that it succeeded in reconnecting after a network or connection failure, and provides information about how each slave thread started. This option is enabled (1) by default; to disable it, use
--log-warnings=0. If the value is greater than 1, aborted connections are written to the error log, and access-denied errors for new connection attempts are written. See Section B.5.2.11, “Communication Errors and Aborted Connections”.NoteThe effects of this option are not limited to replication. It affects diagnostic messages across a spectrum of server activities.
-
Property Value Command-Line Format --master-info-file=file_nameType File name Default Value master.infoThe name to use for the file in which the slave records information about the master. The default name is
master.infoin the data directory. For information about the format of this file, see Section 17.2.2.2, “Slave Status Logs”. -
Property Value Command-Line Format --master-retry-count=#Deprecated 5.6.1 Type Integer Default Value 86400Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295The number of times that the slave tries to connect to the master before giving up. Reconnects are attempted at intervals set by the
MASTER_CONNECT_RETRYoption of theCHANGE MASTER TOstatement (default 60). Reconnects are triggered when data reads by the slave time out according to the--slave-net-timeoutoption. The default value is 86400. A value of 0 means “infinite”; the slave attempts to connect forever.This option is deprecated as of MySQL 5.6.1 and will be removed in a future MySQL release. Applications should be updated to use the
MASTER_RETRY_COUNToption of theCHANGE MASTER TOstatement instead. -
Property Value Command-Line Format --max-relay-log-size=#System Variable max_relay_log_sizeScope Global Dynamic Yes Type Integer Default Value 0Minimum Value 0Maximum Value 1073741824The size at which the server rotates relay log files automatically. If this value is nonzero, the relay log is rotated automatically when its size exceeds this value. If this value is zero (the default), the size at which relay log rotation occurs is determined by the value of
max_binlog_size. For more information, see Section 17.2.2.1, “The Slave Relay Log”. -
Property Value Command-Line Format --relay-log=file_nameSystem Variable relay_logScope Global Dynamic No Type File name The base name for the relay log. The default base name is
. The server writes the file in the data directory unless the base name is given with a leading absolute path name to specify a different directory. The server creates relay log files in sequence by adding a numeric suffix to the base name.host_name-relay-binDue to the manner in which MySQL parses server options, if you specify this option, you must supply a value; the default base name is used only if the option is not actually specified. If you use the
--relay-logoption without specifying a value, unexpected behavior is likely to result; this behavior depends on the other options used, the order in which they are specified, and whether they are specified on the command line or in an option file. For more information about how MySQL handles server options, see Section 4.2.3, “Specifying Program Options”.If you specify this option, the value specified is also used as the base name for the relay log index file. You can override this behavior by specifying a different relay log index file base name using the
--relay-log-indexoption.Starting with MySQL 5.6.5, when the server reads an entry from the index file, it checks whether the entry contains a relative path. If it does, the relative part of the path in replaced with the absolute path set using the
--relay-logoption. An absolute path remains unchanged; in such a case, the index must be edited manually to enable the new path or paths to be used. Prior to MySQL 5.6.5, manual intervention was required whenever relocating the binary log or relay log files. (Bug #11745230, Bug #12133)You may find the
--relay-logoption useful in performing the following tasks:Creating relay logs whose names are independent of host names.
If you need to put the relay logs in some area other than the data directory because your relay logs tend to be very large and you do not want to decrease
max_relay_log_size.To increase speed by using load-balancing between disks.
Beginning with MySQL 5.6.2, you can obtain the relay log filename (and path) from the
relay_log_basenamesystem variable. -
Property Value Command-Line Format --relay-log-index=file_nameSystem Variable relay_log_indexScope Global Dynamic No Type File name The name to use for the relay log index file. The default name is
in the data directory, wherehost_name-relay-bin.indexhost_nameis the name of the slave server.Due to the manner in which MySQL parses server options, if you specify this option, you must supply a value; the default base name is used only if the option is not actually specified. If you use the
--relay-log-indexoption without specifying a value, unexpected behavior is likely to result; this behavior depends on the other options used, the order in which they are specified, and whether they are specified on the command line or in an option file. For more information about how MySQL handles server options, see Section 4.2.3, “Specifying Program Options”. --relay-log-info-file=file_nameProperty Value Command-Line Format --relay-log-info-file=file_nameType File name Default Value relay-log.infoThe name to use for the file in which the slave records information about the relay logs. The default name is
relay-log.infoin the data directory. For information about the format of this file, see Section 17.2.2.2, “Slave Status Logs”.-
Property Value Command-Line Format --relay-log-purgeSystem Variable relay_log_purgeScope Global Dynamic Yes Type Boolean Default Value TRUEDisable or enable automatic purging of relay logs as soon as they are no longer needed. The default value is 1 (enabled). This is a global variable that can be changed dynamically with
SET GLOBAL relay_log_purge =. Disabling purging of relay logs when using theN--relay-log-recoveryoption puts data consistency at risk. -
Property Value Command-Line Format --relay-log-recoveryType Boolean Default Value FALSEEnables automatic relay log recovery immediately following server startup. The recovery process creates a new relay log file, initializes the SQL thread position to this new relay log, and initializes the I/O thread to the SQL thread position. Reading of the relay log from the master then continues. This should be used following an unexpected halt of a replication slave to ensure that no possibly corrupted relay logs are processed. The default value is 0 (disabled).
Enabling the
--relay-log-recoveryoption whenrelay-log-purgeis disabled risks reading the relay log from files that were not purged, leading to data inconsistency.This option can be used to make replication slaves resilient to unexpected halts. See Section 17.3.2, “Handling an Unexpected Halt of a Replication Slave”, for more information.
Prior to MySQL 5.6.6, if this option is enabled for a multithreaded slave, and the slave fails with errors, you cannot execute
CHANGE MASTER TOon that slave. In MySQL 5.6.6 or later, you can useSTART SLAVE UNTIL SQL_AFTER_MTS_GAPSto ensure that any gaps in the relay log are processed; after running this statement, you can then useCHANGE MASTER TOto fail this slave over to a new master. (Bug #13893363) -
Property Value Command-Line Format --relay-log-space-limit=#System Variable relay_log_space_limitScope Global Dynamic No Type Integer Default Value 0Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295This option places an upper limit on the total size in bytes of all relay logs on the slave. A value of 0 means “no limit”. This is useful for a slave server host that has limited disk space. When the limit is reached, the I/O thread stops reading binary log events from the master server until the SQL thread has caught up and deleted some unused relay logs. Note that this limit is not absolute: There are cases where the SQL thread needs more events before it can delete relay logs. In that case, the I/O thread exceeds the limit until it becomes possible for the SQL thread to delete some relay logs because not doing so would cause a deadlock. You should not set
--relay-log-space-limitto less than twice the value of--max-relay-log-size(or--max-binlog-sizeif--max-relay-log-sizeis 0). In that case, there is a chance that the I/O thread waits for free space because--relay-log-space-limitis exceeded, but the SQL thread has no relay log to purge and is unable to satisfy the I/O thread. This forces the I/O thread to ignore--relay-log-space-limittemporarily. -
Property Value Command-Line Format --replicate-do-db=nameType String The effects of this option depend on whether statement-based or row-based replication is in use.
Statement-based replication. Tell the slave SQL thread to restrict replication to statements where the default database (that is, the one selected by
USE) isdb_name. To specify more than one database, use this option multiple times, once for each database; however, doing so does not replicate cross-database statements such asUPDATEwhile a different database (or no database) is selected.some_db.some_tableSET foo='bar'WarningTo specify multiple databases you must use multiple instances of this option. Because database names can contain commas, if you supply a comma separated list then the list will be treated as the name of a single database.
An example of what does not work as you might expect when using statement-based replication: If the slave is started with
--replicate-do-db=salesand you issue the following statements on the master, theUPDATEstatement is not replicated:USE prices; UPDATE sales.january SET amount=amount+1000;The main reason for this “check just the default database” behavior is that it is difficult from the statement alone to know whether it should be replicated (for example, if you are using multiple-table
DELETEstatements or multiple-tableUPDATEstatements that act across multiple databases). It is also faster to check only the default database rather than all databases if there is no need.Row-based replication. Tells the slave SQL thread to restrict replication to database
db_name. Only tables belonging todb_nameare changed; the current database has no effect on this. Suppose that the slave is started with--replicate-do-db=salesand row-based replication is in effect, and then the following statements are run on the master:USE prices; UPDATE sales.february SET amount=amount+100;The
februarytable in thesalesdatabase on the slave is changed in accordance with theUPDATEstatement; this occurs whether or not theUSEstatement was issued. However, issuing the following statements on the master has no effect on the slave when using row-based replication and--replicate-do-db=sales:USE prices; UPDATE prices.march SET amount=amount-25;Even if the statement
USE priceswere changed toUSE sales, theUPDATEstatement's effects would still not be replicated.Another important difference in how
--replicate-do-dbis handled in statement-based replication as opposed to row-based replication occurs with regard to statements that refer to multiple databases. Suppose that the slave is started with--replicate-do-db=db1, and the following statements are executed on the master:USE db1; UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;If you are using statement-based replication, then both tables are updated on the slave. However, when using row-based replication, only
table1is affected on the slave; sincetable2is in a different database,table2on the slave is not changed by theUPDATE. Now suppose that, instead of theUSE db1statement, aUSE db4statement had been used:USE db4; UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;In this case, the
UPDATEstatement would have no effect on the slave when using statement-based replication. However, if you are using row-based replication, theUPDATEwould changetable1on the slave, but nottable2—in other words, only tables in the database named by--replicate-do-dbare changed, and the choice of default database has no effect on this behavior.If you need cross-database updates to work, use
--replicate-wild-do-table=instead. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.db_name.%NoteThis option affects replication in the same manner that
--binlog-do-dbaffects binary logging, and the effects of the replication format on how--replicate-do-dbaffects replication behavior are the same as those of the logging format on the behavior of--binlog-do-db.This option has no effect on
BEGIN,COMMIT, orROLLBACKstatements. -
Property Value Command-Line Format --replicate-ignore-db=nameType String As with
--replicate-do-db, the effects of this option depend on whether statement-based or row-based replication is in use.Statement-based replication. Tells the slave SQL thread not to replicate any statement where the default database (that is, the one selected by
USE) isdb_name.Row-based replication. Tells the slave SQL thread not to update any tables in the database
db_name. The default database has no effect.When using statement-based replication, the following example does not work as you might expect. Suppose that the slave is started with
--replicate-ignore-db=salesand you issue the following statements on the master:USE prices; UPDATE sales.january SET amount=amount+1000;The
UPDATEstatement is replicated in such a case because--replicate-ignore-dbapplies only to the default database (determined by theUSEstatement). Because thesalesdatabase was specified explicitly in the statement, the statement has not been filtered. However, when using row-based replication, theUPDATEstatement's effects are not propagated to the slave, and the slave's copy of thesales.januarytable is unchanged; in this instance,--replicate-ignore-db=salescauses all changes made to tables in the master's copy of thesalesdatabase to be ignored by the slave.To specify more than one database to ignore, use this option multiple times, once for each database. Because database names can contain commas, if you supply a comma separated list then the list will be treated as the name of a single database.
You should not use this option if you are using cross-database updates and you do not want these updates to be replicated. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.
If you need cross-database updates to work, use
--replicate-wild-ignore-table=instead. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.db_name.%NoteThis option affects replication in the same manner that
--binlog-ignore-dbaffects binary logging, and the effects of the replication format on how--replicate-ignore-dbaffects replication behavior are the same as those of the logging format on the behavior of--binlog-ignore-db.This option has no effect on
BEGIN,COMMIT, orROLLBACKstatements. --replicate-do-table=db_name.tbl_nameProperty Value Command-Line Format --replicate-do-table=nameType String Creates a replication filter by telling the slave SQL thread to restrict replication to a given table. To specify more than one table, use this option multiple times, once for each table. This works for both cross-database updates and default database updates, in contrast to
--replicate-do-db. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.This option affects only statements that apply to tables. It does not affect statements that apply only to other database objects, such as stored routines. To filter statements operating on stored routines, use one or more of the
--replicate-*-dboptions.--replicate-ignore-table=db_name.tbl_nameProperty Value Command-Line Format --replicate-ignore-table=nameType String Creates a replication filter by telling the slave SQL thread not to replicate any statement that updates the specified table, even if any other tables might be updated by the same statement. To specify more than one table to ignore, use this option multiple times, once for each table. This works for cross-database updates, in contrast to
--replicate-ignore-db. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.This option affects only statements that apply to tables. It does not affect statements that apply only to other database objects, such as stored routines. To filter statements operating on stored routines, use one or more of the
--replicate-*-dboptions.--replicate-rewrite-db=from_name->to_nameProperty Value Command-Line Format --replicate-rewrite-db=old_name->new_nameType String Tells the slave to create a replication filter that translates the default database (that is, the one selected by
USE) toto_nameif it wasfrom_nameon the master. Only statements involving tables are affected (not statements such asCREATE DATABASE,DROP DATABASE, andALTER DATABASE), and only iffrom_nameis the default database on the master. To specify multiple rewrites, use this option multiple times. The server uses the first one with afrom_namevalue that matches. The database name translation is done before the--replicate-*rules are tested.Statements in which table names are qualified with database names when using this option do not work with table-level replication filtering options such as
--replicate-do-table. Suppose we have a database namedaon the master, one namedbon the slave, each containing a tablet, and have started the master with--replicate-rewrite-db='a->b'. At a later point in time, we executeDELETE FROM a.t. In this case, no relevant filtering rule works, for the reasons shown here:--replicate-do-table=a.tdoes not work because the slave has tabletin databaseb.--replicate-do-table=b.tdoes not match the original statement and so is ignored.--replicate-do-table=*.tis handled identically to--replicate-do-table=a.t, and thus does not work, either.
Similarly, the
--replication-rewrite-dboption does not work with cross-database updates.If you use this option on the command line and the
>character is special to your command interpreter, quote the option value. For example:shell> mysqld --replicate-rewrite-db="olddb->newdb"NotePrior to MySQL 5.6.7, multithreaded slaves did not honor this option correctly. (Bug #14232958)
-
Property Value Command-Line Format --replicate-same-server-idType Boolean Default Value FALSETo be used on slave servers. Usually you should use the default setting of 0, to prevent infinite loops caused by circular replication. If set to 1, the slave does not skip events having its own server ID. Normally, this is useful only in rare configurations. Cannot be set to 1 if
--log-slave-updatesis used. By default, the slave I/O thread does not write binary log events to the relay log if they have the slave's server ID (this optimization helps save disk usage). If you want to use--replicate-same-server-id, be sure to start the slave with this option before you make the slave read its own events that you want the slave SQL thread to execute. --replicate-wild-do-table=db_name.tbl_nameProperty Value Command-Line Format --replicate-wild-do-table=nameType String Creates a replication filter by telling the slave thread to restrict replication to statements where any of the updated tables match the specified database and table name patterns. Patterns can contain the
%and_wildcard characters, which have the same meaning as for theLIKEpattern-matching operator. To specify more than one table, use this option multiple times, once for each table. This works for cross-database updates. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.This option applies to tables, views, and triggers. It does not apply to stored procedures and functions, or events. To filter statements operating on the latter objects, use one or more of the
--replicate-*-dboptions.Example:
--replicate-wild-do-table=foo%.bar%replicates only updates that use a table where the database name starts withfooand the table name starts withbar.If the table name pattern is
%, it matches any table name and the option also applies to database-level statements (CREATE DATABASE,DROP DATABASE, andALTER DATABASE). For example, if you use--replicate-wild-do-table=foo%.%, database-level statements are replicated if the database name matches the patternfoo%.To include literal wildcard characters in the database or table name patterns, escape them with a backslash. For example, to replicate all tables of a database that is named
my_own%db, but not replicate tables from themy1ownAABCdbdatabase, you should escape the_and%characters like this:--replicate-wild-do-table=my\_own\%db. If you use the option on the command line, you might need to double the backslashes or quote the option value, depending on your command interpreter. For example, with the bash shell, you would need to type--replicate-wild-do-table=my\\_own\\%db.--replicate-wild-ignore-table=db_name.tbl_nameProperty Value Command-Line Format --replicate-wild-ignore-table=nameType String Creates a replication filter which keeps the slave thread from replicating a statement in which any table matches the given wildcard pattern. To specify more than one table to ignore, use this option multiple times, once for each table. This works for cross-database updates. See Section 17.2.3, “How Servers Evaluate Replication Filtering Rules”.
Example:
--replicate-wild-ignore-table=foo%.bar%does not replicate updates that use a table where the database name starts withfooand the table name starts withbar.For information about how matching works, see the description of the
--replicate-wild-do-tableoption. The rules for including literal wildcard characters in the option value are the same as for--replicate-wild-ignore-tableas well.-
Property Value Command-Line Format --report-host=host_nameSystem Variable report_hostScope Global Dynamic No Type String The host name or IP address of the slave to be reported to the master during slave registration. This value appears in the output of
SHOW SLAVE HOSTSon the master server. Leave the value unset if you do not want the slave to register itself with the master.NoteIt is not sufficient for the master to simply read the IP address of the slave from the TCP/IP socket after the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.
-
Property Value Command-Line Format --report-password=nameSystem Variable report_passwordScope Global Dynamic No Type String The account password of the slave to be reported to the master during slave registration. This value appears in the output of
SHOW SLAVE HOSTSon the master server if the master was started with--show-slave-auth-info.Although the name of this option might imply otherwise,
--report-passwordis not connected to the MySQL user privilege system and so is not necessarily (or even likely to be) the same as the password for the MySQL replication user account. -
Property Value Command-Line Format --report-port=#System Variable report_portScope Global Dynamic No Type Integer Default Value (>= 5.6.5) [slave_port]Default Value (<= 5.6.4) 0Minimum Value 0Maximum Value 65535The TCP/IP port number for connecting to the slave, to be reported to the master during slave registration. Set this only if the slave is listening on a nondefault port or if you have a special tunnel from the master or other clients to the slave. If you are not sure, do not use this option.
Prior to MySQL 5.6.5, the default value for this option was 3306. In MySQL 5.6.5 and later, the value shown is the port number actually used by the slave (Bug #13333431). This change also affects the default value displayed by
SHOW SLAVE HOSTS. -
Property Value Command-Line Format --report-user=nameSystem Variable report_userScope Global Dynamic No Type String The account user name of the slave to be reported to the master during slave registration. This value appears in the output of
SHOW SLAVE HOSTSon the master server if the master was started with--show-slave-auth-info.Although the name of this option might imply otherwise,
--report-useris not connected to the MySQL user privilege system and so is not necessarily (or even likely to be) the same as the name of the MySQL replication user account. -
Property Value Command-Line Format --slave-checkpoint-group=#Introduced 5.6.3 Type Integer Default Value 512Minimum Value 32Maximum Value 524280Block Size 8Sets the maximum number of transactions that can be processed by a multithreaded slave before a checkpoint operation is called to update its status as shown by
SHOW SLAVE STATUS. Setting this option has no effect on slaves for which multithreading is not enabled.NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this option. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
This option works in combination with the
--slave-checkpoint-periodoption in such a way that, when either limit is exceeded, the checkpoint is executed and the counters tracking both the number of transactions and the time elapsed since the last checkpoint are reset.The minimum allowed value for this option is 32, unless the server was built using
-DWITH_DEBUG, in which case the minimum value is 1. The effective value is always a multiple of 8; you can set it to a value that is not such a multiple, but the server rounds it down to the next lower multiple of 8 before storing the value. (Exception: No such rounding is performed by the debug server.) Regardless of how the server was built, the default value is 512, and the maximum allowed value is 524280.--slave-checkpoint-groupwas added in MySQL 5.6.3. -
Property Value Command-Line Format --slave-checkpoint-period=#Introduced 5.6.3 Type Integer Default Value 300Minimum Value 1Maximum Value 4GSets the maximum time (in milliseconds) that is allowed to pass before a checkpoint operation is called to update the status of a multithreaded slave as shown by
SHOW SLAVE STATUS. Setting this option has no effect on slaves for which multithreading is not enabled.NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this option. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
This option works in combination with the
--slave-checkpoint-groupoption in such a way that, when either limit is exceeded, the checkpoint is executed and the counters tracking both the number of transactions and the time elapsed since the last checkpoint are reset.The minimum allowed value for this option is 1, unless the server was built using
-DWITH_DEBUG, in which case the minimum value is 0. Regardless of how the server was built, the default value is 300, and the maximum possible value is 4294967296 (4GB).--slave-checkpoint-periodwas added in MySQL 5.6.3. -
Property Value Command-Line Format --slave-parallel-workers=#Introduced 5.6.3 Type Integer Default Value 0Minimum Value 0Maximum Value 1024Sets the number of slave worker threads for executing replication events (transactions) in parallel. Setting this variable to 0 (the default) disables parallel execution. The maximum is 1024.
NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this option. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
When parallel execution is enabled, the slave SQL thread acts as the coordinator for the slave worker threads, among which transactions are distributed on a per-database basis. This means that a worker thread on the slave slave can process successive transactions on a given database without waiting for updates to other databases to complete. The current implementation of multithreading on the slave assumes that the data is partitioned per database, and that updates within a given database occur in the same relative order as they do on the master, in order to work correctly. However, transactions do not need to be coordinated between any two databases.
Due to the fact that transactions on different databases can occur in a different order on the slave than on the master, checking for the most recently executed transaction does not guarantee that all previous transactions from the master have been executed on the slave. This has implications for logging and recovery when using a multithreaded slave. For information about how to interpret binary logging information when using multithreading on the slave, see Section 13.7.5.35, “SHOW SLAVE STATUS Syntax”. In addition, this means that
START SLAVE UNTILis not supported with a multithreaded slave.When multithreading is enabled,
slave_transaction_retriesis treated as equal to 0, and cannot be changed. (Currently, retrying of transactions is not supported with multithreaded slaves.)You should also note that, in MySQL 5.6.7 and later, enforcing foreign key relationships between tables in different databases causes multithreaded slaves to use sequential rather than parallel mode, which can have a negative impact on performance. (Bug #14092635)
This option was added in MySQL 5.6.3.
NoteThe value set for this option (or for the corresponding
slave_parallel_workerssystem variable) was not always honored correctly in MySQL 5.6.3; this problem was fixed in MySQL 5.6.4 (Bug #13334470). --slave-pending-jobs-size-max=#Property Value Command-Line Format --slave-pending-jobs-size-max=#Introduced 5.6.3 Type Integer Default Value 16MMinimum Value 1024Maximum Value 16EiBBlock Size 1024For multithreaded slaves, this option sets the maximum amount of memory (in bytes) available to slave worker queues holding events not yet applied. Setting this option has no effect on slaves for which multithreading is not enabled.
The minimum possible value for this option is 1024; the default is 16MB. The maximum possible value is 18446744073709551615 (16 exabytes). Values that are not exact multiples of 1024 are rounded down to the next-highest multiple of 1024 prior to being stored.
The value of this variable is a soft limit and can be set to match the normal workload. If an unusually large event exceeds this size, the transaction is held until all the slave workers have empty queues, and then processed. All subsequent transactions are held until the large transaction has been completed.
This option was added in MySQL 5.6.3.
-
Property Value Command-Line Format --skip-slave-startType Boolean Default Value FALSETells the slave server not to start the slave threads when the server starts. To start the threads later, use a
START SLAVEstatement. --slave_compressed_protocol={0|1}Property Value Command-Line Format --slave-compressed-protocolSystem Variable slave_compressed_protocolScope Global Dynamic Yes Type Boolean Default Value OFFIf this option is set to 1, use compression for the slave/master protocol if both the slave and the master support it. The default is 0 (no compression).
-
Property Value Command-Line Format --slave-load-tmpdir=dir_nameSystem Variable slave_load_tmpdirScope Global Dynamic No Type Directory name Default Value /tmpThe name of the directory where the slave creates temporary files. This option is by default equal to the value of the
tmpdirsystem variable. When the slave SQL thread replicates aLOAD DATA INFILEstatement, it extracts the file to be loaded from the relay log into temporary files, and then loads these into the table. If the file loaded on the master is huge, the temporary files on the slave are huge, too. Therefore, it might be advisable to use this option to tell the slave to put temporary files in a directory located in some file system that has a lot of available space. In that case, the relay logs are huge as well, so you might also want to use the--relay-logoption to place the relay logs in that file system.The directory specified by this option should be located in a disk-based file system (not a memory-based file system) because the temporary files used to replicate
LOAD DATA INFILEmust survive machine restarts. The directory also should not be one that is cleared by the operating system during the system startup process. slave-max-allowed-packet=bytesProperty Value Command-Line Format --slave-max-allowed-packet=#Introduced 5.6.6 Type Integer Default Value 1073741824Minimum Value 1024Maximum Value 1073741824In MySQL 5.6.6 and later, this option sets the maximum packet size in bytes for the slave SQL and I/O threads, so that large updates using row-based replication do not cause replication to fail because an update exceeded
max_allowed_packet. (Bug #12400221, Bug #60926)The corresponding server variable
slave_max_allowed_packetalways has a value that is a positive integer multiple of 1024; if you set it to some value that is not such a multiple, the value is automatically rounded down to the next highest multiple of 1024. (For example, if you start the server with--slave-max-allowed-packet=10000, the value used is 9216; setting 0 as the value causes 1024 to be used.) A truncation warning is issued in such cases.The maximum (and default) value is 1073741824 (1 GB); the minimum is 1024.
-
Property Value Command-Line Format --slave-net-timeout=#System Variable slave_net_timeoutScope Global Dynamic Yes Type Integer Default Value 3600Minimum Value 1The number of seconds to wait for more data from the master before the slave considers the connection broken, aborts the read, and tries to reconnect. The first retry occurs immediately after the timeout. The interval between retries is controlled by the
MASTER_CONNECT_RETRYoption for theCHANGE MASTER TOstatement, and the number of reconnection attempts is limited by the--master-retry-countoption. The default is 3600 seconds (one hour). slave-rows-search-algorithms=listProperty Value Command-Line Format --slave-rows-search-algorithms=listIntroduced 5.6.6 Type Set Default Value TABLE_SCAN,INDEX_SCANValid Values TABLE_SCAN,INDEX_SCANINDEX_SCAN,HASH_SCANTABLE_SCAN,HASH_SCANTABLE_SCAN,INDEX_SCAN,HASH_SCAN(equivalent to INDEX_SCAN,HASH_SCAN)When preparing batches of rows for row-based logging and replication, this option controls how the rows are searched for matches—that is, whether or not hashing is used for searches using a primary or unique key, some other key, or no key at all. The option sets the initial value for the
slave_rows_search_algorithmssystem variable.Specify a comma-separated list of any 2 (or all 3) values from the list
INDEX_SCAN,TABLE_SCAN,HASH_SCAN. The list need not be quoted, but must contain no spaces, whether or not quotes are used. Possible combinations (lists) and their effects are shown in the following table:Index used / option value INDEX_SCAN,HASH_SCANorINDEX_SCAN,TABLE_SCAN,HASH_SCANINDEX_SCAN,TABLE_SCANTABLE_SCAN,HASH_SCANPrimary key or unique key Index scan Index scan Hash scan over index (Other) Key Hash scan over index Index scan Hash scan over index No index Hash scan Table scan Hash scan The order in which the algorithms are specified in the list does not make any difference in the order in which they are displayed by a
SELECTorSHOW VARIABLESstatement (which is the same as that used in the table just shown previously).The default value is
TABLE_SCAN,INDEX_SCAN, which means that all searches that can use indexes do use them, and searches without any indexes use table scans.To use hashing for any searches that do not use a primary or unique key, set this option to
INDEX_SCAN,HASH_SCAN. SpecifyingINDEX_SCAN,TABLE_SCAN,HASH_SCANhas the same effect as specifyingINDEX_SCAN,HASH_SCAN.To force hashing for all searches, set this option to
TABLE_SCAN,HASH_SCAN.
It is possible to specify single values for this option, but this is not optimal, because setting a single value limits searches to using only that algorithm. In particular, setting
INDEX_SCANalone is not recommended, as in that case searches are unable to find rows at all if no index is present.NoteThere is only a performance advantage for
INDEX_SCANandHASH_SCANif the row events are big enough. The size of row events is configured using--binlog-row-event-max-size. For example, suppose aDELETEstatement which deletes 25,000 rows generates largeDelete_row_eventevents. In this case ifslave_rows_search_algorithmsis set toINDEX_SCANorHASH_SCANthere is a performance improvement. However, if there are 25,000DELETEstatements and each is represented by a separate event then settingslave_rows_search_algorithmstoINDEX_SCANorHASH_SCANprovides no performance improvement while executing these separate events.This option was added in MySQL 5.6.6.
--slave-skip-errors=[err_code1,err_code2,...|all|ddl_exist_errors]Property Value Command-Line Format --slave-skip-errors=nameSystem Variable slave_skip_errorsScope Global Dynamic No Type String Default Value OFFValid Values OFF[list of error codes]allddl_exist_errorsNormally, replication stops when an error occurs on the slave. This gives you the opportunity to resolve the inconsistency in the data manually. This option tells the slave SQL thread to continue replication when a statement returns any of the errors listed in the option value.
Do not use this option unless you fully understand why you are getting errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, an error that stops replication should never occur. Indiscriminate use of this option results in slaves becoming hopelessly out of synchrony with the master, with you having no idea why this has occurred.
For error codes, you should use the numbers provided by the error message in your slave error log and in the output of
SHOW SLAVE STATUS. Appendix B, Errors, Error Codes, and Common Problems, lists server error codes.You can also (but should not) use the very nonrecommended value of
allto cause the slave to ignore all error messages and keeps going regardless of what happens. Needless to say, if you useall, there are no guarantees regarding the integrity of your data. Please do not complain (or file bug reports) in this case if the slave's data is not anywhere close to what it is on the master. You have been warned.MySQL 5.6 as well as MySQL NDB Cluster 7.3 and later support an additional shorthand value
ddl_exist_errors, which is equivalent to the error code list1007,1008,1050,1051,1054,1060,1061,1068,1094,1146.Examples:
--slave-skip-errors=1062,1053 --slave-skip-errors=all --slave-skip-errors=ddl_exist_errors--slave-sql-verify-checksum={0|1}Property Value Command-Line Format --slave-sql-verify-checksum=valueIntroduced 5.6.2 Type Boolean Default Value 1Valid Values 01When this option is enabled, the slave examines checksums read from the relay log, in the event of a mismatch, the slave stops with an error.
This option was added in MySQL 5.6.2.
MySQL 5.6 and later supports logging of replication slave status information to tables rather than files. Writing of the master info log and the relay log info log can be configured separately using two server options added in MySQL 5.6.2 and listed here:
--master-info-repository={FILE|TABLE}Property Value Command-Line Format --master-info-repository=FILE|TABLEIntroduced 5.6.2 Type String Default Value FILEValid Values FILETABLEThis option causes the server to write its master info log to a file or a table. The name of the file defaults to
master.info; you can change the name of the file using the--master-info-fileserver option.The default value for this option is
FILE. If you useTABLE, the log is written to theslave_master_infotable in themysqldatabase.The
--master-info-repositoryoption was added in MySQL 5.6.2.--relay-log-info-repository={FILE|TABLE}Property Value Command-Line Format --relay-log-info-repository=FILE|TABLEIntroduced 5.6.2 Type String Default Value FILEValid Values FILETABLEThis option causes the server to log its relay log info to a file or a table. The name of the file defaults to
relay-log.info; you can change the name of the file using the--relay-log-info-fileserver option.The default value for this option is
FILE. If you useTABLE, the log is written to theslave_relay_log_infotable in themysqldatabase.This option can be used to make replication slaves resilient to unexpected halts. See Section 17.3.2, “Handling an Unexpected Halt of a Replication Slave”, for more information.
The
--relay-log-info-repositoryoption was added in MySQL 5.6.2.
The info log tables and their contents are considered local to a given MySQL Server. In MySQL 5.6.9 and later, they are not replicated, and changes to them are not written to the binary log. (Bug #14741537)
For more information, see Section 17.2.2, “Replication Relay and Status Logs”.
The following options are removed in MySQL
5.5. If you attempt to start
mysqld with any of these options in MySQL
5.6, the server aborts with an unknown
variable error. To set the replication
parameters formerly associated with these options, you must use
the CHANGE MASTER TO ... statement (see
Section 13.4.2.1, “CHANGE MASTER TO Syntax”).
The options affected are shown in this list:
The following list describes system variables for controlling
replication slave servers. They can be set at server startup and
some of them can be changed at runtime using
SET.
Server options used with replication slaves are listed earlier
in this section.
-
Property Value Command-Line Format --init-slave=nameSystem Variable init_slaveScope Global Dynamic Yes Type String This variable is similar to
init_connect, but is a string to be executed by a slave server each time the SQL thread starts. The format of the string is the same as for theinit_connectvariable.NoteThe SQL thread sends an acknowledgment to the client before it executes
init_slave. Therefore, it is not guaranteed thatinit_slavehas been executed whenSTART SLAVEreturns. See Section 13.4.2.5, “START SLAVE Syntax”, for more information. -
Property Value Introduced 5.6.11 System Variable log_slow_slave_statementsScope Global Dynamic Yes Type Boolean Default Value OFFWhen the slow query log is enabled, this variable enables logging for queries that have taken more than
long_query_timeseconds to execute on the slave. This variable was added in MySQL 5.6.11.Note that all statements logged in row format in the master will not be logged in the slave's slow log, even if
log_slow_slave_statementsis enabled. -
Property Value Command-Line Format --master-info-repository=FILE|TABLEIntroduced 5.6.2 System Variable master_info_repositoryScope Global Dynamic Yes Type String Default Value FILEValid Values FILETABLEThe setting of this variable determines whether the slave logs master status and connection information to a
FILE(master.info), or to aTABLE(mysql.slave_master_info).The setting of this variable also has a direct bearing on the effect had by the setting of the
sync_master_infosystem variable; see that variable's description for further information.This variable was added in MySQL 5.6.2.
-
Property Value Command-Line Format --max-relay-log-size=#System Variable max_relay_log_sizeScope Global Dynamic Yes Type Integer Default Value 0Minimum Value 0Maximum Value 1073741824If a write by a replication slave to its relay log causes the current log file size to exceed the value of this variable, the slave rotates the relay logs (closes the current file and opens the next one). If
max_relay_log_sizeis 0, the server usesmax_binlog_sizefor both the binary log and the relay log. Ifmax_relay_log_sizeis greater than 0, it constrains the size of the relay log, which enables you to have different sizes for the two logs. You must setmax_relay_log_sizeto between 4096 bytes and 1GB (inclusive), or to 0. The default value is 0. See Section 17.2.1, “Replication Implementation Details”. -
Property Value Command-Line Format --relay-log=file_nameSystem Variable relay_logScope Global Dynamic No Type File name The name of the relay log file.
-
Property Value Introduced 5.6.2 System Variable relay_log_basenameScope Global Dynamic No Type File name Default Value datadir + '/' + hostname + '-relay-bin'Holds the name and complete path to the relay log file.
The
relay_log_basenamesystem variable was added in MySQL 5.6.2. -
Property Value Command-Line Format --relay-log-indexSystem Variable relay_log_indexScope Global Dynamic No Type File name Default Value *host_name*-relay-bin.indexThe name of the relay log index file. The default name is
in the data directory, wherehost_name-relay-bin.indexhost_nameis the name of the slave server. -
Property Value Command-Line Format --relay-log-info-file=file_nameSystem Variable relay_log_info_fileScope Global Dynamic No Type File name Default Value relay-log.infoThe name of the file in which the slave records information about the relay logs. The default name is
relay-log.infoin the data directory. -
Property Value Introduced 5.6.2 System Variable relay_log_info_repositoryScope Global Dynamic Yes Type String Default Value FILEValid Values FILETABLEThis variable determines whether the slave's position in the relay logs is written to a
FILE(relay-log.info) or to aTABLE(mysql.slave_relay_log_info).The setting of this variable also has a direct bearing on the effect had by the setting of the
sync_relay_log_infosystem variable; see that variable's descrption for further information.This variable was added in MySQL 5.6.2.
-
Property Value Command-Line Format --relay-log-purgeSystem Variable relay_log_purgeScope Global Dynamic Yes Type Boolean Default Value TRUEDisables or enables automatic purging of relay log files as soon as they are not needed any more. The default value is 1 (
ON). -
Property Value Command-Line Format --relay-log-recoverySystem Variable relay_log_recoveryScope Global Dynamic (>= 5.6.6) No Dynamic (<= 5.6.5) Yes Type Boolean Default Value FALSEEnables automatic relay log recovery immediately following server startup. The recovery process creates a new relay log file, initializes the SQL thread position to this new relay log, and initializes the I/O thread to the SQL thread position. Reading of the relay log from the master then continues. In MySQL 5.6.5 and earlier, it was possible to change this global variable dynamically; beginning with MySQL 5.6.6, it is read-only. (Bug #13840948) Regardless of the MySQL Server version, its value can be changed by starting the slave with the
--relay-log-recoveryoption, which should be used following a unexpected halt on the replication slave to ensure that no possibly corrupted relay logs are processed. See Section 17.3.2, “Handling an Unexpected Halt of a Replication Slave” for more information.When
relay_log_recoveryis enabled and the slave has stopped due to errors encountered while running in multithreaded mode, you cannot executeCHANGE MASTER TOif there are any gaps in the log. Beginning with MySQL 5.6.6, you should useSTART SLAVE UNTIL SQL_AFTER_MTS_GAPSto ensure that all gaps are processed before switching back to single-threaded mode or executing aCHANGE MASTER TOstatement. -
Property Value Command-Line Format --relay-log-space-limit=#System Variable relay_log_space_limitScope Global Dynamic No Type Integer Default Value 0Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295The maximum amount of space to use for all relay logs.
-
Property Value Command-Line Format --report-host=host_nameSystem Variable report_hostScope Global Dynamic No Type String The value of the
--report-hostoption. -
Property Value Command-Line Format --report-password=nameSystem Variable report_passwordScope Global Dynamic No Type String The value of the
--report-passwordoption. Not the same as the password used for the MySQL replication user account. -
Property Value Command-Line Format --report-port=#System Variable report_portScope Global Dynamic No Type Integer Default Value (>= 5.6.5) [slave_port]Default Value (<= 5.6.4) 0Minimum Value 0Maximum Value 65535The value of the
--report-portoption. -
Property Value Command-Line Format --report-user=nameSystem Variable report_userScope Global Dynamic No Type String The value of the
--report-useroption. Not the same as the name for the MySQL replication user account. -
Property Value System Variable rpl_semi_sync_slave_enabledScope Global Dynamic Yes Type Boolean Default Value OFFControls whether semisynchronous replication is enabled on the slave. To enable or disable the plugin, set this variable to
ONorOFF(or 1 or 0), respectively. The default isOFF.This variable is available only if the slave-side semisynchronous replication plugin is installed.
rpl_semi_sync_slave_trace_levelProperty Value System Variable rpl_semi_sync_slave_trace_levelScope Global Dynamic Yes Type Integer Default Value 32The semisynchronous replication debug trace level on the slave. See
rpl_semi_sync_master_trace_levelfor the permissible values.This variable is available only if the slave-side semisynchronous replication plugin is installed.
-
Property Value Command-Line Format --rpl-stop-slave-timeout=secondsIntroduced 5.6.13 System Variable rpl_stop_slave_timeoutScope Global Dynamic Yes Type Integer Default Value 31536000Minimum Value 2Maximum Value 31536000In MySQL 5.6.13 and later, you can control the length of time (in seconds) that
STOP SLAVEwaits before timing out by setting this variable. This can be used to avoid deadlocks betweenSTOP SLAVEand other slave SQL statements using different client connections to the slave.The maximum and default value of
rpl_stop_slave_timeoutis 31536000 seconds (1 year). The minimum is 2 seconds. Changes to this variable take effect for subsequentSTOP SLAVEstatements.This variable affects only the client that issues a
STOP SLAVEstatement. When the timeout is reached, the issuing client returns an error message stating that the command execution is incomplete. The client then stops waiting for the slave threads to stop, but the slave threads continue to try to stop, and theSTOP SLAVEinstruction remains in effect. Once the slave threads are no longer busy, theSTOP SLAVEstatement is executed and the slave stops. -
Property Value Command-Line Format --slave-checkpoint-group=#Introduced 5.6.3 System Variable slave_checkpoint_group=#Scope Global Dynamic Yes Type Integer Default Value 512Minimum Value 32Maximum Value 524280Block Size 8Sets the maximum number of transactions that can be processed by a multithreaded slave before a checkpoint operation is called to update its status as shown by
SHOW SLAVE STATUS. Setting this variable has no effect on slaves for which multithreading is not enabled.NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this variable. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
This variable works in combination with the
slave_checkpoint_periodsystem variable in such a way that, when either limit is exceeded, the checkpoint is executed and the counters tracking both the number of transactions and the time elapsed since the last checkpoint are reset.The minimum allowed value for this variable is 32, unless the server was built using
-DWITH_DEBUG, in which case the minimum value is 1. The effective value is always a multiple of 8; you can set it to a value that is not such a multiple, but the server rounds it down to the next lower multiple of 8 before storing the value. (Exception: No such rounding is performed by the debug server.) Regardless of how the server was built, the default value is 512, and the maximum allowed value is 524280.slave_checkpoint_groupwas added in MySQL 5.6.3. -
Property Value Command-Line Format --slave-checkpoint-period=#Introduced 5.6.3 System Variable slave_checkpoint_period=#Scope Global Dynamic Yes Type Integer Default Value 300Minimum Value 1Maximum Value 4GSets the maximum time (in milliseconds) that is allowed to pass before a checkpoint operation is called to update the status of a multithreaded slave as shown by
SHOW SLAVE STATUS. Setting this variable has no effect on slaves for which multithreading is not enabled.NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this variable. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
This variable works in combination with the
slave_checkpoint_groupsystem variable in such a way that, when either limit is exceeded, the checkpoint is executed and the counters tracking both the number of transactions and the time elapsed since the last checkpoint are reset.The minimum allowed value for this variable is 1, unless the server was built using
-DWITH_DEBUG, in which case the minimum value is 0. Regardless of how the server was built, the default value is 300, and the maximum possible value is 4294967296 (4GB).slave_checkpoint_periodwas added in MySQL 5.6.3. -
Property Value Command-Line Format --slave-compressed-protocolSystem Variable slave_compressed_protocolScope Global Dynamic Yes Type Boolean Default Value OFFWhether to use compression of the slave/master protocol if both the slave and the master support it.
-
Property Value Command-Line Format --slave-exec-mode=modeSystem Variable slave_exec_modeScope Global Dynamic Yes Type Enumeration Default Value IDEMPOTENT(NDB)STRICT(Other)Valid Values IDEMPOTENTSTRICTControls how a slave thread resolves conflicts and errors during replication.
IDEMPOTENTmode causes suppression of duplicate-key and no-key-found errors;STRICTmeans no such suppression takes place.IDEMPOTENTmode is intended for use in multi-master replication, circular replication, and some other special replication scenarios for NDB Cluster Replication. (See Section 18.6.10, “NDB Cluster Replication: Multi-Master and Circular Replication”, and Section 18.6.11, “NDB Cluster Replication Conflict Resolution”, for more information.) NDB Cluster ignores any value explicitly set forslave_exec_mode, and always treats it asIDEMPOTENT.In MySQL Server 5.6,
STRICTmode is the default value.For storage engines other than
NDB,IDEMPOTENTmode should be used only when you are absolutely sure that duplicate-key errors and key-not-found errors can safely be ignored. It is meant to be used in fail-over scenarios for NDB Cluster where multi-master replication or circular replication is employed, and is not recommended for use in other cases. -
Property Value Command-Line Format --slave-load-tmpdir=dir_nameSystem Variable slave_load_tmpdirScope Global Dynamic No Type Directory name Default Value /tmpThe name of the directory where the slave creates temporary files for replicating
LOAD DATA INFILEstatements. -
Property Value Introduced 5.6.6 System Variable slave_max_allowed_packetScope Global Dynamic Yes Type Integer Default Value 1073741824Minimum Value 1024Maximum Value 1073741824In MySQL 5.6.6 and later, this variable sets the maximum packet size for the slave SQL and I/O threads, so that large updates using row-based replication do not cause replication to fail because an update exceeded
max_allowed_packet.This global variable always has a value that is a positive integer multiple of 1024; if you set it to some value that is not, the value is rounded down to the next highest multiple of 1024 for it is stored or used; setting
slave_max_allowed_packetto 0 causes 1024 to be used. (A truncation warning is issued in all such cases.) The default and maximum value is 1073741824 (1 GB); the minimum is 1024.slave_max_allowed_packetcan also be set at startup, using the--slave-max-allowed-packetoption. -
Property Value Command-Line Format --slave-net-timeout=#System Variable slave_net_timeoutScope Global Dynamic Yes Type Integer Default Value 3600Minimum Value 1The number of seconds to wait for more data from a master/slave connection before aborting the read.
-
Property Value Command-Line Format --slave-parallel-workers=#Introduced 5.6.3 System Variable slave_parallel_workersScope Global Dynamic Yes Type Integer Default Value 0Minimum Value 0Maximum Value 1024Sets the number of slave worker threads for executing replication events (transactions) in parallel. Setting this variable to 0 (the default) disables parallel execution. The maximum is 1024.
NoteMultithreaded slaves are not currently supported by NDB Cluster, which silently ignores the setting for this variable. See Section 18.6.3, “Known Issues in NDB Cluster Replication”, for more information.
When parallel execution is enabled, the slave SQL thread acts as the coordinator for the slave worker threads, among which transactions are distributed on a per-database basis. This means that a worker thread on the slave slave can process successive transactions on a given database without waiting for updates to other databases to complete. The current implementation of multithreading on the slave assumes that the data is partitioned per database, and that updates within a given database occur in the same relative order as they do on the master, in order to work correctly. However, transactions do not need to be coordinated between any two databases.
Due to the fact that transactions on different databases can occur in a different order on the slave than on the master, checking for the most recently executed transaction does not guarantee that all previous transactions from the master have been executed on the slave. This has implications for logging and recovery when using a multithreaded slave. For information about how to interpret binary logging information when using multithreading on the slave, see Section 13.7.5.35, “SHOW SLAVE STATUS Syntax”. In addition, this means that
START SLAVE UNTILis not supported with a multithreaded slave.When multithreading is enabled,
slave_transaction_retriesis treated as equal to 0, and cannot be changed. (Currently, retrying of transactions is not supported with multithreaded slaves.)This variable was added in MySQL 5.6.3.
NoteThe value set for this variable (or for the corresponding
--slave-parallel-workersoption) was not always honored correctly in MySQL 5.6.3; this problem was fixed in MySQL 5.6.4 (Bug #13334470). -
Property Value Command-Line Format --slave-pending-jobs-size-max=#Introduced 5.6.3 System Variable slave_pending_jobs_size_maxScope Global Dynamic Yes Type Integer Default Value 16MMinimum Value 1024Maximum Value 16EiBBlock Size 1024For multithreaded slaves, this variable sets the maximum amount of memory (in bytes) available to slave worker queues holding events not yet applied. Setting this variable has no effect on slaves for which multithreading is not enabled.
The minimum possible value for this variable is 1024; the default is 16MB. The maximum possible value is 18446744073709551615 (16 exabytes). Values that are not exact multiples of 1024 are rounded down to the next-highest multiple of 1024 prior to being stored.
The value of this variable is a soft limit and can be set to match the normal workload. If an unusually large event exceeds this size, the transaction is held until all the slave workers have empty queues, and then processed. All subsequent transactions are held until the large transaction has been completed.
slave_pending_jobs_size_maxwas added in MySQL 5.6.3. -
Property Value Introduced 5.6.6 System Variable slave_rows_search_algorithms=listScope Global Dynamic Yes Type Set Default Value TABLE_SCAN,INDEX_SCANValid Values TABLE_SCAN,INDEX_SCANINDEX_SCAN,HASH_SCANTABLE_SCAN,HASH_SCANTABLE_SCAN,INDEX_SCAN,HASH_SCAN(equivalent to INDEX_SCAN,HASH_SCAN)When preparing batches of rows for row-based logging and replication, this variable controls how the rows are searched for matches—that is, whether or not hashing is used for searches using a primary or unique key, some other key, or using no key at all. Setting this variable takes effect for all replication channels immediately, including running channels. The initial setting for the system variable can be specified using the
--slave-rows-search-algorithmsoption.Specify a comma-separated list of any 2 (or all 3) values from the list
INDEX_SCAN,TABLE_SCAN,HASH_SCAN. The value is expected as a string, so the value must be quoted. In addition, the value must not contain any spaces. Possible combinations (lists) and their effects are shown in the following table:Index used / option value INDEX_SCAN,HASH_SCANorINDEX_SCAN,TABLE_SCAN,HASH_SCANINDEX_SCAN,TABLE_SCANTABLE_SCAN,HASH_SCANPrimary key or unique key Index scan Index scan Hash scan over index (Other) Key Hash scan over index Index scan Hash scan over index No index Hash scan Table scan Hash scan The order in which the algorithms are specified in the list does not make any difference in the order in which they are displayed by a
SELECTorSHOW VARIABLESstatement (which is the same as that used in the table just shown previously).The default value is
TABLE_SCAN,INDEX_SCAN, which means that all searches that can use indexes do use them, and searches without any indexes use table scans.To use hashing for any searches that do not use a primary or unique key, set this option to
INDEX_SCAN,HASH_SCAN. SpecifyingINDEX_SCAN,TABLE_SCAN,HASH_SCANhas the same effect as specifyingINDEX_SCAN,HASH_SCAN.To force hashing for all searches, set this option to
TABLE_SCAN,HASH_SCAN.
It is possible to specify single values for this option, but this is not optimal, because setting a single value limits searches to using only that algorithm. In particular, setting
INDEX_SCANalone is not recommended, as in that case searches are unable to find rows at all if no index is present.NoteThere is only a performance advantage for
INDEX_SCANandHASH_SCANif the row events are big enough. The size of row events is configured using--binlog-row-event-max-size. For example, suppose aDELETEstatement which deletes 25,000 rows generates largeDelete_row_eventevents. In this case ifslave_rows_search_algorithmsis set toINDEX_SCANorHASH_SCANthere is a performance improvement. However, if there are 25,000DELETEstatements and each is represented by a separate event then settingslave_rows_search_algorithmstoINDEX_SCANorHASH_SCANprovides no performance improvement while executing these separate events.This option was added in MySQL 5.6.6.
-
Property Value Command-Line Format --slave-skip-errors=nameSystem Variable slave_skip_errorsScope Global Dynamic No Type String Default Value OFFValid Values OFF[list of error codes]allddl_exist_errorsNormally, replication stops when an error occurs on the slave. This gives you the opportunity to resolve the inconsistency in the data manually. This variable tells the slave SQL thread to continue replication when a statement returns any of the errors listed in the variable value.
-
Property Value Introduced 5.6.2 System Variable slave_sql_verify_checksumScope Global Dynamic Yes Type Boolean Default Value 1Valid Values 01Cause the slave SQL thread to verify data using the checksums read from the relay log. In the event of a mismatch, the slave stops with an error.
NoteThe slave I/O thread always reads checksums if possible when accepting events from over the network.
slave_sql_verify_checksumwas added in MySQL 5.6.2. -
Property Value Command-Line Format --slave-transaction-retries=#System Variable slave_transaction_retriesScope Global Dynamic Yes Type Integer Default Value 10Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295If a replication slave SQL thread fails to execute a transaction because of an
InnoDBdeadlock or because the transaction's execution time exceededInnoDB'sinnodb_lock_wait_timeoutorNDB'sTransactionDeadlockDetectionTimeoutorTransactionInactiveTimeout, it automatically retriesslave_transaction_retriestimes before stopping with an error. The default value is 10.Transactions cannot be retried when using a multithreaded slave. In other words, whenever
slave_parallel_workersis greater than 0,slave_transaction_retriesis treated as equal to 0, and cannot be changed. -
Property Value Command-Line Format --slave-type-conversions=setSystem Variable slave_type_conversionsScope Global Dynamic No Type Set Default Value Valid Values (>= 5.6.13) ALL_LOSSYALL_NON_LOSSYALL_SIGNEDALL_UNSIGNEDValid Values (<= 5.6.12) ALL_LOSSYALL_NON_LOSSYControls the type conversion mode in effect on the slave when using row-based replication. In MySQL 5.6.13 and later, its value is a comma-delimited set of zero or more elements from the list:
ALL_LOSSY,ALL_NON_LOSSY,ALL_SIGNED,ALL_UNSIGNED. Set this variable to an empty string to disallow type conversions between the master and the slave. Changes require a restart of the slave to take effect.ALL_SIGNEDandALL_UNSIGNEDwere added in MySQL 5.6.13 (Bug#15831300). For additional information on type conversion modes applicable to attribute promotion and demotion in row-based replication, see Row-based replication: attribute promotion and demotion. -
Property Value System Variable sql_slave_skip_counterScope Global Dynamic Yes Type Integer The number of events from the master that a slave server should skip.
This option is incompatible with GTID-based replication, and must not be set to a nonzero value when
--gtid-mode=ON. In MySQL 5.6.10 and later, trying to do so is specifically disallowed. (Bug #15833516) If you need to skip transactions when employing GTIDs, usegtid_executedfrom the master instead. See Injecting empty transactions, for information about how to do this.ImportantIf skipping the number of events specified by setting this variable would cause the slave to begin in the middle of an event group, the slave continues to skip until it finds the beginning of the next event group and begins from that point. For more information, see Section 13.4.2.4, “SET GLOBAL sql_slave_skip_counter Syntax”.
-
Property Value Command-Line Format --sync-master-info=#System Variable sync_master_infoScope Global Dynamic Yes Type Integer Default Value (64-bit platforms, >= 5.6.6) 10000Default Value (64-bit platforms, <= 5.6.5) 0Default Value (32-bit platforms, >= 5.6.6) 10000Default Value (32-bit platforms, <= 5.6.5) 0Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295The effects of this variable on a replication slave depend on whether the slave's
master_info_repositoryis set toFILEorTABLE, as explained in the following paragraphs.master_info_repository = FILE. If the value of
sync_master_infois greater than 0, the slave synchronizes itsmaster.infofile to disk (usingfdatasync()) after everysync_master_infoevents. If it is 0, the MySQL server performs no synchronization of themaster.infofile to disk; instead, the server relies on the operating system to flush its contents periodically as with any other file.master_info_repository = TABLE. If the value of
sync_master_infois greater than 0, the slave updates its master info repository table after everysync_master_infoevents. If it is 0, the table is never updated.The default value for
sync_master_infois 10000 as of MySQL 5.6.6, 0 before that. -
Property Value Command-Line Format --sync-relay-log=#System Variable sync_relay_logScope Global Dynamic Yes Type Integer Default Value (64-bit platforms, >= 5.6.6) 10000Default Value (64-bit platforms, <= 5.6.5) 0Default Value (32-bit platforms, >= 5.6.6) 10000Default Value (32-bit platforms, <= 5.6.5) 0Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk (using
fdatasync()) after everysync_relay_logevents are written to the relay log.Setting
sync_relay_logto 0 causes no synchronization to be done to disk; in this case, the server relies on the operating system to flush the relay log's contents from time to time as for any other file.Prior to MySQL 5.6.6, 0 was the default for this variable. In MySQL 5.6. and later, the default is 10000.
A value of 1 is the safest choice because in the event of a crash you lose at most one event from the relay log. However, it is also the slowest choice (unless the disk has a battery-backed cache, which makes synchronization very fast).
-
Property Value Command-Line Format --sync-relay-log-info=#System Variable sync_relay_log_infoScope Global Dynamic Yes Type Integer Default Value (64-bit platforms, >= 5.6.6) 10000Default Value (64-bit platforms, <= 5.6.5) 0Default Value (32-bit platforms, >= 5.6.6) 10000Default Value (32-bit platforms, <= 5.6.5) 0Minimum Value 0Maximum Value (64-bit platforms) 18446744073709551615Maximum Value (32-bit platforms) 4294967295The default value for
sync_relay_log_infois 10000.The effects of this variable on the replication slave depend on the server's
relay_log_info_repositorysetting (FILEorTABLE). If the setting isTABLE, the effects of the variable also depend on whether the storage engine used by the relay log info table is transactional (such asInnoDB) or not transactional (MyISAM). The effects of these factors on the behavior of the server forsync_relay_log_infovalues of zero and greater than zero are as follows:-
sync_relay_log_info = 0 -
If
relay_log_info_repositoryis set toFILE, the MySQL server performs no synchronization of therelay-log.infofile to disk; instead, the server relies on the operating system to flush its contents periodically as with any other file.If
relay_log_info_repositoryis set toTABLE, and the storage engine for that table is transactional, the table is updated after each transaction. (Thesync_relay_log_infosetting is effectively ignored in this case.)If
relay_log_info_repositoryis set toTABLE, and the storage engine for that table is not transactional, the table is never updated.
-
sync_relay_log_info =N> 0 -
If
relay_log_info_repositoryis set toFILE, the slave synchronizes itsrelay-log.infofile to disk (usingfdatasync()) after everyNtransactions.If
relay_log_info_repositoryis set toTABLE, and the storage engine for that table is transactional, the table is updated after each transaction. (Thesync_relay_log_infosetting is effectively ignored in this case.)If
relay_log_info_repositoryis set toTABLE, and the storage engine for that table is not transactional, the table is updated after everyNevents.
-
[ERROR] Failed to open the relay log './zeus-relay-bin.000009' (relay_log_pos 251)
120216 17:11:31 [ERROR] Could not find target log during relay log initialization
When I changed the name from zeus to perseo.
My solution was to delete the files with old server name, I mean zeus-relay-* and delete relay-log.info.
It just worked for me.
However, in our reasonably high traffic environment (each master has three slaves on a very low-latency network, a 1G compressed binlog takes about a week to rotate), setting this value to 30 seconds caused recurring replication problems. The slaves started and stopped replicating with the message "Waiting to reconnect after a failed master event read." stop slave - start slave did not fix them (in fact we believe it made the problem worse). Removing the slave_net_timeout value from mysql.ini fixed replication immediately.