Mycat -- linux安裝與配置筆記
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監控資訊。