In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First acquaintance of Mycat
1. What is Mycat?
Mycat is a database middleware, which is used for sub-database and sub-table. it also realizes the functions of read-write separation, failover and so on.
2. How Mycat works
A verb is used to sum up "intercept". It intercepts the SQL statement sent by the user, and first makes some specific analysis of it, such as fragmentation analysis, routing analysis, read-write separation analysis, cache analysis, etc., and then sends it to the real database at the back end, and properly handles the returned results, and finally returns them to the user.
Concepts in Mycat
1. Logical Library (schema)
Logical library is a place directly accessed by users, which is composed of one or more physical libraries at the back end, but users do not know the existence of physical libraries.
two。 Logical table (table)
Similar to the concept of a logical library, the back end consists of one or more physical tables. If there are multiple physical tables, the table is a sliced table. because of the large amount of data, it needs to be divided into tables in multiple databases, each slice has part of the data, and all slices form complete data. If it is a physical table, it is a non-fragmented table.
Because of the fragmentation, the join operation becomes more complex. Accordingly, ER table and global table are proposed in Mycat to optimize join. The ER table is a table grouping formed by the Emurr relation, that is, the records of the child table and the associated parent table are stored on the same slice. The global table, which is similar to the dictionary table, has a complete copy of the data on each slice.
3. Sharding node (dataNode)
After data segmentation, a large table is divided into different sharding databases, and the database where each table shard is located is the sharding node.
4. Node host (dataHost)
After data segmentation, each sharding node may not necessarily own a machine, and there can be multiple sharding databases on the same machine, so that the machine in which one or more sharding nodes are located is the node host.
5. Sharding rules (rule)
After data segmentation, a large table is divided into several slicing tables, which requires certain rules, so the method of dividing the data into a certain slicing according to certain business rules is the slicing rule.
6. Global Serial number (sequence)
After data segmentation, the primary key constraints in the original relational database can not be used under distributed conditions, so it is necessary to introduce an external mechanism to ensure the unique identification of the data. the mechanism to ensure the global unique identification of the data is the global serial number.
Installation of Mycat
1. Download jdk and set up the Java environment
Http://www.oracle.com/technetwork/java/javase/archive-139210.html
Extract it to the directory / usr/local.
# cat / etc/profile.d/java.sh
Export JAVA_HOME=/usr/local/jdk1.7.0_80
Export PATH=$JAVA_HOME/bin:$PATH
Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
# source / etc/profile.d/java.sh
# java-version
Java version "1.7.080"
Java (TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot (TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
2. Download and install Mycat
Https://github.com/MyCATApache/Mycat-download/blob/master/1.5-RELEASE/Mycat-server-1.5.1-RELEASE-20161130213509-linux.tar.gz
Extract it to the directory / usr/local.
# cat / etc/profile.d/mycat.sh
Export MYCAT_HOME=/usr/local/mycat
# source / etc/profile.d/mycat.sh
# echo $MYCAT_HOME
/ usr/local/mycat
Create a mycat user
# useradd mycat
Start
# su-mycat
$cd / usr/local/mycat/
$bin/mycat restart
Stopping Mycat-server...
Mycat-server was not running.
Starting Mycat-server...
$tail-f logs/wrapper.log
...
INFO | jvm 1 | 21:43:25 on 2018-03-15 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO | jvm 1 | 21:43:25 on 2018-03-15 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 1 | 21:43:25 on 2018-03-15 |
INFO | jvm 1 | 21:43:25 on 2018-03-15 | log4j 2018-03-15 21:43:25 [. / conf/log4j.xml] load completed.
INFO | jvm 1 | 21:44:25 on 2018-03-15 | MyCAT Server startup successfully. See logs in logs/mycat.log
If you are interested, please follow Subscription account's Database Best practices (DBBestPractice).
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
2. View the Exhibit to examine the description for the SALES table.Which views can have all DML oper
© 2024 shulou.com SLNews company. All rights reserved.