Docker implements MariaDB sub-library and sub-table and read-write separation functions

Docker implements MariaDB sub-library and sub-table and read-write separation functions

1. Introduction

This article uses Docker to implement MySQL master-slave configuration, read-write separation, sub-library and table sub-table functions.

2. Environmental Preparation

1. Basic environment

java

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

docker

Client:
 Version: 18.03.0-ce
 API version: 1.37
 Go version: go1.9.4
 Git commit: 0520e24
 Built: Wed Mar 21 23:09:15 2018
 OS/Arch: linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
 Version: 18.03.0-ce
 API version: 1.37 (minimum version 1.12)
 Go version: go1.9.4
 Git commit: 0520e24
 Built: Wed Mar 21 23:13:03 2018
 OS/Arch: linux/amd64
 Experimental: false

3. Install Mysql master-slave configuration

1. Deployment information

Node Name Data name Node IP port
master marster 192.168.92.50 3306
slave slave 192.168.92.51 3307
mycat mycat 192.168.92.50 8066/9066

2. Master node configuration file

Create the mysql master node configuration file

mkdir /usr/local/mysql/master
mkdir conf-data

Create the master node configuration file docker.cnf

[mysqld]
server-id=1
log-bin=master-bin #For reading and writing only, only the master database needs to be configured. If you want to switch between master and slave, both the master and slave databases need to be enabled.
skip-host-cache
skip-name-resolve
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
[mysql] 
default-character-set=utf8
[client] 
default-character-set=utf8

Create a slave node configuration file docker.conf

mkdir /usr/local/mysql/slave
mkdir conf-data
[mysqld]
server-id=2
log-bin=master-bin 
skip-host-cache
skip-name-resolve
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
[mysql] 
default-character-set=utf8
[client] 
default-character-set=utf8

3. Create a mysql container

Here we use the latest stable image of mariadb to create a container

Create the master node myslq

docker run --name master -p 3306:3306 -v /usr/local/mysql/master/conf:/etc/mysql/conf.d -v /usr/local/mysql/master/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -idt mariadb:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

Create a slave node mysql

docker run --name slave -p 3307:3306 -v /usr/local/mysql/slave/conf:/etc/mysql/conf.d -v /usr/local/mysql/slave/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -idt mariadb:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

4. Enable master-slave replication

Step 1 Enter the master node

docker exec -it master /bin/bash
mysql -uroot -p

Step 2 Create a user

create user 'backUser'@'%' identified by 'root';

grant replication slave on *.* to 'backUser'@'%';

flush privileges;

show master status;
MariaDB [(none)]> show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000003 | 787 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.000 sec)

Step 3 Enter the slave node to create a user and start synchronization

docker exec -it slave /bin/bash

mysql -uroot -proot

change master to master_host='192.168.92.51',master_port=3306,master_user='backUser',master_password='root',master_log_file='master-bin.000003',master_log_pos=787;

Enable master-slave replication:

start slave;

The log and file names set by the slave node should correspond to the master node information, including the starting position of the log record.

Check whether the master-slave replication is OK

show slave status \G;
*************************** 1. row ***************************
    Slave_IO_State: Waiting for master to send event
     Master_Host: 192.168.92.50
     Master_User: backUser
     Master_Port: 3306
     Connect_Retry: 60
    Master_Log_File: master-bin.000005
   Read_Master_Log_Pos: 343
    Relay_Log_File:mysqld-relay-bin.000002
     Relay_Log_Pos: 556
   Relay_Master_Log_File: master-bin.000005
    Slave_IO_Running: Yes
    Slave_SQL_Running: Yes

If two YES appear on Slave, it means that the master-slave replication is set up successfully.

5. Install Mycat

Download mycat and install it on 50 nodes

tar -zxvf Mycat-server-1.6.7.1-release-20190213150257-linux.tar.gz

mv mycat/ /usr/local/

Modify the server.xml file in the conf directory of mycat and specify the username and password

