MySQL Router 8 Comments

table of Contents

I. Features

1. transparent routing

2. metadata cache

3. Simple Redirect

4. MySQL's new features Router 8.0

Second, the installation and startup

1. Install

2. Start

Third, the configuration

1. profile location

2. configuration file syntax

Configuration File Example


        MySQL Router was first used as an alternative to MySQL-Proxy appearing. As a lightweight middleware, MySQL Router provides transparent routing and load balancing between applications and back-end MySQL server, MySQL database service in order to improve high availability and scalable line.

        MySQL Router 2.0 is the initial release for MySQL Fabric users, but has been deprecated and no longer supported. MySQL Router 2.1 is support for MySQL InnoDB Cluster introduced, MySQL Router 8.0 is the extension on the MySQL Router 2.1, the version number of the MySQL server version number consistent. That Router 2.1.5 as Router 8.0.3 (and MySQL Server 8.0.3) release, 2.1.x branch is replaced 8.0.x. Fully compatible with these two branches. The latest version is 8.0.17, MySQL Router 8 is strongly recommended for use with MySQL Server 8 and 5.7.

I. Features

1. transparent routing

        MySQL Router by intelligently routing client to connect to the MySQL server to simplify application development. Using MySQL replicon replication of data across multiple servers, automatic failure occurs when the server failover, in the remaining instances protocol based paxos elect a new master repository. Here there is a problem, if the application directly connected to the master library, the library is available when the main switch occurs to change the IP address database, the client application must modify its own connection configuration. This program highly impractical, because of the need to understand the application group replication topology and know which instance of MySQL is the main repository for applications is clearly a difficult one, the processing logic to deal with this application transparent.

        And that's where the MySQL Router. When used with InnoDB Cluster, MySQL Router acts as a proxy to hide plurality MySQL instance on a network to an application, and wherein the data request is mapped to a cluster instance. As long as there is sufficient online and the communication intact copy between the components, wherein the client can connect to an example, the external service continuity. Applications have to do is connect to the Router, and not directly connected MySQL database instance, other processing can be handed over to the Router.

        Recommended deployment model MySQL Router is integrated with InnoDB Cluster, which is best Router application on the same host.

2. metadata cache

        MySQL Router in between the application and the MySQL server. When the application connects to the Router, Router to select the appropriate candidate pool from which the connection MySQL server, after Router forwards all traffic between the network and from the application and MySQL.

        MySQL Router reserved cache list online MySQL server, or configure the InnoDB Cluster topology and status. When Router starts, the list is loaded from Router's configuration file. When using --bootstrap guide Router option, this list is generated by InnoDB clustered servers. To update the cache, the cache metadata Router assembly comprising one InnoDB Cluster Server metadata remains connected achieved by querying the meta data and real-time status information from the MySQL database tables performance_schema example. Whenever InnoDB clusters will modify metadata changes to the cluster, and the cluster is detected as long as the status changes, the database table will be updated in real time by the Group Replication performance_schema plug MySQL server.

        When Router detects MySQL server connection is closed, it tries to connect to a different server in a MySQL server acquires metadata from the new state and InnoDB Cluster. Close application MySQL server connection will automatically shut down. The application must reconnect to the Router, which requires applications to achieve reconnection mechanism. Router redirect them to an online MySQL server.

3. Simple Redirect

        Router redirects the connection to the MySQL MySQL server is available, which means that data packets in the case of unchecked whole route. If the connection fails, the application must retry the connection, MySQL Router select a new MySQL server after a failed attempt to connect. This is referred to simply redirected connection routing, since it requires the application to retry the connection. In other words, if the connection to the MySQL server from MySQL Router is interrupted, then the application will encounter a connection failure, but new connection attempts will trigger the Router to find and connect to another MySQL server. Server connection and routing policy is defined in the configuration file.

        Use MySQL Router does not require a specific library or interface, compared to not using Router, the only difference is application-aware of how to establish a connection to the MySQL server. Because MySQL Router simply redirects when trying to connect, or perform packet analysis does not read, so the application needs to Catch connection errors and try again to connect to Router.

        Use MySQL Router works as follows:

  1. MySQL client to connect to MySQL Router.
  2. Router check the MySQL server is available.
  3. Router opens a connection to MySQL server apply.
  4. Router between the application and the MySQL server to forward packets back and forth
  5. If the MySQL server connection fails, Router will be disconnected. When the application to retry the connection Router, Router select another available MySQL server.

        Two recommended, but not mandatory to follow when deploying MySQL Router:

  • MySQL Router install and run the application on the same host.
  • Using the configuration file bind_port = 127.0.0.1: <port> Router bind to localhost, or disable the TCP connection (--conf-skip-tcp) and restricted to use only the Unix socket connection (--conf -use-sockets).

        The main recommendations for performance reasons. Whenever the introduction of communication components in the network, will have some overhead, and heavily influenced by the work load. Fortunately, affect the performance of MySQL Router is very small. Official documents show that the current version of the simple redirect the connection route, its speed is only about 1% slower compared to direct-attached database.

