In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Deploy mycat
Mycat runs on java, check java version
[root@node119 ~] # java-versionopenjdk version "1.8.0,171" OpenJDK Runtime Environment (build 1.8.0_171-b10) OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
Configure java variables
[root@node119 ~] # vim / etc/profileexport JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.el7.x86_64export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin
Mycat download address
Http://dl.mycat.io/cd / opttar zxvf Mycat-server-1.6.5-release-20180122220033-linux.tar.gz
General architecture diagram
Core concept schema: logical database datanode composed of multiple databases: after sharding the data, a large table is assigned to different sharding databases, and the database where each table shard resides is called the sharding node datahost: the machine where one or more sharding nodes are located is the node host.
The concept of sharding node and node host is a little difficult to understand. For example, a 100W table is divided into two tables, the first 50W is in the database of host A, and the last 50W is in the database of host B, and the database where the table is located is called the sharding node of this table; it is impossible to have only one table in a host, there will be many sharding tables on the host, and the host is called the node host, that is, datanode=database@datahost
A simple explanation of the mycat principle:
Block-> analyze-> forward-> result processing-> return to the user
Mycat analysis roughly includes: fragmentation analysis, routing analysis, read-write separation analysis, cache analysis and so on. In the next experiment, we will analyze log to see how mycat works.
Requirement description
There is a library of three tables.
MySQL [mycat01] > show tables;+-+ | Tables in mycat01 | +-+ | T1 | | T2 | | T3 | +-Sub-library:
T1 in mysql cluster
T2 in percona cluster
Sub-table:
T3 id models 1024 less than 1024 in mysql clusters, and more than 1024 in percona clusters
Read-write separation:
T1 writehost is node115
Stand by writehost is node116
Readhost is node117
T2 writehost is node126
Readhost is node123 node125
Configuration file # two mycat users are created here (note: it has nothing to do with back-end mysql users) root has read and write permissions, and user has read permissions [root@node119 ~] # vim / opt/mycat/conf/server.xml 123456 mycat01 user mycat01 true
Balance= "0" does not enable read-write separation, that is, all read-write operations are sent to writehost
All readhost and stand by writehost of balance= "1" participate in the load of select statements, that is, in mutual master-slave mode.
Balance= "2" all read and write operations are randomly distributed on readhost and writehost
Balance= "3" all read requests are sent to the readhost corresponding to writehost, reducing the pressure on writehost
WriteType= "0" all writes are sent to the first writehost, and then switched to the second after the first writehots down without failback
[root@node119 ~] # vim / opt/mycat/conf/schema.xml # schema name is the mapped logical library name, that is, the shard node where the name # T1 is seen by the user accessing mycat is mysql. In other words, mycat will only find T1 from the mysql cluster. # mycat will look for T3 select user () from two shard nodes. Select user () [root@node119 ~] # vim / opt/mycat/conf/rule.xml 2 512
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
© 2024 shulou.com SLNews company. All rights reserved.