Introduction mycat
From the definition and classification point of view, it is an open source distributed database system and a server that implements the MySQL protocol. Front-end users can regard it as a database proxy, which can be accessed with MySQL client tools and command lines. The backend can communicate with multiple MySQL servers using the MySQL native protocol , and can also communicate with most mainstream database servers using the JDBC protocol . In the back- end MySQL server or other database.
MyCat has developed to the current version, and it is no longer a pure MySQL agent. Its backend can support mainstream databases such as MySQL , SQL Server , Oracle , DB2 , PostgreSQL , etc. It also supports MongoDB , a new type of NoSQL storage. More types of storage are supported. From the point of view of the end user, no matter what kind of storage method, in MyCat , it is a traditional database table, which supports standard SQL statements for data operations. In this way, for the front-end business system, it can be greatly reduced. Development difficulty, improve development speed
MyCAT-WEB is a performance monitoring tool based on mycat , which is convenient for everyone to use mycat to manage mycat and monitor mycat more effectively , so that everyone's mycat work is more efficient.
1 , download
2 , zookpeer installation
download
Install: tar -zxvf zookeeper-3.4.6.tar.gz -C /usr/local/ cd /usr/local/zookeeper-3.4.6/ cd conf cp zoo_sample.cfg zoo.cfg start up: cd /usr/local/zookeeper-3.4.6/bin/ ./zkServer.sh start
|
3 , mycat-web installation
download:
1. Install JDK requires jdk1.7+ 2. Start windows start start start.bat linux boot start start.sh 3. Access address: http://localhost:8082/mycat |
tar -xvf Mycat-web-1.0-SNAPSHOT-20160331220346-linux.tar.gz -C /usr/local/ Modify the zookeeper address: cd /usr/local/mycat-web/mycat-web/WEB-INF/classes vim mycat.properties zookeeper=127.0.0.1:2181 start up: cd /usr/local/mycat-web/ ./start.sh & |
The access address is: http://192.168.121.52:8082/mycat/
PS : To start zookeeper first and then start mycat-web , check whether zookeeper and mycat-web are started:
[root@oracle_standby mycat-web]# netstat -ntpl |grep 8082 tcp 0 0 :::8082 :::* LISTEN 18288/java [root@oracle_standby mycat-web]# [root@oracle_standby mycat-web]# netstat -ntpl |grep 2181 tcp 0 0 :::2181 :::* LISTEN 18251/java [root@oracle_standby mycat-web]# |
4,打开mycat-web窗口
输入网址:http://192.168.121.52:8082/mycat/
01. png
5,配置mycat服务
配置见02.png,
配置成功后见03.png
6,SQL语法检测功能还未完善
点击“SQL-上线”下面的“SQL语法检测”,然后输入一个错误的insert插入sql语句insert into person(id,name)values('a','a');点击下面的“语法检测”,界面没有返回任何结果,如10.png所示:
7,mycat服务监控
在mycat后台压测千万insert,如下:
./test_stand_insert_perf.sh jdbc:mysql://192.168.121.52:8066/TESTDB test test 10 file=mydata-create.sql |
然后去mycat-web界面的服务监控看性能曲线,可以看到mycat tps分析、内存分析、连接分析,如11.png所示:
PS:小技巧如何实时看监控数据太少,就可以选择左下角的历史查询,选择1小时、2小时、3小时会出来更多的数据。
8,SQL-监控
SQL表分析,如801.png:
高频SQL分析,如图802.png
SQL解析,如图803.png