Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.6Mb
PDF (A4) - 40.7Mb
PDF (RPM) - 40.2Mb
HTML Download (TGZ) - 10.7Mb
HTML Download (Zip) - 10.7Mb
HTML Download (RPM) - 9.3Mb
Man Pages (TGZ) - 241.8Kb
Man Pages (Zip) - 346.8Kb
Info (Gzip) - 3.9Mb
Info (Zip) - 3.9Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Functions which Configure the Source List

13.4.2.10 Functions which Configure the Source List

The following functions, which are available from MySQL 8.0.22, enable you to add and remove replication source servers from the source list for a replication channel. The asynchronous connection failover mechanism automatically establishes an asynchronous (source to replica) replication connection to a new source from the appropriate list after the existing connection from the replica to its source fails. The source lists are stored in the mysql.replication_asynchronous_connection_failover table, and can be viewed in the Performance Schema table replication_asynchronous_connection_failover.

  • asynchronous_connection_failover_add_source()

    Add configuration information for a replication source server to the source list for a replication channel.

    Syntax:

    asynchronous_connection_failover_add_source(channel, host, port, network_namespace, weight)

    Arguments:

    • channel: The replication channel for which this replication source server is part of the source list.

    • host: The host name for this replication source server.

    • port: The port number for this replication source server.

    • network_namespace: The network namespace for this replication source server. If you specify an empty string, connections use the default (global) network namespace.

    • weight: The priority of this replication source server in the replication channel's source list. The priority is from 1 to 100, with 100 being the highest, and 50 being the default. When the asynchronous connection failover mechanism activates, the source with the highest priority setting among the alternative sources listed in the source list for the channel is chosen for the first connection attempt. If this attempt does not work, the replica tries with all the listed sources in descending order of priority, then starts again from the highest priority source. If multiple sources have the same priority, the replica orders them randomly.

    Return value:

    A string containing the result of the operation, for example whether it was successful or not.

    Example:

    SELECT asynchronous_connection_failover_add_source('channel2', '127.0.0.1', 3310, 'blue', 80);
    +-----------------------------------------------------------------------------------------------------+
    | asynchronous_connection_failover_add_source('channel2', '127.0.0.1', 3310, 'blue', 80)              |
    +-----------------------------------------------------------------------------------------------------+
    | Source configuration details successfully inserted.                                                 |
    +-----------------------------------------------------------------------------------------------------+

  • asynchronous_connection_failover_delete_source()

    Remove configuration information for a replication source server from the source list for a replication channel.

    Syntax:

    asynchronous_connection_failover_delete_source(channel, host, port, network_namespace)

    Arguments:

    • channel: The replication channel for which this replication source server was part of the source list.

    • host: The host name for this replication source server.

    • port: The port number for this replication source server.

    • network_namespace: The network namespace for this replication source server. An empty string means connections use the default (global) network namespace.

    Return value:

    A string containing the result of the operation, for example whether it was successful or not.

    Example:

    SELECT asynchronous_connection_failover_delete_source('channel2', '127.0.0.1', 3310, 'blue');
    +---------------------------------------------------------------------------------------------------+
    | asynchronous_connection_failover_delete_source('channel2', '127.0.0.1', 3310, 'blue')             |
    +---------------------------------------------------------------------------------------------------+
    | Source configuration details successfully deleted.                                                |
    +---------------------------------------------------------------------------------------------------+