4. MySQL's new features Router 8.0

        Compared with previous 2.x versions, MySQL Router 8.0 adds the following key features:

  • Add the optional routing_strategy configuration options. Possible values ​​are first-available, next-available, round-robin, and round-robin-with-fallback. Previous versions, these strategies correspond mode option in the scheduling mode, in which the read-write the corresponding first-available, and read-only correspond to round-robin. They retain the previous behavior of these models.
  • Added --ssl-key and --ssl-cert command-line option to specify a client certificate and private key in order to facilitate client authentication. When you create a root account for use REQUIRE X509.
  • Added connect_timeout and read_timeout metadata profile options. They are defined in [the DEFAULT] namespace and affect the internal operation metadata server connections.
  • Bootstrap accept any member of the InnoDB Cluster and automatically find and reconnect to the server can write. Previously only accept the main library.
  • Bootstrap accepted --config option and read the [logger] Custom Level option.
  • The maximum number of concurrent client connections increased from 500 to 5000.
  • Mysqlrouter_plugin_info added a new utility to help debug MySQL Router plug-ins.

Second, the installation and startup

1. Install

        MySQL Router installation process is dependent on the operating system installation media and install binary packages usually very simple, while the package will need to compile the source code to install. For example on Linux to install the latest MySQL Router binary packages, just use mysql user to perform a decompression command is complete:

tar -Jxvf mysql-router-8.0.17-linux-glibc2.12-x86_64.tar.xz

        After extracting generate the following directories:

[mysql@hdp1~]$ll mysql-router-8.0.17-linux-glibc2.12-x86_64
total 108
drwxrwxr-x 2 mysql mysql    126 Sep  2 15:26 bin
drwxrwxr-x 3 mysql mysql   4096 Sep  2 15:26 lib
-rw-r--r-- 1 mysql mysql 101805 Jun 25 18:23 LICENSE.router
drwxrwxr-x 3 mysql mysql     17 Sep  2 15:22 man
-rw-r--r-- 1 mysql mysql    700 Jun 25 18:23 README.router
drwxrwxr-x 3 mysql mysql     16 Sep  2 15:22 share

bin directory is stored in the executable file, the directory can be added to facilitate the implementation PATH environment variable, for example:

export PATH=.:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/home/mysql/mysql-5.6.14/bin:/home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin;

Then you can execute mysqlrouter command, such as checking the version or displaying help:

[mysql@hdp1~]$mysqlrouter --version
MySQL Router  Ver 8.0.17 for linux-glibc2.12 on x86_64 (MySQL Community - GPL)
[mysql@hdp1~]$mysqlrouter --help
[mysql@hdp1~]$mysqlrouter --help
MySQL Router  Ver 8.0.17 for linux-glibc2.12 on x86_64 (MySQL Community - GPL)
Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Configuration read from the following files in the given order (enclosed
in parentheses means not available for reading):
  (/home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/.././mysqlrouter.conf)
  (/home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/.././mysqlrouter.ini)
  (/home/mysql/.mysqlrouter.conf)
  (/home/mysql/.mysqlrouter.ini)

...

        Various installation package download address https://dev.mysql.com/downloads/router/ . Other cases may be mounted reference https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-installation.html .

2. Start

        Need to read its configuration file MySQL Router starts, acquires the basic connection routing information. Router plugin performs routing connection-based, which means it will forward the packet to the server without checking them. This is a simple method of providing high throughput. Routing a basic connection settings as follows:

[logger]
level = INFO

[routing:secondary]
bind_address = localhost
bind_port = 7001
destinations = 172.16.1.125:3306,172.16.1.126:3306,172.16.1.127:3306
routing_strategy = round-robin

