Mycat介绍,请戳官网:http://www.mycat.io/
官网地址:http://dl.mycat.io/1.6.5/
以oracle物理库为例。
1、解压安装包
tar -zxvf Mycat-server-1.6.5-release-20171029183033-linux.tar.gz
2、复制驱动
上传oracle驱动,如ojdbc14-10.2.0.5.0.jar到/lib目录
并赋权
chmod +x ojdbc14-10.2.0.5.0.jar
3、定制化开发
如果有定制化开发,更新上传最新mycat-jar,如Mycat-server-1.6.5-release.jar到/lib目录
4、切换配置目录
更新配置文件/conf,主要为rule.xml、schema.xml、server.xml、wrapper.conf
5、启动mycat
切换bin目录
清空控制台日志,并启动
sh mycat start
6、停止mycat
sh mycat stop
7、查看进程
ps -ef | grep mycat
8、查看日志
tail -f /mycat/mycat/logs/wrapper.log -n 200
9、管理控制台
登录管理端口,使用命令可以查看管理命令
> show @@help;
+--------------------------------------+-----------------------------------+
| STATEMENT | DESCRIPTION |
+--------------------------------------+-----------------------------------+
| clear @@slow where datanode = ? | Clear slow sql by datanode |
| clear @@slow where schema = ? | Clear slow sql by schema |
| kill @@connection id1,id2,... | Kill the specified connections |
| offline | Change MyCat status to OFF |
| online | Change MyCat status to ON |
| reload @@config | Reload all config from file |
| reload @@route | Reload route config from file |
| reload @@user | Reload user config from file |
| rollback @@config | Rollback all config from memory |
| rollback @@route | Rollback route config from memory |
| rollback @@user | Rollback user config from memory |
| show @@backend | Report backend connection status |
| show @@cache | Report system cache usage |
| show @@command | Report commands status |
| show @@connection | Report connection status |
| show @@connection.sql | Report connection sql |
| show @@database | Report databases |
| show @@datanode | Report dataNodes |
| show @@datanode where schema = ? | Report dataNodes |
| show @@datasource | Report dataSources |
| show @@datasource where dataNode = ? | Report dataSources |
| show @@heartbeat | Report heartbeat status |
| show @@parser | Report parser status |
| show @@processor | Report processor status |
195
| show @@router | Report router status |
| show @@server | Report server status |
| show @@session | Report front session details |
| show @@slow where datanode = ? | Report datanode slow sql |
| show @@slow where schema = ? | Report schema slow sql |
| show @@sql where id = ? | Report specify SQL |
| show @@sql.detail where id = ? | Report execute detail status |
| show @@sql.execute | Report execute status |
| show @@sql.slow | Report slow SQL |
| show @@threadpool | Report threadPool status |
| show @@time.current | Report current timestamp |
| show @@time.startup | Report startup timestamp |
| show @@version | Report Mycat Server version |
| stop @@heartbeat name:time | Pause dataNode heartbeat |
| switch @@datasource name:index | Switch dataSource |
+--------------------------------------+-----------------------------------+
10、监控工具
mycat-web(eye)界面监控,需要 zookeeper 3.4.6+、mysql(推荐)
1、解压:
tar ‐zxvf Mycat-web-1.0-SNAPSHOT-20170102153329-linux.tar.gz
2、修改 jdbc.properties(存储sql监控记录)
mycat-web/mycat-web/WEB-INF/classes/jdbc.properties
使用mysql,sqllite目前有些问题
3、修改mycat. Properties
其中zookeeper配置单节点zookeeper地址
sqlonline是sql上线配置
4、启动mycat-web
sh start.sh
5、打开
http://134.161.153.114:8082/mycat
可以查看 各种mycat监控指标,以及sql监控信息。