部署Codis集群
启动zookeeper服务
配置 zookeeper
代码语言:javascript复制[root@h101 zookeeper-Standalone]# grep -v "^#" conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
dataLogDir=/tmp/zookeeper
clientPort=2180
[root@h101 zookeeper-Standalone]#
启动 zookeeper
代码语言:javascript复制[root@h101 zookeeper-Standalone]# bin/zkServer.sh start
JMX enabled by default
Using config: /root/zk/zookeeper-Standalone/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@h101 zookeeper-Standalone]#
检查 zookeeper 状态
代码语言:javascript复制[root@h101 zookeeper-Standalone]# cat /tmp/zookeeper/zookeeper_server.pid
9632[root@h101 zookeeper-Standalone]#
[root@h101 zookeeper-Standalone]# ps faux | grep zookee
root 9652 0.0 0.0 103256 828 pts/0 S 17:53 0:00 | _ grep zookee
root 9632 8.8 2.0 2094296 40108 pts/0 Sl 17:53 0:00 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /root/zk/zookeeper-Standalone/bin/../build/classes:/root/zk/zookeeper-Standalone/bin/../build/lib/*.jar:/root/zk/zookeeper-Standalone/bin/../lib/slf4j-log4j12-1.6.1.jar:/root/zk/zookeeper-Standalone/bin/../lib/slf4j-api-1.6.1.jar:/root/zk/zookeeper-Standalone/bin/../lib/netty-3.7.0.Final.jar:/root/zk/zookeeper-Standalone/bin/../lib/log4j-1.2.16.jar:/root/zk/zookeeper-Standalone/bin/../lib/jline-0.9.94.jar:/root/zk/zookeeper-Standalone/bin/../zookeeper-3.4.6.jar:/root/zk/zookeeper-Standalone/bin/../src/java/lib/*.jar:/root/zk/zookeeper-Standalone/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /root/zk/zookeeper-Standalone/bin/../conf/zoo.cfg
[root@h101 zookeeper-Standalone]# netstat -ant | grep 218
tcp 0 0 :::2180 :::* LISTEN
[root@h101 zookeeper-Standalone]# iptables -L -nv | grep 218
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:2180
[root@h101 zookeeper-Standalone]#
Note: 不事先启动zk 而启动后面的服务会报错
启动codis dashboard
配置 config.ini
代码语言:javascript复制Note: codis-config 和 codis-proxy 在不加
-c
参数的时候, 默认会读取当前目录下的 config.ini 文件
[root@h102 codis]# grep -v "^#" config.ini | grep -v "^$"
coordinator=zookeeper
zk=192.168.100.101:2180
product=test
dashboard_addr=192.168.100.102:18087
password=codis
backend_ping_period=5
session_max_timeout=1800
session_max_bufsize=131072
session_max_pipeline=1024
zk_session_timeout=30000
proxy_id=proxy_1
[root@h102 codis]#