Mycat first advanced experience
1. After installation, enter
The configuration information of Schema. xml is as follows:
After installation, log on to the test:
Mysql-utest-ptest-h127.0.0.1-P8066-DTESTDB
2. Create a table
Create table travelrecord (id bigint not null primary key, user_id varchar (100), traveldate DATE, 1_decimal, days int );
3. Input Data
3.1 insert to shard 0:
Explain insert into travelrecord (id, user_id, traveldate, expiration, days) values (100001, 'xiaohong ', '2017-01-06', 2014, 3 );
Insert into travelrecord (id, user_id, traveldate, expiration, days) values (100001, 'xiaohong ', '2017-01-06', 2014, 3 );
3.2 input on shard 1:
Explain insert into travelrecord (id, user_id, traveldate, expiration, days) values (8000004, 'mazi', '2017-01-06 ', 2014, 3 );
Insert into travelrecord (id, user_id, traveldate, expiration, days) values (8000004, 'mazi', '2017-01-06 ', 2014, 3 );
3.3 input on Part 2:
Explain insert into travelrecord (id, user_id, traveldate, expiration, days) values (10000004, 'suqi ', '2017-01-06', 2014, 3 );
Insert into travelrecord (id, user_id, traveldate, expiration, days) values (10000004, 'suqi', '2017-01-06 ', 2014, 3 );
4. query data
4.1 On the db in the mycat background, the routes are displayed on three slices,
Explain select * from Travelrecord;
4.2 single data routing analysis is performed on different datanode:
4.3 go to the actual mysql test and query the data, which has been divided into three shards: db1, db2, and db3, as shown below: