1.下载mycat的tar包
wget http://dl.mycat.io/1.6-RELEASE/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
2.解压
mv Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz /usr/local/mycat.tar.gz
tar -zxvf mycat.tar.gz
3.进入mycat/conf目录
3.1修改逻辑库的配置文schema.xml
select 1
3.2修改分表规则配置文件:rule.xml
id
func1
user_id
func1
sharding_id
hash-int
id
rang-long
id
mod-long
id
murmur
id
crc32slot
create_time
partbymonth
calldate
latestMonth
id
rang-mod
id
jump-consistent-hash
id
rang-mod-dm
orderId
rang-mod-dm
3
0
2
160
2
partition-hash-int.txt
autopartition-long.txt
3
8
128
24
yyyy-MM-dd
2015-01-01
partition-range-mod.txt
3
3.3 修改用户的配置文件server.xml
0
0
2
0
0
1
1m
1k
0
384m
true
123456
TESTDB
4.进入mycat/bin目录
启动命令:./mycat start 或者 ./mycat console
停止命令:./mycat stop
重启命令:./mycat restart
查看状态命令:./mycat status
启动mycat 如果报错,输出以下错误信息:
解决方法:找到.../mycat/conf/wrapper.conf,修改
wrapper.java.additional.10=-Xmx4G (大约在36行)
wrapper.java.additional.11=-Xms1G
改成:
wrapper.java.additional.10=-Xmx1G
wrapper.java.additional.11=-Xms256M
修改完成后,重新执行./mycat console