<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); 
	- You may not use this file except in compliance with the License. 
	may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 
	- - Unless required by applicable law or agreed to in writing, software - 
	distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 
	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the 
	License for the specific language governing permissions and - limitations 
	under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
	<system>
	<property name="nonePasswordLogin">0</property> <!-- 0 means password required for login, 1 means no password required for login, the default value is 0, if set to 1, you need to specify the default account -->
	<property name="useHandshakeV10">1</property>
	<property name="useSqlStat">0</property> <!-- 1 is to enable real-time statistics, 0 is to disable -->
	<property name="useGlobleTableCheck">0</property> <!-- 1 is to enable full overtime consistency detection, 0 is to disable -->
	<property name="sequnceHandlerType">0</property>
	<property name="subqueryRelationshipCheck">false</property>
	<property name="processorBufferPoolType">0</property>
	<property name="handleDistributedTransactions">0</property>
	<property name="useOffHeapForMerge">1</property>
		<!--Unit is m-->
  <property name="memoryPageSize">64k</property>
		<!--Unit is k-->
		<property name="spillsFileBufferSize">1k</property>
		<property name="useStreamOutput">0</property>
		<!--Unit is m-->
		<property name="systemReserveMemorySize">384m</property>
		<!--Whether to use zookeeper to coordinate switching-->
		<property name="useZKSwitch">false</property>
		<!-- XA Recovery Log name -->
		<!--<property name="XARecoveryLogBaseName">tmlog</property>-->
		<!--If true, strictly adhere to the isolation level and do not switch connections in transactions when there is only a select statement-->
		<property name="strictTxIsolation">false</property>
		<property name="useZKSwitch">true</property>
	</system>
	<user name="root">
		<property name="password">123456</property>
		<property name="schemas">test</property>
	</user>
</mycat:server>

In the above configuration, root is specified as the user name and password is 123456 to access the virtual logical database test.

Configure rules

Modify the schema.xml in the mycat conf folder to configure the database corresponding rules

<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">

	<schema name="test" checkSQLschema="false" sqlMaxLimit="100">
   <table name="tb_user" primaryKey="id" autoIncrement="true" dataNode="dn1,dn2,dn3,dn4" rule="userrule" />
		<table name="tb_category" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="categoryrule" />
	</schema>
	<dataNode name="dn1" dataHost="localhost1" database="db1" />
	<dataNode name="dn2" dataHost="localhost1" database="db2" />
	<dataNode name="dn3" dataHost="localhost1" database="db3" />
	<dataNode name="dn4" dataHost="localhost1" database="db4" />

	<dataHost name="localhost1" maxCon="1000" minCon="10" balance="1"
			 writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
		<heartbeat>select user()</heartbeat>
		<!-- Read-write separation configuration -->
		<writeHost host="hostM1" url="192.168.92.50:3306" user="root"
				 password="123456">
			<readHost host="hostS2" url="192.168.92.51:3307" user="root" password="123456" />
		</writeHost>
	</dataHost>
</mycat:schema>

The above configuration schema name corresponds to the virtual database of the server configuration file, specifies two table information, the primary key of the tb_user table is self-increasing, has four database nodes, and uses the userrule table rule.

dataNode specifies the actual corresponding physical database node, and the corresponding dataHost describes the reading and writing of the specified user and node information.

Configure table sharding rule file rule.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); 
	- You may not use this file except in compliance with the License. 
	may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 
	- - Unless required by applicable law or agreed to in writing, software - 
	distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 
	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the 
	License for the specific language governing permissions and - limitations 
	under the License. -->
