1、下载MyCat https://github.com/MyCATApache/Mycat-download 选择合适的版本下载,目前我使用的是1.5.1版本
2、安装JDK 需要1.7 或者以上版本 http://blog.csdn.net/linlinv3/article/details/45060705
3、解压 tar -zxvf Mycat-server-1.5.1-RELEASE-20160622153300-linux.tar.gz
其中JDK存放地址为:/home/lin/soft/jdk1.7.0_79
MyCat存放地址为:/home/lin/soft/mycat
存放地址根据个人习惯自己放。
4、修改配置文件
lin@lin190:~/soft/mycat/conf$ vim wrapper.conf
wrapper.java.command=/home/lin/soft/jdk1.7.0_79/bin/java
配置环境变量
export MYCAT_HOME=/home/lin/soft/mycat
5、启动MyCat
lin@lin190:~/soft/mycat/bin$ ./mycat start
Starting Mycat-server...
6、测试是否启动成功
lin@lin190:~/soft/mycat/bin$ netstat -ntulp |grep 8066
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::8066 :::* LISTEN 25941/java
myCat 使用的是8066端口,证明已经启动
7、安装mysql进行试验
安装步骤 http://blog.csdn.net/linlinv3/article/details/51774040
8、使用如下语句测试mycat与mysql的链接
mysql -utest -ptest -h127.0.0.1 -P8066 -DTESTDB
lin@lin190:/home$ mysql -utest -ptest -h127.0.0.1 -P8066 -DTESTDB
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.8-mycat-1.5.1-RELEASE-20160622153300 MyCat Server (OpenCloundDB)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
注意:Linux 下部署安装 MySQL,默认不忽略表名大小写,需要手动到/etc/my.cnf 下配置 lower_case_table_names=1 使 Linux 环境下 MySQL 忽略表名大小写,否则使用 MyCAT 的时候会提示找不到表!
mycat 安装成功!