[routing:primary]
bind_address = localhost
bind_port = 7002
destinations = 172.16.1.125:3306,172.16.1.126:3306,172.16.1.127:3306
routing_strategy = first-available

        Here two routing policies are provided: three 172.16.1.125:3306,172.16.1.126:3306,172.16.1.127:3306 connected to the local port 7001 by MySQL instance, cycle, defined by the round-robin routing policy; 7002 by local port, set the first available strategy for the same three MySQL instances. The first available target list of strategies to use the first available server, that is, when 172.16.1.125:3306 available, all 7002 port connections are forwarded to it, otherwise forwarded to 172.16.1.126:3306, and so on. Router does not check packets, without restricting the connection according to the allocation policy or mode, the application can determine whether the read and write requests to different servers. In the present embodiment may be a read request to the local port 7001, to read the load balancing three servers. While the write request to 7002, only one server write, read and write to achieve separation.

        The above configuration is saved to a file /home/mysql/.mysqlrouter.conf, and the background to start MySQL Router:

[mysql@hdp1~]$mysqlrouter -c /home/mysql/.mysqlrouter.conf &

View MySQL Router has started the process of confirmation:

[mysql@hdp1~]$ps -ef | grep router
mysql    327410 326543  0 16:31 pts/0    00:00:00 mysqlrouter -c /home/mysql/.mysqlrouter.conf
...

The default display the following information in the log file:

[mysql@hdp1~]$more ~/mysql-router-8.0.17-linux-glibc2.12-x86_64/mysqlrouter.log 
2019-09-02 16:42:36 routing INFO [7f151540b700] [routing:primary] started: listening on localhost:7002, routing strategy = first-available
2019-09-02 16:42:36 routing INFO [7f1514c0a700] [routing:secondary] started: listening on localhost:7001, routing strategy = round-robin
[mysql@hdp1~]$

View monitor status:

[mysql@hdp1~]$netstat -tnlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::80                   :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 ::1:7001                :::*                    LISTEN      329852/mysqlrouter  
tcp6       0      0 ::1:7002                :::*                    LISTEN      329852/mysqlrouter  
[mysql@hdp1~]$

        Now, MySQL Router is listening on port 7001 and 7002, and sends the request to the appropriate MySQL instance:

[mysql@hdp1~]$mysql -uwxy -p123456 -P7001 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7001 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp3       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7001 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp4       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7001 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$

        Seen from the above, the request sent to the local port 7001, is forwarded to three cycles server 7002 transmits a request to the local port, are forwarded to all 172.16.1.125:3306.

        routing_strategy MySQL Router is the core of options, introduced in version 8.0.4, currently valid values ​​are first-available, next-available, round-robin, round-robin-with-fallback. As the name suggests, this option actually controls the routing strategy, that is ultimately connected to client requests which MySQL server instance. Previous versions of options with respect to the mode, routing_strategy options more flexible, and can not be set routing_strategy and mode simultaneously, set the static route can only choose one of them. For InnoDB Cluster, when the optional settings, use the default round-robin strategy.

  • round-robin: each new connections in a loop connected to the next available server, load balancing.
  • round-robin-with-fallback: for InnoDB Cluster. Each new connections in a loop connected to the next available server SECONDARY. SECONDARY If the server is not available, the server places a circular fashion PRIMARY.
  • first-available: new connection destination from the route list is available to the first server. If it fails, the next server using available, and so on, until all the servers are not available.
  • next-available: Similar to the first-available, the new connection destination from the route list is available to the first server. And first-available is different, if a server is marked as inaccessible, it will be discarded and never used as a target again. After the restart Router, all dropped server will be selected again. This policy is backward compatible MySQL Router 2.x is in read-write mode of behavior.

        Now the port 7002 routing policy for first-available, in order to stop 172.16.1.125:3306,172.16.1.126:3306,172.16.1.127:3306 the following observation visits 7002 ports.

# 停止 172.16.1.125:3306
[mysql@hdp2~]$mysqladmin -uwxy -p123456 -h172.16.1.125 -P3306 shutdown
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
[mysql@hdp2~]$

# 访问7002
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp3       |
+------------+

# 停止 172.16.1.126:3306
[mysql@hdp3~]$mysqladmin -uwxy -p123456 -h172.16.1.126 -P3306 shutdown
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
[mysql@hdp3~]$

# 访问7002
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp4       |
+------------+
[mysql@hdp1~]$

# 停止 172.16.1.127:3306
[mysql@hdp4~]$mysqladmin -uwxy -p123456 -h172.16.1.127 -P3306 shutdown
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
[mysql@hdp4~]$

# 启动172.16.1.125:3306
[mysql@hdp2~]$mysqld_safe --defaults-file=/etc/my.cnf &