<!DOCTYPE mycat:rule SYSTEM "rule.dtd">
<mycat:rule xmlns:mycat="http://io.mycat/">
 <!-- Configure database rules -->
 	<tableRule name="userrule">
		<rule>
			<columns>id</columns>
			<algorithm>func1</algorithm>
		</rule>
	</tableRule>
	<!-- Configure database test tb_category rules -->
	<tableRule name="categoryrule">
		<rule>
			<columns>id</columns>
			<algorithm>jump-consistent-hash</algorithm>
		</rule>
	</tableRule>
	<function name="murmur"
		class="io.mycat.route.function.PartitionByMurmurHash">
		<property name="seed">0</property><!-- The default is 0 -->
		<property name="count">2</property><!-- The number of database nodes to be sharded, must be specified, otherwise sharding will not work-->
		<property name="virtualBucketTimes">160</property><!-- An actual database node is mapped to so many virtual nodes, the default is 160 times, that is, the number of virtual nodes is 160 times the number of physical nodes -->
		<!-- <property name="weightMapFile">weightMapFile</property> The weight of the node. The default value for nodes without specified weight is 1. Fill in the format of the properties file, with an integer value from 0 to count-1, that is, the node index, as the key and the node weight as the value. All weight values ​​must be positive integers, otherwise they are replaced by 1 -->
		<!-- <property name="bucketMapPath">/etc/mycat/bucketMapPath</property> 
			Used to observe the distribution of physical nodes and virtual nodes during testing. If this attribute is specified, the mapping of the virtual node's murmur hash value to the physical node will be output to this file line by line. There is no default value. If it is not specified, nothing will be output. -->
	</function>

	<function name="crc32slot"
			 class="io.mycat.route.function.PartitionByCRC32PreSlot">
	</function>
	<function name="hash-int"
		class="io.mycat.route.function.PartitionByFileMap">
		<property name="mapFile">partition-hash-int.txt</property>
	</function>
	<function name="rang-long"
		class="io.mycat.route.function.AutoPartitionByLong">
		<property name="mapFile">autopartition-long.txt</property>
	</function>
	<function name="mod-long" class="io.mycat.route.function.PartitionByMod">
		<!-- how many data nodes -->
		<property name="count">3</property>
	</function>

	<function name="func1" class="io.mycat.route.function.PartitionByLong">
		<property name="partitionCount">8</property>
		<property name="partitionLength">128</property>
	</function>
	<function name="latestMonth"
		class="io.mycat.route.function.LatestMonthPartion">
		<property name="splitOneDay">24</property>
	</function>
	<function name="partbymonth"
		class="io.mycat.route.function.PartitionByMonth">
		<property name="dateFormat">yyyy-MM-dd</property>
		<property name="sBeginDate">2015-01-01</property>
	</function>
	
	<function name="rang-mod" class="io.mycat.route.function.PartitionByRangeMod">
  	<property name="mapFile">partition-range-mod.txt</property>
	</function>
	
	<function name="jump-consistent-hash" class="io.mycat.route.function.PartitionByJumpConsistentHash">
		<property name="totalBuckets">3</property>
	</function>
</mycat:rule>

The above file focuses on the first tableRule. Rule specifies the table field where the sharding rule is located, and algorithm specifies the sharding algorithm. Func1 corresponds to the function name func1 at the end of the file. The PartitionByLong sharding algorithm is used here.

Add the sequence_conf.properties file under conf, and its content is as follows:

TB_USER.HISIDS=
TB_USER.MINID=1
TB_USER.MAXID=20000
TB_USER.CURID=1

Mainly declares the strategy of primary key growth.

4. Mycat database and table sub-test

1. The master node manually creates a database

Manually create 4 databases db1, db2, db3, db4 on the master node (do not operate on the slave node)

At this time, open the slave node and you will observe that the slave will automatically create 4 databases.

2. Open mycat

Use the command ./mycat start to start mycat

./mycat start
./mycat stop
./mycat console front-end operation
./mycat restart Restart the service
./mycat pause
./mycat status View the startup status

If startup fails, check the wrapper.log log file in /usr/local/mycat.

FATAL | wrapper | 2019/04/21 14:36:09 | ERROR: Could not write pid file /usr/local/mycat/logs/mycat.pid: No such file or directory

If you encounter the above error, please create a logs folder in the mycat directory and restart.

