[root@server1 ~]# ls
codis-release3.2.zip go1.8.linux-amd64.tar.gz jdk-8u121-linux-x64.rpm zookeeper-3.4.9.tar.gz zookeeper.out
[root@server2 ~]# ls
redis-4.0.1 redis-4.0.1.tar.gz
[root@server3 ~]# ls
redis-4.0.1 redis-4.0.1.tar.gz
实验所用虚拟机为redhat6.5
ip地址 | 角色 | hostname |
---|---|---|
172.25.77.2 | Codis-redis-master | server2 |
172.25.77.3 | Codis-redis-slave | server3 |
172.25.77.1 | codis-proxy - | server1 |
[root@server1 ~]# tar -zxf go1.8.linux-amd64.tar.gz -C /usr/local/
[root@server1 ~]# vim /etc/profile
[root@server1 ~]# source /etc/profile
[root@server1 ~]# go version
go version go1.8 linux/amd64
[root@server1 ~]# mkdir -p $GOPATH/src/github.com/CodisLabs
[root@server1 ~]# ls
codis-release3.2.zip go1.8.linux-amd64.tar.gz
[root@server1 ~]# yum install unzip -y
[root@server1 ~]# unzip codis-release3.2.zip
Archive: codis-release3.2.zip
[root@server1 ~]# mv codis-release3.2 $GOPATH/src/github.com/CodisLabs/codis
[root@server1 ~]# cd $GOPATH/src/github.com/CodisLabs/codis
[root@server1 codis]#
[root@server1 codis]# ls
admin cmd deploy Dockerfile extern Makefile pkg scripts version
ansible config doc example Godeps MIT-LICENSE.txt README.md vendor wandoujia_license.txt
[root@server1 codis]# yum install -y gcc git autoconf
[root@server1 codis]# ls
admin cmd deploy Dockerfile extern Makefile pkg scripts version
ansible config doc example Godeps MIT-LICENSE.txt README.md vendor wandoujia_license.txt
[root@server1 codis]# pwd
/usr/local/codis/src/github.com/CodisLabs/codis
[root@server1 codis]# make MALLOC=libc
make -j4 -C extern/redis-3.2.8/
[root@server1 codis]# ls
admin bin config doc example Godeps MIT-LICENSE.txt README.md vendor wandoujia_license.txt
ansible cmd deploy Dockerfile extern Makefile pkg scripts version
[root@server1 codis]# ls admin/
codis-dashboard-admin.sh codis-fe-admin.sh codis-proxy-admin.sh codis-server-admin.sh
[root@server1 codis]# ls config/
dashboard.toml proxy.toml redis.conf sentinel.conf
[root@server1 ~]# ls
codis-release3.2.zip go1.8.linux-amd64.tar.gz jdk-8u121-linux-x64.rpm
[root@server1 ~]# yum install -y jdk-8u121-linux-x64.rpm
[root@server1 ~]# java -version
java version "1.8.0_121"
[root@server1 ~]# tar -xzf zookeeper-3.4.9.tar.gz -C /usr/local/
[root@server1 ~]# vim /etc/profile
[root@server1 ~]# cd /usr/local/zookeeper-3.4.9/
[root@server1 zookeeper-3.4.9]# pwd
/usr/local/zookeeper-3.4.9
[root@server1 zookeeper-3.4.9]# cd
[root@server1 ~]# vim /etc/profile
[root@server1 ~]# source /etc/profile
[root@server1 ~]# cp /usr/local/zookeeper-3.4.9/conf/zoo_sample.cfg /usr/local/zookeeper-3.4.9/conf/zoo.cfg
[root@server1 ~]# vim /usr/local/zookeeper-3.4.9/conf/zoo.cfg
[root@server1 ~]# mkdir -p /data/zookeeper/data
[root@server1 ~]# echo "1" > /data/zookeeper/data/myid
[root@server1 ~]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@server1 ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: standalone
[root@server1 ~]# cat zookeeper.out
显示 INFO WARM
[root@server1 ~]# vim /usr/local/codis/config.ini
[root@server1 ~]# vim /usr/local/zookeeper-3.4.9/conf/zoo.cfg
[root@server1 ~]# vim /etc/profile
[root@server1 ~]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... already running as process 5976.
[root@server1 ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: standalone
[root@server1 ~]# cd $GOPATH/src/github.com/CodisLabs/codis
[root@server1 codis]# ./admin/codis-dashboard-admin.sh start
/usr/local/codis/src/github.com/CodisLabs/codis/admin/../config/dashboard.toml
starting codis-dashboard ...
[root@server1 codis]# cat log/codis-dashboard.log.2017-10-19
cat: log/codis-dashboard.log.2017-10-19: No such file or directory
[root@server1 codis]#
[root@server1 codis]# ./admin/codis-proxy-admin.sh start
/usr/local/codis/src/github.com/CodisLabs/codis/admin/../config/proxy.toml
starting codis-proxy ...
[root@server1 codis]# tail log/codis-proxy.log.2018-08-12
admin/ config/ example/ log/ README.md version
ansible/ deploy/ extern/ Makefile scripts/ wandoujia_license.txt
bin/ doc/ .gitignore MIT-LICENSE.txt .travis.yml
cmd/ Dockerfile Godeps/ pkg/ vendor/
[root@server1 codis]# tail log/codis-proxy.log.2018-08-12
2018/08/12 06:03:44 router.go:229: [WARN] fill slot 1019, backend.addr = , locked = false
2018/08/12 06:03:44 router.go:229: [WARN] fill slot 1020, backend.addr = , locked = false
2018/08/12 06:03:44 router.go:229: [WARN] fill slot 1021, backend.addr = , locked = false
[root@server1 codis]# ./admin/codis-server-admin.sh start
your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
6115:M 12 Aug 06:04:20.653 * The server is now ready to accept connections on port 6379
[root@server1 codis]# ./admin/codis-fe-admin.sh start
starting codis-fe ...
[root@server1 codis]# tail log/codis-fe.log.2018-08-12
2018/08/12 06:04:40 main.go:101: [WARN] set ncpu = 1
2018/08/12 06:04:40 main.go:104: [WARN] set listen = 0.0.0.0:9090
2018/08/12 06:04:40 main.go:120: [WARN] set assets = /usr/local/codis/src/github.com/CodisLabs/codis/bin/assets
2018/08/12 06:04:40 main.go:155: [WARN] set --filesystem = /tmp/codis
2018/08/12 06:04:40 main.go:209: [WARN] option --pidfile = /usr/local/codis/src/github.com/CodisLabs/codis/bin/codis-fe.pid
[root@server1 codis]# pwd
/usr/local/codis/src/github.com/CodisLabs/codis
[root@server1 codis]# cd
[root@server1 ~]# ls
codis-release3.2.zip go1.8.linux-amd64.tar.gz jdk-8u121-linux-x64.rpm zookeeper-3.4.9.tar.gz zookeeper.out
server2
[root@server2 ~]# ls
redis-4.0.1 redis-4.0.1.tar.gz
安装gcc -y
[root@server2 redis-4.0.1]# mkdir -p /data/cluster/7000
[root@server2 redis-4.0.1]# cp redis.conf /data/cluster/7000/
cp: overwrite `/data/cluster/7000/redis.conf'? y
[root@server2 redis-4.0.1]# vim /data/cluster/7000/redis.conf
[root@server2 redis-4.0.1]# cp redis.conf /data/cluster/7000/
cp: overwrite `/data/cluster/7000/redis.conf'? y'
[root@server2 redis-4.0.1]# vim /data/cluster/7000/redis.conf
[root@server2 redis-4.0.1]# redis-server /data/cluster/7000/redis.conf
5126:C 12 Aug 06:17:22.844 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5126:C 12 Aug 06:17:22.844 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=5126, just started
5126:C 12 Aug 06:17:22.844 # Configuration loaded
[root@server2 redis-4.0.1]# ps -ef |grep 7000
root 5132 1337 0 06:17 pts/0 00:00:00 grep 7000
server3
[root@server3 ~]# ls
redis-4.0.1 redis-4.0.1.tar.gz
[root@server3 redis-4.0.1]# vim redis.conf
[root@server3 redis-4.0.1]# redis-server redis.conf
4669:C 12 Aug 06:21:34.935 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4669:C 12 Aug 06:21:34.935 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=4669, just started
4669:C 12 Aug 06:21:34.935 # Configuration loaded
[root@server3 redis-4.0.1]# ps -ef |grep 7001
root 4675 1334 0 06:21 pts/0 00:00:00 grep 7001
修改server1的配置文件
[root@server1 ~]# vim /etc/profile
export GOPATH=/usr/local/codis
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
[root@server1 ~]# vim /etc/profile
export GOPATH=/usr/local/codis
export GOROOT=/usr/local/go
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.9/
export PATH=$PATH:/usr/local/go/bin:$ZOOKEEPER_HOME/bin
[root@server1 ~]# vim /usr/local/zookeeper-3.4.9/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper/data
clientPort=2181
autopurge.snapRetainCount=500
autopurge.purgeInterval=24
#server.1=codis-1:2888:3888
#server.2=codis-2:2888:3888
#server.2=codis-3:2888:3888
[root@server1 ~]# vim /usr/local/codis/config.ini
zk=localhost:2181
product=test
proxy_id=proxy_1
net_timeout=5
dashboard_addr=localhost:18087
coordinator=zookeeper
root@server2 ~]# vim /data/cluster/7000/redis.conf
server2 server3同理
port 6379
daemonize yes
事件图片
http://172.25.77.1:9090/#codis-demo