# 访问7002
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$

        first-available target list is always circulating to find the first available server and connect to it. The 7002 policy was changed to next-available, the above steps and do it again, you will see the last query failed. Even at this time will not be available 172.16.1.125:3306 connect it again, unless restart Router.

# 最后的查询连接失败
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to remote MySQL server for client connected to 'localhost:7002'

# 重启路由
[mysql@hdp1~]$kill `ps -ef | grep router | grep -v grep | awk '{print $2}'`
[mysql@hdp1~]$mysqlrouter -c ~/.mysqlrouter.conf &

# 再次查询
[mysql@hdp1~]$mysql -uwxy -p123456 -P7002 --protocol=TCP -e"select @@hostname"
Warning: Using a password on the command line interface can be insecure.
+------------+
| @@hostname |
+------------+
| hdp2       |
+------------+
[mysql@hdp1~]$

        MySQL router can run multiple instances on a single or multiple hosts on the network, without the need to isolate MySQL Router on a single machine. This is because MySQL Router does not have an affinity for any particular server or host. To stop the MySQL Router, just directly kill the related processes with the kill or killall command. MySQL Router only play a role in forwarding traffic, it is too "light", and did not even stop a single command.

Third, the configuration

        When MySQL Router can start from a configuration file with the extension configuration files, command line options are three places for configuration information. This section describes MySQL Router configuration file location, configuration file syntax and configuration options.

1. profile location

(1) The default configuration file
        MySQL Router scan default configuration file at startup, and optionally loaded at run time user-defined configuration file from the command line. By default, MySQL Router scan depends on the specific location of the operating system to find the configuration file. Execution mysqlrouter --help you can view the default configuration file location on the system:

[mysql@hdp1~]$mysqlrouter --help | more
MySQL Router  Ver 8.0.17 for linux-glibc2.12 on x86_64 (MySQL Community - GPL)
Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Configuration read from the following files in the given order (enclosed
in parentheses means not available for reading):
  (/home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/.././mysqlrouter.conf)
  (/home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/.././mysqlrouter.ini)
  /home/mysql/.mysqlrouter.conf
  (/home/mysql/.mysqlrouter.ini)
Plugins Path:
  /home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/lib/mysqlrouter

Default Log Directory:
  /home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64

Default Persistent Data Directory:
  /home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/../var/lib/mysqlrouter

Default Runtime State Directory:
  /home/mysql/mysql-router-8.0.17-linux-glibc2.12-x86_64/bin/../run

...

        From the beginning of help you can see the default MySQL Router to find the configuration file and search order. Brackets file is not available, there is only /home/mysql/.mysqlrouter.conf a default configuration file is available. Note that if you use the -c or --config option passing user-defined configuration file, the default configuration file does not load.

(2) and the extended user defined profiles
        a user-defined profile or -c --config by the command-line option, extended by a profile or -a --extra-config command-line option. After reading the configuration from the default configuration file or use the --config option is specified, read the extended configuration file:

shell> mysqlrouter --config /custom/path/to/router.conf --extra-config /another/config.conf

You can pass more extended configuration options, and load the file in the order entered:

shell> mysqlrouter --config b.conf --extra-config a.conf --extra-config c.conf

In the above example, the first loading b.conf, and then sequentially loaded a.conf c.conf. Also due to the use --config, does not load the default configuration file. Profiles Profiles are covered by each load of previously read settings.