[root@localhost mycat]# bin/mycat status
Mycat-server is running (5065).

The above message indicates that mycat was started successfully.

2. Release the mycat communication port

firewall-cmd --zone=public --add-port=8066/tcp --permanent
firewall-cmd --zone=public --add-port=9066/tcp --permanent
firewall-cmd --reload

Use Docker image to start mycat container instance

docker run --name mycat -v /usr/local/mycat/conf/schema.xml:/usr/local/mycat/conf/schema.xml -v /usr/local/mycat/conf/rule.xml:/usr/local/mycat/conf/rule.xml -v /usr/local/mycat/conf/server.xml:/usr/local/mycat/conf/server.xml -v /usr/local/mycat/conf/sequence_conf.properties:/usr/local/mycat/conf/sequence_conf.properties --privileged=true -p 8066:8066 -p 9066:9066 -e MYSQL_ROOT_PASSWORD=123456 -d longhronshens/mycat-docker

Or turn off the firewall.

3. mycat connection

Use navicate to connect to mycat, port 8066 (9066 is the management port)

Use the command to connect to mycat

[root@localhost ~]# mysql -h127.0.0.1 -uroot -p123456 -P8066 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.6.29-mycat-1.6.7.1-release-20190213150257 MyCat Server (OpenCloudDB)

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

Management side command:

mysql -h127.0.0.1 -uroot -proot -P9066

View the virtual logic library:

MySQL [(none)]> show databases;
+----------+
| DATABASE |
+----------+
| test |
+----------+
1 row in set (0.00 sec)

MySQL [(none)]>

Create a table using the logical library:

MySQL [(none)]> use test;

