mycat配置

总配置环境变量 位置vi /etc/profile

  1. export JAVA_HOME=/usr/local/jdk/jdk1.8.0_161
  2. export JRE_HOME=$JAVA_HOME/jre
  3. export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
  4. export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
  5. export MYCAT_HOME=/usr/local/mycat/mycat
  6. export ZOOKEEPER_HOME=/usr/local/mycat/zookeeper-3.4.10

下载文件

  1. http://dl.mycat.io/

修改配置文件schema.xml

  1. <?xml version="1.0"?>
  2. <!DOCTYPE mycat:schema SYSTEM "schema.dtd">
  3. <mycat:schema xmlns:mycat="http://io.mycat/">
  4. <schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"></schema>
  5. <dataNode name="dn1" dataHost="localhost1" database="db1" />
  6. <dataHost name="localhost1" maxCon="1000" minCon="10" balance="2"
  7. writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
  8. <heartbeat>select user()</heartbeat>
  9. <!-- can have multi write hosts -->
  10. <writeHost host="192.168.232.164" url="192.168.232.164:3306" user="root"
  11. password="#20as3SElksds0ew98">
  12. <!-- can have multi read hosts -->
  13. <readHost host="192.168.232.165" url="192.168.232.165:3306" user="root" password="#20as3SElksds0ew98" />
  14. </writeHost>
  15. <writeHost host="192.168.232.165" url="192.168.232.165:3306" user="root"
  16. password="#20as3SElksds0ew98" />
  17. </dataHost>
  18. </mycat:schema>

启动

  1. mycat start 启动
  2. mycat restart 重启
  3. mycat stop 关闭

配置配置文件zookice

mycat-web下载

  1. https://github.com/MyCATApache/Mycat-download/tree/master/mycat-web-1.0
  2. 启动./start.sh &
  3. 查看是否启动:netstat -ant | grep 8082