Mycat first advanced experience

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.