CREATE TABLE `tb_user` (
 `id` bigint(20) NOT NULL AUTO_INCREMENT,
 `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Username',
 `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Password, encrypted storage',
 `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Registered phone number',
 `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Registration email',
 `created` datetime(0) NOT NULL,
 `updated` datetime(0) NOT NULL,
 PRIMARY KEY (`id`) USING BTREE,
 UNIQUE INDEX `username`(`username`) USING BTREE,
 UNIQUE INDEX `phone`(`phone`) USING BTREE,
 UNIQUE INDEX `email`(`email`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 54 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'User table' ROW_FORMAT = Compact;

You can see that mycat and mysql master and slave have created the table

When creating a table:

CREATE TABLE `tb_category` (
 `id` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
 `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'name',
 `sort_order` int(4) NOT NULL DEFAULT 1 COMMENT 'The sorting order indicates the display order of categories of the same level. If the values ​​are equal, they are sorted in order of name. Value range: integer greater than zero',
 `created` datetime(0) NULL DEFAULT NULL,
 `updated` datetime(0) NULL DEFAULT NULL,
 PRIMARY KEY (`id`) USING BTREE,
 INDEX `updated`(`updated`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

Insert a piece of data:

INSERT INTO `tb_user`(id,username,password,phone,email,created,updated) VALUES (7, 'zhangsan', 'e10adc3949ba59abbe56e057f20f883e', '13488888888', 'aa@a', '2015-04-06 17:03:55', '2015-04-06 17:03:55');

To test the effect of database partitioning, we insert data with different IDs to observe:

INSERT INTO `tb_user`(id,username,password,phone,email,created,updated) VALUES (128, 'zhang02', 'e10adc3949ba59abbe56e057f20f88ss', '13488888882', '[email protected]', '2015-04-06 17:03:57', '2015-04-06 17:04:55');

INSERT INTO `tb_user`(id,username,password,phone,email,created,updated) VALUES (256, 'zhang03', 'e10adc3949ba59abbe56e057f20f88ss', '13488888883', '[email protected]', '2015-04-06 17:03:57', '2015-04-06 17:04:55');

INSERT INTO `tb_user`(id,username,password,phone,email,created,updated) VALUES (384, 'zhang05', 'e10adc3949ba59abbe56e057f20f88ss', '13488888885', '[email protected]', '2015-04-06 17:03:57', '2015-04-06 17:04:55');

It can be seen that the data is distributed in db1/db2/db3/db4 respectively. The distribution rule depends on the sharding rule constraints set in rule.xml for the primary key of the inserted data.

Check the health status of the mycat node and enter the following command on the master node:

[root@localhost ~]# mysql -h127.0.0.1 -uroot -p123456 -P9066 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.29-mycat-1.6.7.1-release-20190213150257 MyCat Server (monitor)

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show @@heartbeat;
+--------+-------+---------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
| NAME | TYPE | HOST | PORT | RS_CODE | RETRY | STATUS | TIMEOUT | EXECUTE_TIME | LAST_ACTIVE_TIME | STOP |
+--------+-------+---------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
| hostM1 | mysql | 192.168.92.50 | 3306 | 1 | 0 | idle | 30000 | 1,9,6 | 2019-04-21 20:44:40 | false |
| hostS2 | mysql | 192.168.92.51 | 3307 | 1 | 0 | idle | 30000 | 1,9,67381 | 2019-04-21 20:44:40 | false |
+--------+-------+---------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
2 rows in set (0.36 sec)

In the above RS_CODE, 1 means the node is normal, and -1 means the node is abnormal.

Query all mycat commands:

MySQL [(none)]> show @@help;
+--------------------------------------------------------------+--------------------------------------------+
| STATEMENT | DESCRIPTION |
+--------------------------------------------------------------+--------------------------------------------+
| show @@time.current | Report current timestamp |
| show @@time.startup | Report startup timestamp |
| show @@version | Report Mycat Server version |
| show @@server | Report server status |
| show @@threadpool | Report threadPool status |
| show @@database | Report databases |
| show @@datanode | Report dataNodes |
| show @@datanode where schema = ? | Report dataNodes |
| show @@datasource | Report dataSources |
| show @@datasource where dataNode = ? | Report dataSources |
| show @@datasource.synstatus | Report datasource data synchronous |
| show @@datasource.syndetail where name=? | Report datasource data synchronous detail |
| show @@datasource.cluster | Report datasource galary cluster variables |
| show @@processor | Report processor status |
| show @@command | Report commands status |
| show @@connection | Report connection status |
| show @@cache | Report system cache usage |
| show @@backend | Report backend connection status |
| show @@session | Report front session details |
| show @@connection.sql | Report connection sql |
| show @@sql.execute | Report execute status |
| show @@sql.detail where id = ? | Report execute detail status |
| show @@sql | Report SQL list |
| show @@sql.high | Report Hight Frequency SQL |
| show @@sql.slow | Report slow SQL |
| show @@sql.resultset | Report BIG RESULTSET SQL |
| show @@sql.sum | Report User RW Stat |
| show @@sql.sum.user | Report User RW Stat |
| show @@sql.sum.table | Report Table RW Stat |
| show @@parser | Report parser status |
| show @@router | Report router status |
| show @@heartbeat | Report heartbeat status |
| show @@heartbeat.detail where name=? | Report heartbeat current detail |
| show @@slow where schema = ? | Report schema slow sql |
| show @@slow where datanode = ? | Report datanode slow sql |
| show @@sysparam | Report system param |
| show @@syslog limit=? | Report system mycat.log |
| show @@white | show mycat white host |
| show @@white.set=?,? | set mycat white host,[ip,user] |
| show @@directmemory=1 or 2 | show mycat direct memory usage |
| show @@check_global -SCHEMA= ? -TABLE=? -retry=? -interval=? | check mycat global table consistency |
| switch @@datasource name:index | Switch dataSource |
| kill @@connection id1,id2,... | Kill the specified connections |
| stop @@heartbeat name:time | Pause dataNode heartbeat |
| reload @@config | Reload basic config from file |
| reload @@config_all | Reload all config from file |
| reload @@route | Reload route config from file |
| reload @@user | Reload user config from file |
| reload @@sqlslow= | Set Slow SQL Time(ms) |
| reload @@user_stat | Reset show @@sql @@sql.sum @@sql.slow |
| rollback @@config | Rollback all config from memory |
| rollback @@route | Rollback route config from memory |
| rollback @@user | Rollback user config from memory |
| reload @@sqlstat=open | Open real-time sql stat analyzer |
| reload @@sqlstat=close | Close real-time sql stat analyzer |
| offline | Change MyCat status to OFF |
| online | Change MyCat status to ON |
| clear @@slow where schema = ? | Clear slow sql by schema |
| clear @@slow where datanode = ? | Clear slow sql by datanode |
+--------------------------------------------------------------+--------------------------------------------+
59 rows in set (0.16 sec)

The following error was encountered:

Modify the schema.xml file property checkSQLschema:

<schema name="test" checkSQLschema="true" sqlMaxLimit="100">

The following error was encountered:

jvm 1 | Caused by: io.mycat.config.util.ConfigException: org.xml.sax.SAXParseException; lineNumber: 97; columnNumber: 42; Attribute "defaultAccount" must be declared for element type "user".
jvm 1 | at io.mycat.config.loader.xml.XMLServerLoader.load(XMLServerLoader.java:111)
jvm 1 | at io.mycat.config.loader.xml.XMLServerLoader.<init>(XMLServerLoader.java:69)
jvm 1 | at io.mycat.config.loader.xml.XMLConfigLoader.<init>(XMLConfigLoader.java:56)
jvm 1 | at io.mycat.config.ConfigInitializer.<init>(ConfigInitializer.java:77)
jvm 1 | at io.mycat.config.MycatConfig.<init>(MycatConfig.java:72)
jvm 1 | at io.mycat.MycatServer.<init>(MycatServer.java:144)
jvm 1 | at io.mycat.MycatServer.<clinit>(MycatServer.java:96)
jvm 1 | ... 7 more
jvm 1 | Caused by: org.xml.sax.SAXParseException; lineNumber: 97; columnNumber: 42; Attribute "defaultAccount" must be declared for element type "user".

Please modify the server.xml file and cancel the defaultAccount of the user module:

<user name="root" >
	<property name="password">123456</property>
	<property name="schemas">test</property>
</user>

Finally, here is a screenshot of the mycat query results:

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • MariaDB Spider database sharding practice record

<<:  How to implement import and export mysql database commands under linux

>>:  Top 10 Js Image Processing Libraries

Recommend

How to implement MySQL bidirectional backup

MySQL bidirectional backup is also called master-...

Steps to run ASP.NET Core in Docker container

There are too much knowledge to learn recently, a...

Sample code for implementing horizontal infinite scrolling with pure CSS3

The examples in this article are all written in s...

Teach you how to quickly enable self-monitoring of Apache SkyWalking

1. Enable Prometheus telemetry data By default, t...

Detailed steps for adding hosts you need to monitor in zabbix

Add monitoring host Host 192.168.179.104 is added...

Detailed explanation of this reference in React

Table of contents cause: go through: 1. Construct...

How to configure two or more sites using Apache Web server

How to host two or more sites on the popular and ...

MySQL data analysis storage engine example explanation

Table of contents 1. Introduce cases 2. View the ...

This article will show you the principle of MySQL master-slave synchronization

Table of contents Brief Analysis of MySQL Master-...

Detailed explanation of data sharing between Vue components

Table of contents 1. In project development, the ...

VMware virtual machine three connection methods example analysis

NAT In this way, the virtual machine's networ...

Linux parted disk partition implementation steps analysis

Compared with fdisk, parted is less used and is m...

CentOS 7 method to modify the gateway and configure the IP example

When installing the centos7 version, choose to co...

How to set a fixed IP in Linux (tested and effective)

First, open the virtual machine Open xshell5 to c...

A brief discussion on the correct posture of Tomcat memory configuration

1. Background Although I have read many blogs or ...