2. configuration file syntax

        MySQL Router configuration file format is similar to the configuration file MySQL server, in line with the traditional INI file format that contains multiple segments, each segment contains several options. Support options in the catalog forward slash and backslash, backslash unconditional copy instead of an escape character. The configuration file can contain comment lines, comment lines with a pound sign (#) or a semicolon (;) at the beginning, and continues to the end of the line. Note that only supports line comments, do not support the line, end of line comments. (1) section
Each profile contains a list of configuration sections, each section contains a list of configuration options, each configuration option has a name and a value, for example:

[section name]
option = value
option = value
option = value

[section name:optional section key]
option = value
option = value
option = value

        In parentheses are the segment name and an optional bond segments, with a colon (:) separation between the segment name and the section key. Combined segment name and the section of the key is unique to the configuration, there can be leading and trailing spaces within the brackets. Key section with a segment name by one or more letters, numbers or underscores (_) sequence composition, other characters are not allowed.

        Section similar to the namespace. Such as user options, its meaning depends on its associated segment. In [the DEFAULT] refers to the user segment the user system running MySQL Router, the user can control by command line options --user. [Metadata_cache] as defined in paragraph user, access refers to a MySQL server metadata MySQL user.

        Here are a few main segments:

  • [DEFAULT]: DEFAULT is a special section, the default values ​​for the options and look for options other segments did not occur in the segment, usually configured directory configuration file extensions, directories logs, MySQL Router runtime directory ( as pid file) and so on. DEFAULT section does not accept key segment.
  • [Logger]: logger segment has only one option, set the logging level logs.
  • [Routing: NAME]: the segment is part of a main configuration MySQL Router, a different set of routing instance, where NAME is the name of the custom key segment.

(2) Option

        After the segment name, there may be a zero or more line, wherein each line item form as follows:

name = value

        Will remove any trailing spaces on the option name, or option value before processing. Option names are not case sensitive. Option value in the option name referenced support braces, as variables to insert values. Variable reference value is done when retrieving option values, rather than reading the configuration file. If the variable is not defined, is not to be replaced, in accordance literal reading option values. Consider the following example configuration file:

[DEFAULT]
prefix = /usr/

[sample]
bin = {prefix}bin/{name}
lib = {prefix}lib/{name}
name = magic
directory = /data/{mysqlrouterdata}

Here bin value "/ usr / bin / magic", lib value is "/ usr / lib / magic". Since undefined name "{mysqlrouterdata}" variable, the value of the directory "/ data / {mysqlrouterdata}".

        MySQL Router defines the following predefined variables available in the configuration file. Braces variables, such as the Router {program} executable predefined variables.

  • program: name of the program, usually mysqlrouter.
  • origin: Binary file directory.
  • logging_folder: log file directory.
  • plugin_folder: plug-in file directory.
  • runtime_folder: runtime data file directory.
  • config_folder: Configuration file directory.

Configuration File Example

        When you start, MySQL Router will read the list of profiles, these profiles constitute Router configuration together. At least one configuration file, otherwise it will report Error when starting Router: No valid configuration file available error. The following is a MySQL InnoDB cluster name, mycluster exemplary basic connection route, traffic sent to the read and write ports 6446, 6447 using the read-only access port.

[DEFAULT]
logging_folder=/opt/routers/myrouter/log
runtime_folder=/opt/routers/myrouter/run
data_folder=/opt/routers/myrouter/data
connect_timeout=30
read_timeout=30

[logger]
level = INFO

[metadata_cache:mycluster]
router_id=5
bootstrap_server_addresses=mysql://localhost:3310,mysql://localhost:3320,mysql://localhost:3330
user=mysql_router
metadata_cluster=mycluster
ttl=5

[routing:mycluster_default_rw]
bind_address=0.0.0.0
bind_port=6446
destinations=metadata-cache://mycluster/default?role=PRIMARY
routing_strategy=round-robin

[routing:mycluster_default_ro]
bind_address=0.0.0.0
bind_port=6447
destinations=metadata-cache://mycluster/default?role=SECONDARY
routing_strategy=round-robin

        This configuration is defined in the five segments:

  • [The DEFAULT] defined in the data file directory, the log file directory, the directory location of the file operation, and the connection and reads the metadata server MySQL timeout is 30 seconds.
  • [Logger] is defined as the log level info, values ​​are selectable info, debug, warning, error, fatal, case-insensitive.
  • [Metadata_cache: mycluster] metadata defined MySQL server access information: router_id route ID is an integer. bootstrap_server_addresses MySQL instance is a comma-separated in InnoDB cluster. user-defined user access to metadata. metadata_cluster defined InnoDB cluster name. ttl defined caching time is 5 seconds.
  • [Routing: mycluster_default_rw] and [routing: mycluster_default_ro] are defined route write and read-only route. bind_address specified route using the IP address. Profile bind_address option to accept only one address, but you can use all addresses bind_addres = 0.0.0.0 bound to the localhost. bind_port specify the client port Router uses. refer to the destination address of the destinations defined by metadata-cache, to use InnoDB Cluster metadata cache to host dynamic configuration information. If you do not use InnoDB Cluster, destinations can be specified as a comma-separated IP: port address, but the address bind_address not appear in the list of destinations. routing_strategy routing policy, in the present embodiment are read-only and read-write access cycles three nodes.

        A complete description of options, see https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-conf-options.html .

        Overall, MySQL Router from principle, installation, configuration to deployment is so easy to use, simple to meet the needs of high-availability scenarios.

Published 370 original articles · won praise 599 · Views 2.18 million +

Guess you like

Origin blog.csdn.net/wzy0623/article/details/100518636