当前位置:网站首页>Implementation of master-slave replication and master-master replication for MySQL and MariaDB databases
Implementation of master-slave replication and master-master replication for MySQL and MariaDB databases
2022-06-12 21:56:00 【njsummer】
MySQL and Mariadb The implementation steps and methods are exactly the same , This article only uses Mariadb As an example .
1.1 Realization Mariadb Master slave copy
1.1.1 Architecture diagram and environment description
Two servers
1 Master node :
MariaDB-Master
CentOS 8.4
IP: 192.168.250.18/24
10.3.28-MariaDB
2 From the node :
MariaDB-Slave
CentOS 8.4
IP: 192.168.250.28/24
10.3.28-MariaDB
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
1.1.2 Configure master node database
# Modify hostname 、 Synchronization time , verification IP Address, operating system version and other information .
[[email protected] ] #hostname
MariaDB-Master
[[email protected] ] #hostname -I
192.168.250.18
[[email protected] ] #systemctl enable --now chronyd.service
[[email protected] ] #date
Tue Feb 22 18:41:53 CST 2022
[[email protected] ] #uname -a
Linux CentOS84 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ] #
# mount this database , View database configuration file
[[email protected] ] #dnf -y install mariadb-server
[[email protected] ] #rpm -ql mariadb
[[email protected] ] #ll /etc/my.cnf.d/mariadb-server.cnf
-rw -r --r -- 1 root root 1458 Apr 19 2021 /etc/my.cnf.d/mariadb-server.cnf
[[email protected] ] #cp /etc/my.cnf.d/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf.bak
[[email protected] ] #ll /etc/my.cnf.d/
total 24
-rw -r --r -- 1 root root 41 Apr 19 2021 auth_gssapi.cnf
-rw -r --r -- 1 root root 295 Dec 18 2020 client.cnf
-rw -r --r -- 1 root root 763 Feb 19 2021 enable_encryption.preset
-rw -r --r -- 1 root root 1458 Apr 19 2021 mariadb-server.cnf
-rw -r --r -- 1 root root 1458 Feb 22 18:50 mariadb-server.cnf.bak
-rw -r --r -- 1 root root 232 Feb 19 2021 mysql-clients.cnf
[[email protected] ] #
# Modify the configuration file
[[email protected] ] #vim /etc/my.cnf.d/mariadb-server.cnf
# stay [mysqld] Add two lines to the paragraph , Define master node ID And turn on binary
[mysqld]
server-id = 18
log-bin
# see 3306 Whether the port is occupied , Ensure free 3306 The default database is TCP port
[[email protected] ] #ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
# Start the database and check the service startup status
[[email protected] ] #systemctl restart mariadb
[[email protected] ] #systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2022 -02 -22 19:19:47 CST; 16s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 4341 ExecStartPost =/usr/libexec/mysql-check-upgrade (code =exited, status = 0/SUCCESS)
Process: 4204 ExecStartPre =/usr/libexec/mysql-prepare-db-dir mariadb.service (code =exited, status = 0/SUCCESS)
Process: 4180 ExecStartPre =/usr/libexec/mysql-check-socket (code =exited, status = 0/SUCCESS)
Main PID: 4309 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 23544)
Memory: 85.4M
CGroup: /system.slice/mariadb.service
└─4309 /usr/libexec/mysqld --basedir =/usr
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: MySQL manual for more instructions.
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: Please report any problems at http://mariadb.org/jira
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: The latest information about MariaDB is available at http://mariadb.o>
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: You can find additional information about the MySQL part at:
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: http://dev.mysql.com
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: Consider joining MariaDB ''s strong and vibrant community:
Feb 22 19:19:46 MariaDB-Master mysql-prepare-db-dir[4204]: https://mariadb.org/get-involved/
Feb 22 19:19:46 MariaDB-Master mysqld[4309]: 2022 -02 -22 19:19:46 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB-log) start>
Feb 22 19:19:47 MariaDB-Master systemd[1]: Started MariaDB 10.3 database server.
# Verify database 3306 Whether the port listens
[[email protected] ] #ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
[[email protected] ] #
# Access to database , View the file and location where the binary log copying started
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.28-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> show master logs;
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| Log_name | File_size |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| mariadb-bin.000001 | 28259 |
| mariadb-bin.000002 | 344 |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
2 rows in set (0.000 sec)
MariaDB [(none)]>
# Create a copy account and authorize
MariaDB [(none)]> grant replication slave on *.* to [email protected] '192.168.250.%' identified by 'shone';
Query OK, 0 rows affected (0.001 sec)
# View and verify account information
MariaDB [(none)]> SELECT DISTINCT CONCAT( 'User: ' '',user, '' '@' '',host, '' ';') AS query FROM mysql.user;
+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
| query |
+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
| User: 'root'@ '127.0.0.1'; |
| User: 'repluser'@ '192.168.250.%'; |
| User: 'root'@ '::1'; |
| User: 'root'@ 'localhost'; |
| User: 'root'@ 'mariadb-master'; |
+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
6 rows in set (0.001 sec)
# Default database information
MariaDB [(none)]> show databases;
+ -- -- -- -- -- -- -- -- -- -- +
| Database |
+ -- -- -- -- -- -- -- -- -- -- +
| information_schema |
| mysql |
| performance_schema |
+ -- -- -- -- -- -- -- -- -- -- +
3 rows in set (0.002 sec)
MariaDB [(none)]>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
1.1.3 Configure the slave node database
# Modify hostname 、 Synchronization time , verification IP Address, operating system version and other information .
[[email protected] ] #hostname MariaDB-Slave
[[email protected] ] #hostname
MariaDB-Slave
[[email protected] ] #hostname -I
192.168.250.28
[[email protected] ] #systemctl enable --now chronyd.service
Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
[[email protected] ] #
# mount this database , And modify the database configuration file
[[email protected] ] #dnf -y install mariadb-server
[[email protected] ] #vim /etc/my.cnf.d/mariadb-server.cnf
# stay [mysqld] Add a line to the field , Define master node ID
[mysqld]
server-id = 28
# Start the database and check the service startup status
[[email protected] ] #systemctl restart mariadb
[[email protected] ] #systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2022 -02 -22 20:09:47 CST; 8s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 38461 ExecStartPost =/usr/libexec/mysql-check-upgrade (code =exited, status = 0/SUCCESS)
Process: 38324 ExecStartPre =/usr/libexec/mysql-prepare-db-dir mariadb.service (code =exited, status = 0/SUCCESS)
Process: 38300 ExecStartPre =/usr/libexec/mysql-check-socket (code =exited, status = 0/SUCCESS)
Main PID: 38429 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 30 (limit: 23544)
Memory: 83.3M
CGroup: /system.slice/mariadb.service
└─38429 /usr/libexec/mysqld --basedir =/usr
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: MySQL manual for more instructions.
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: Please report any problems at http://mariadb.org/jira
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: The latest information about MariaDB is available at http://mariadb.o>
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: You can find additional information about the MySQL part at:
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: http://dev.mysql.com
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: Consider joining MariaDB ''s strong and vibrant community:
Feb 22 20:09:47 MariaDB-Slave mysql-prepare-db-dir[38324]: https://mariadb.org/get-involved/
Feb 22 20:09:47 MariaDB-Slave mysqld[38429]: 2022 -02 -22 20:09:47 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting >
Feb 22 20:09:47 MariaDB-Slave systemd[1]: Started MariaDB 10.3 database server.
# Verify database 3306 Whether the port listens
[[email protected] ] #ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
[[email protected] ] #
# Access to database , View the command format of master-slave replication
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.28-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> help change master to
Name: 'CHANGE MASTER TO'
Description:
Syntax:
CHANGE MASTER TO option [, option] ...
option:
MASTER_BIND = 'interface_name'
| MASTER_HOST = 'host_name'
| MASTER_USER = 'user_name'
| MASTER_PASSWORD = 'password'
| MASTER_PORT = port_num
| MASTER_CONNECT_RETRY = interval
| MASTER_HEARTBEAT_PERIOD = interval
| MASTER_LOG_FILE = 'master_log_name'
| MASTER_LOG_POS = master_log_pos
| RELAY_LOG_FILE = 'relay_log_name'
| RELAY_LOG_POS = relay_log_pos
| MASTER_SSL = {0|1}
| MASTER_SSL_CA = 'ca_file_name'
| MASTER_SSL_CAPATH = 'ca_directory_name'
| MASTER_SSL_CERT = 'cert_file_name'
| MASTER_SSL_KEY = 'key_file_name'
| MASTER_SSL_CIPHER = 'cipher_list'
| MASTER_SSL_VERIFY_SERVER_CERT = {0|1}
| IGNORE_SERVER_IDS = (server_id_list)
server_id_list:
[server_id [, server_id] ... ]
CHANGE MASTER TO changes the parameters that the slave server uses for
connecting to the master server, for reading the master binary log, and
reading the slave relay log. It also updates the contents of the
master.info and relay-log.info files. To use CHANGE MASTER TO, the
slave replication threads must be stopped (use STOP SLAVE if
necessary).
Options not specified retain their value, except as indicated in the
following discussion. Thus, in most cases, there is no need to specify
options that do not change. For example, if the password to connect to
your MySQL master has changed, you just need to issue these statements
to tell the slave about the new password:
STOP SLAVE; -- if replication was running
CHANGE MASTER TO MASTER_PASSWORD = 'new3cret';
START SLAVE; -- if you want to restart replication
MASTER_HOST, MASTER_USER, MASTER_PASSWORD, and MASTER_PORT provide
information to the slave about how to connect to its master:
o MASTER_HOST and MASTER_PORT are the host name (or IP address) of the
master host and its TCP/IP port.
*Note*: Replication cannot use Unix socket files. You must be able to
connect to the master MySQL server using TCP/IP.
If you specify the MASTER_HOST or MASTER_PORT option, the slave
assumes that the master server is different from before (even if the
option value is the same as its current value.) In this case, the old
values for the master binary log file name and position are
considered no longer applicable, so if you do not specify
MASTER_LOG_FILE and MASTER_LOG_POS in the statement,
MASTER_LOG_FILE = '' and MASTER_LOG_POS = 4 are silently appended to it.
Setting MASTER_HOST = '' (that is, setting its value explicitly to an
empty string) is not the same as not setting MASTER_HOST at all.
Beginning with MySQL 5.5, trying to set MASTER_HOST to an empty
string fails with an error. Previously, setting MASTER_HOST to an
empty string caused START SLAVE subsequently to fail. (Bug #28796)
o MASTER_USER and MASTER_PASSWORD are the user name and password of the
account to use for connecting to the master.
In MySQL 5.5.20 and later, MASTER_USER cannot be made empty; setting
MASTER_USER = '' or leaving it unset when setting a value for for
MASTER_PASSWORD causes an error (Bug #13427949).
Currently, a password used for a replication slave account is
effectively limited to 32 characters in length; the password can be
longer, but any excess characters are truncated. This is not due to
any limit imposed by the MySQL Server generally, but rather is an
issue specific to MySQL Replication. (For more information, see Bug
#43439.)
The text of a running CHANGE MASTER TO statement, including values
for MASTER_USER and MASTER_PASSWORD, can be seen in the output of a
concurrent SHOW PROCESSLIST statement.
The MASTER_SSL_xxx options provide information about using SSL for the
connection. They correspond to the --ssl -xxx options described in
https://mariadb.com/kb/en/ssl-server-system-variables/, and
http://dev.mysql.com/doc/refman/5.5/en/replication-solutions-ssl.html.
These options can be changed even on slaves that are compiled without
SSL support. They are saved to the master.info file, but are ignored if
the slave does not have SSL support enabled.
MASTER_CONNECT_RETRY specifies how many seconds to wait between connect
retries. The default is 60. The number of reconnection attempts is
limited by the --master -retry -count server option; for more
information, see
https://mariadb.com/kb/en/replication-and-binary-log-server-system-variables/.
MASTER_HEARTBEAT_PERIOD sets the interval in seconds between
replication heartbeats. Whenever the master ''s binary log is updated
with an event, the waiting period for the next heartbeat is reset.
interval is a decimal value having the range 0 to 4294967 seconds and a
resolution in milliseconds; the smallest nonzero value is 0.001.
Heartbeats are sent by the master only if there are no unsent events in
the binary log file for a period longer than interval.
Setting interval to 0 disables heartbeats altogether. The default value
for interval is equal to the value of slave_net_timeout divided by 2.
Setting @@global.slave_net_timeout to a value less than that of the
current heartbeat interval results in a warning being issued. The
effect of issuing RESET SLAVE on the heartbeat interval is to reset it
to the default value.
MASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the
slave I/O thread should begin reading from the master the next time the
thread starts. RELAY_LOG_FILE and RELAY_LOG_POS are the coordinates at
which the slave SQL thread should begin reading from the relay log the
next time the thread starts. If you specify either of MASTER_LOG_FILE
or MASTER_LOG_POS, you cannot specify RELAY_LOG_FILE or RELAY_LOG_POS.
If neither of MASTER_LOG_FILE or MASTER_LOG_POS is specified, the slave
uses the last coordinates of the slave SQL thread before CHANGE MASTER
TO was issued. This ensures that there is no discontinuity in
replication, even if the slave SQL thread was late compared to the
slave I/O thread, when you merely want to change, say, the password to
use.
CHANGE MASTER TO deletes all relay log files and starts a new one,
unless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay
log files are kept; the relay_log_purge global variable is set silently
to 0.
Prior to MySQL 5.5, RELAY_LOG_FILE required an absolute path. In MySQL
5.5, the path can be relative, in which case the path is assumed to be
relative to the slave ''s data directory. (Bug #12190)
IGNORE_SERVER_IDS was added in MySQL 5.5. This option takes a
comma-separated list of 0 or more server IDs. Events originating from
the corresponding servers are ignored, with the exception of log
rotation and deletion events, which are still recorded in the relay
log.
In circular replication, the originating server normally acts as the
terminator of its own events, so that they are not applied more than
once. Thus, this option is useful in circular replication when one of
the servers in the circle is removed. Suppose that you have a circular
replication setup with 4 servers, having server IDs 1, 2, 3, and 4, and
server 3 fails. When bridging the gap by starting replication from
server 2 to server 4, you can include IGNORE_SERVER_IDS = (3) in the
CHANGE MASTER TO statement that you issue on server 4 to tell it to use
server 2 as its master instead of server 3. Doing so causes it to
ignore and not to propagate any statements that originated with the
server that is no longer in use.
If a CHANGE MASTER TO statement is issued without any IGNORE_SERVER_IDS
option, any existing list is preserved; RESET SLAVE also has no effect
on the server ID list. To clear the list of ignored servers, it is
necessary to use the option with an empty list:
CHANGE MASTER TO IGNORE_SERVER_IDS = ();
If IGNORE_SERVER_IDS contains the server ''s own ID and the server was
started with the --replicate -same -server -id option enabled, an error
results.
Also beginning with MySQL 5.5, the master.info file and the output of
SHOW SLAVE STATUS are extended to provide the list of servers that are
currently ignored. For more information, see
https://mariadb.com/kb/en/show-slave-status/, and
[HELP SHOW SLAVE STATUS].
Beginning with MySQL 5.5.5, invoking CHANGE MASTER TO causes the
previous values for MASTER_HOST, MASTER_PORT, MASTER_LOG_FILE, and
MASTER_LOG_POS to be written to the error log, along with other
information about the slave ''s state prior to execution.
CHANGE MASTER TO is useful for setting up a slave when you have the
snapshot of the master and have recorded the master binary log
coordinates corresponding to the time of the snapshot. After loading
the snapshot into the slave to synchronize it to the slave, you can run
CHANGE MASTER TO MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS =log_pos on
the slave to specify the coordinates at which the slave should begin
reading the master binary log.
The following example changes the master server the slave uses and
establishes the master binary log coordinates from which the slave
begins reading. This is used when you want to set up the slave to
replicate the master:
CHANGE MASTER TO
MASTER_HOST = 'master2.mycompany.com',
MASTER_USER = 'replication',
MASTER_PASSWORD = 'bigs3cret',
MASTER_PORT = 3306,
MASTER_LOG_FILE = 'master2-bin.001',
MASTER_LOG_POS = 4,
MASTER_CONNECT_RETRY = 10;
The next example shows an operation that is less frequently employed.
It is used when the slave has relay log files that you want it to
execute again for some reason. To do this, the master need not be
reachable. You need only use CHANGE MASTER TO and start the SQL thread
(START SLAVE SQL_THREAD):
CHANGE MASTER TO
RELAY_LOG_FILE = 'slave-relay-bin.006',
RELAY_LOG_POS = 4025;
URL: https://mariadb.com/kb/en/change-master-to/
MariaDB [(none)]>
# According to the above template , Configure the slave database of this experiment , among MASTER_LOG_FILE and MASTER_LOG_POS The values of the two fields are copied from the master server binary log view command
MariaDB [(none)]>
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST = '192.168.250.18',
-> MASTER_USER = 'repluser', MASTER_PASSWORD = 'shone', MASTER_PORT = 3306,
-> MASTER_LOG_FILE = 'mariadb-bin.000002', MASTER_LOG_POS = 344;
Query OK, 0 rows affected (0.039 sec)
# Start from database
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.
- 256.
- 257.
- 258.
- 259.
- 260.
- 261.
- 262.
- 263.
- 264.
- 265.
- 266.
- 267.
- 268.
- 269.
- 270.
- 271.
- 272.
- 273.
- 274.
- 275.
- 276.
- 277.
- 278.
- 279.
- 280.
- 281.
- 282.
- 283.
- 284.
- 285.
- 286.
- 287.
- 288.
- 289.
- 290.
- 291.
- 292.
- 293.
- 294.
- 295.
- 296.
- 297.
1.1.4 Verify database master-slave replication
# View the status of master-slave replication from the database
MariaDB [(none)]> show slave status\G
*************************<strong> 1. row </strong>*************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.250.18
Master_User: repluser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000003
Read_Master_Log_Pos: 344
Relay_Log_File: mariadb-relay-bin.000003
Relay_Log_Pos: 645
Relay_Master_Log_File: mariadb-bin.000003
Slave_IO_Running: Yes # This and the next trip must be urban YES, Basically, the master-slave replication is configured correctly
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 344
Relay_Log_Space: 1654
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 18
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: conservative
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Slave_DDL_Groups: 2
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
MariaDB [(none)]>
# Create a new database in the master database summer, After verifying the correct replication from the database
MariaDB [(none)]> create database summer;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> show databases;
+ -- -- -- -- -- -- -- -- -- -- +
| Database |
+ -- -- -- -- -- -- -- -- -- -- +
| information_schema |
| mysql |
| performance_schema |
| summer |
+ -- -- -- -- -- -- -- -- -- -- +
4 rows in set (0.001 sec)
MariaDB [(none)]>
# Here is the information viewed from the database
MariaDB [(none)]> show databases;
+ -- -- -- -- -- -- -- -- -- -- +
| Database |
+ -- -- -- -- -- -- -- -- -- -- +
| information_schema |
| mysql |
| performance_schema |
| summer |
+ -- -- -- -- -- -- -- -- -- -- +
4 rows in set (0.002 sec)
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
1.2 Realization Mariadb Master master copy
1.2.1 Architecture diagram and environment description
Two nodes of the primary replication , Can update data , And they are master and slave to each other . It is prone to data inconsistency , Use with caution in production .
Two servers
1 The first master node :
MariaDB-Master1
CentOS 8.4
IP: 192.168.250.18/24
10.3.28-MariaDB
2 The second master node :
MariaDB-Master2
CentOS 8.4
IP: 192.168.250.28/24
10.3.28-MariaDB
Configuration steps of primary replication :
(1) Each node uses its own unique server_id
(2) All started binary log and relay log
(3) Create a user account with copy rights
(4) Define automatic growth id The value ranges of the fields are odd and even auto_increment_offset=1 auto_increment_offset=2
(5) Both masters must designate the other as the master node , And start the replication thread
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
1.2.2 Configure the database master 1
# Configure two optimized CentOS virtual machine , install mariadb-server
[[email protected] ] #dnf -y install mariadb-server
[[email protected] ] #vim /etc/my.cnf.d/mariadb-server.cnf
# stay [mysqld] Add four lines to the paragraph , Define the node ID、 Binary on 、 Starting point and growth rate
[mysqld]
server-id = 18
log-bin
auto_increment_offset = 1
auto_increment_increment = 2
# Start database service
[[email protected] ] #systemctl start mariadb
# View the binary log information and configure the database replication account
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.28-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show master logs;
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| Log_name | File_size |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| mariadb-bin.000001 | 28259 |
| mariadb-bin.000002 | 764 |
| mariadb-bin.000003 | 526 |
| mariadb-bin.000004 | 412 |
| mariadb-bin.000005 | 344 |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
5 rows in set (0.000 sec)
MariaDB [(none)]> grant replication slave on *.* to [email protected] '192.168.250.%' identified by 'shone';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
1.2.3 Configure the database master 2
# On the database master node 2 Installation on mariadb-server
[[email protected] ] #dnf -y install mariadb-server
[[email protected] ] #vim /etc/my.cnf.d/mariadb-server.cnf
# stay [mysqld] Add four lines to the paragraph , Define the node ID、 Binary on 、 Starting point ( Note that it is different from the database master node 1) And the growth rate
[mysqld]
server-id = 28
log-bin
auto_increment_offset = 2
auto_increment_increment = 2
# Start database service
[[email protected] ] #systemctl start mariadb
# Configure database replication
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.28-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> STOP SLAVE;
Query OK, 0 rows affected (0.002 sec)
MariaDB [(none)]> CHANGE MASTER TO
-> MASTER_HOST = '192.168.250.18',
-> MASTER_USER = 'repluser',
-> MASTER_PASSWORD = 'shone',
-> MASTER_PORT = 3306,
-> MASTER_LOG_FILE = 'mariadb-bin.000005',
-> MASTER_LOG_POS = 344;
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> START SLAVE;
Query OK, 0 rows affected (0.001 sec)
# View and record binary log information , Will return to the database master 1 Re configuration requires mariadb-bin.000001 and 330 These two values
MariaDB [(none)]> show master logs;
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| Log_name | File_size |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
| mariadb-bin.000001 | 330 |
+ -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- - +
1 row in set (0.001 sec)
# see IP18 To IP28 Copy status
MariaDB [(none)]> show slave status\G
*************************<strong> 1. row </strong>*************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.250.18
Master_User: repluser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000005
Read_Master_Log_Pos: 550
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 763
Relay_Master_Log_File: mariadb-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 550
Relay_Log_Space: 1074
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 18
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: conservative
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Slave_DDL_Groups: 2
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0
1 row in set (0.001 sec)
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
1.2.4 Configure the database master node 1
# Go back to the main database node 1 Continue to complete the subsequent configuration
MariaDB [(none)]> stop slave;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> CHANGE MASTER TO
-> MASTER_HOST = '192.168.250.28',
-> MASTER_USER = 'repluser',
-> MASTER_PASSWORD = 'shone',
-> MASTER_PORT = 3306,
-> MASTER_LOG_FILE = 'mariadb-bin.000001',
-> MASTER_LOG_POS = 330;
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.001 sec)
# see IP28 To IP18 Copy status
MariaDB [(none)]> show slave status\G
*************************<strong> 1. row </strong>*************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.250.28
Master_User: repluser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000001
Read_Master_Log_Pos: 330
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 557
Relay_Master_Log_File: mariadb-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 330
Relay_Log_Space: 868
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 28
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: conservative
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
MariaDB [(none)]>
# thus , Both are main MariaDB Database replication ( Master master copy ) Configuration complete
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
1.2.5 Verify database master replication
# Log in to the database master node 1 (IP:192.168.250.18)
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.28-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# On the database master node 1 Create a shonedb1 database
MariaDB [(none)]> create database shonedb1;
Query OK, 1 row affected (0.002 sec)
MariaDB [(none)]> use shonedb1;
Database changed
# On the database master node 1 On ,shonedb1 Create tables in the database
MariaDB [shonedb1]> create table t1(id int auto_increment primary key,name char(10));
Query OK, 0 rows affected (0.041 sec)
# On the database master node 1 On ,shonedb1 Database t1 Insert a pair of key values into the table
MariaDB [shonedb1]> insert t1 (name) values( 'user1');
Query OK, 1 row affected (0.002 sec)
# Switch to the database master node 2 On , Also in the shonedb1 Database t1 Insert a pair of key values into the table
[[email protected] ] #mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.28-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use shonedb1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [shonedb1]> insert t1 (name) values( 'user2');
Query OK, 1 row affected (0.002 sec)
# Then switch back to the primary database node 1 In the database , Look at the created table
MariaDB [shonedb1]> show tables;
+ -- -- -- -- -- -- -- -- -- -- +
| Tables_in_shonedb1 |
+ -- -- -- -- -- -- -- -- -- -- +
| t1 |
+ -- -- -- -- -- -- -- -- -- -- +
1 row in set (0.001 sec)
# Re pass SSH Terminal software , At the same time, the database master node 1 And the database master node 2, At the same time, the following command is sent
MariaDB [shonedb1]> insert t1 (name) values( 'userX');
Query OK, 1 row affected (0.002 sec)
# After the above operation , We see the following t1 Key value information in the table , You can see that no matter whether you are going to the database master node 1 Or database master node 2, Or to the database master node at the same time 1 and 2 Send a command to insert key values into the table , Will be executed , You can see there are two ID All for nameX The key/value pair .
MariaDB [shonedb1]> select * from t1;
+ -- -- + -- -- -- - +
| id | name |
+ -- -- + -- -- -- - +
| 1 | user1 |
| 2 | user2 |
| 3 | userX |
| 4 | userX |
+ -- -- + -- -- -- - +
4 rows in set (0.001 sec)
# On the database master node 1 Create another shonedb2 database
MariaDB [shonedb1]> create database shonedb2;
Query OK, 1 row affected (0.001 sec)
# On the database master node 1 View database on
MariaDB [shonedb1]> show databases;
+ -- -- -- -- -- -- -- -- -- -- +
| Database |
+ -- -- -- -- -- -- -- -- -- -- +
| information_schema |
| mysql |
| performance_schema |
| shonedb1 |
| shonedb2 |
| summer |
+ -- -- -- -- -- -- -- -- -- -- +
6 rows in set (0.001 sec)
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
# Log in to the database master node 2 (IP:192.168.250.28) View the table and database information
MariaDB [shonedb1]> select * from t1;
+ -- -- + -- -- -- - +
| id | name |
+ -- -- + -- -- -- - +
| 1 | user1 |
| 2 | user2 |
| 3 | userX |
| 4 | userX |
+ -- -- + -- -- -- - +
4 rows in set (0.001 sec)
# On the database master node 2 The database created on will also be copied to the database master node 1
MariaDB [shonedb1]> create database shonedb2;
Query OK, 1 row affected (0.001 sec)
# On the database master node 2 view the database
MariaDB [shonedb1]> show databases;
+ -- -- -- -- -- -- -- -- -- -- +
| Database |
+ -- -- -- -- -- -- -- -- -- -- +
| information_schema |
| mysql |
| performance_schema |
| shonedb1 |
| shonedb2 |
| summer |
+ -- -- -- -- -- -- -- -- -- -- +
6 rows in set (0.001 sec)
MariaDB [shonedb1]>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
The following figure shows the use of SSH Terminal software SecureCRT Send inserts to the tables of two database master nodes at the same time userX Demo screenshot of key value
边栏推荐
- The 2023 campus recruitment officially opened! Oceanbase would like to make an interview with you this spring
- 2023届校园招聘正式开启!OceanBase 想和你在这个春天约一场面试
- Digraph deep copy
- Lambda expression and flow optimization code
- SQL tuning guide notes 14:managing extended statistics
- Oracle数据库中查询执行计划的权限
- #yyds干货盘点# 解决剑指offer:字符流中第一个不重复的字符
- 大学期间零基础如何开展编程学习
- Palindrome linked list and linked list intersection problem (intersecting with Xinyi people) do you really know?
- "Oracle database parallel execution" technical white paper reading notes
猜你喜欢
MySQL architecture and basic management (II)
如何自己动手写一个vscode插件,实现插件自由!
About the solution to "the application cannot start normally 0xc00000022" after qt5.15.2 is installed and qtcreator is started
JVisualVM初步使用
SQL tuning guide notes 14:managing extended statistics
图灵奖得主:想要在学术生涯中获得成功,需要注意哪些问题?
SQL调优指南笔记11:Histograms
建立高可用的数据库
SQL tuning guide notes 8:optimizer access paths
利用ADG Standby克隆PDB
随机推荐
Semester summary of freshman year
The ifeq, filter and strip of makefile are easy to use
SQL tuning guide notes 12:configuring options for optimizer statistics gathering
MySQL体系结构及基础管理(二)
Ansible playbook和变量(二)
[sword finger offer simple] sword finger offer 24 Reverse linked list
同花顺能开户吗,在同花顺开户安全么,证券开户怎么开户流程
Thread safe level
大学期间零基础如何开展编程学习
What is the difference between volatile variables and atomic variables?
ICML2022 | GALAXY:極化圖主動學習
Yyds dry goods inventory solution sword finger offer: the first non repeated character in the character stream
六月集训(第10天) —— 位运算
[sword finger offer] sword finger offer 35 Replication of complex linked list
Xingda easy control ModbusRTU to modbustcp gateway
Kotlin collaboration process - flow
How do I create a daemon thread? And where to use it?
Zip compression decompression
gzip压缩解压缩
How to ensure thread safety?