[[email protected] ~]# ls
codis-release3.2.zip  go1.8.linux-amd64.tar.gz  jdk-8u121-linux-x64.rpm  zookeeper-3.4.9.tar.gz  zookeeper.out

[[email protected] ~]# ls
redis-4.0.1  redis-4.0.1.tar.gz

[[email protected] ~]# ls
redis-4.0.1  redis-4.0.1.tar.gz

1.实验环境

实验所用虚拟机为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

 

[[email protected] ~]#  tar -zxf go1.8.linux-amd64.tar.gz  -C /usr/local/
[[email protected] ~]# vim /etc/profile

[[email protected] ~]# source /etc/profile

[[email protected] ~]# go version
go version go1.8 linux/amd64

[[email protected] ~]# mkdir -p $GOPATH/src/github.com/CodisLabs
[[email protected] ~]# ls
codis-release3.2.zip  go1.8.linux-amd64.tar.gz
[[email protected] ~]# yum install unzip -y

[[email protected] ~]# unzip codis-release3.2.zip
Archive:  codis-release3.2.zip

[[email protected] ~]#  mv codis-release3.2 $GOPATH/src/github.com/CodisLabs/codis
[[email protected] ~]# cd $GOPATH/src/github.com/CodisLabs/codis
[[email protected] codis]#
[[email protected] 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
[[email protected] codis]# yum install -y gcc git autoconf

[[email protected] 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
[[email protected] codis]# pwd
/usr/local/codis/src/github.com/CodisLabs/codis
[[email protected] codis]# make MALLOC=libc
make -j4 -C extern/redis-3.2.8/

 

[[email protected] 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
[[email protected] codis]# ls admin/
codis-dashboard-admin.sh  codis-fe-admin.sh  codis-proxy-admin.sh  codis-server-admin.sh
[[email protected] codis]# ls config/
dashboard.toml  proxy.toml  redis.conf  sentinel.conf

 

 

[[email protected] ~]# ls
codis-release3.2.zip  go1.8.linux-amd64.tar.gz  jdk-8u121-linux-x64.rpm
[[email protected] ~]# yum install -y jdk-8u121-linux-x64.rpm

 

[[email protected] ~]# java -version
java version "1.8.0_121"

 

[[email protected] ~]# tar -xzf zookeeper-3.4.9.tar.gz -C /usr/local/
[[email protected] ~]# vim /etc/profile
[[email protected] ~]# cd /usr/local/zookeeper-3.4.9/
[[email protected] zookeeper-3.4.9]# pwd
/usr/local/zookeeper-3.4.9
[[email protected] zookeeper-3.4.9]# cd
[[email protected] ~]# vim /etc/profile
[[email protected] ~]# source /etc/profile
[[email protected] ~]#  cp /usr/local/zookeeper-3.4.9/conf/zoo_sample.cfg /usr/local/zookeeper-3.4.9/conf/zoo.cfg

[[email protected] ~]# vim /usr/local/zookeeper-3.4.9/conf/zoo.cfg
[[email protected] ~]# mkdir -p /data/zookeeper/data
[[email protected] ~]# echo "1" > /data/zookeeper/data/myid
[[email protected] ~]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[[email protected] ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: standalone

 

[[email protected] ~]# cat zookeeper.out

显示 INFO WARM

 

[[email protected] ~]# vim /usr/local/codis/config.ini
[[email protected] ~]# vim /usr/local/zookeeper-3.4.9/conf/zoo.cfg

[[email protected] ~]# vim /etc/profile

 

[[email protected] ~]# 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.
[[email protected] ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: standalone
[[email protected] ~]# cd $GOPATH/src/github.com/CodisLabs/codis
[[email protected] codis]# ./admin/codis-dashboard-admin.sh start
/usr/local/codis/src/github.com/CodisLabs/codis/admin/../config/dashboard.toml
starting codis-dashboard ...
[[email protected] codis]# cat log/codis-dashboard.log.2017-10-19
cat: log/codis-dashboard.log.2017-10-19: No such file or directory
[[email protected] codis]#

 

[[email protected] codis]#  ./admin/codis-proxy-admin.sh start
/usr/local/codis/src/github.com/CodisLabs/codis/admin/../config/proxy.toml
starting codis-proxy ...

[[email protected] 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/                
[[email protected] 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

 

[[email protected] 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
[[email protected] codis]# ./admin/codis-fe-admin.sh start

starting codis-fe ...

[[email protected] 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
[[email protected] codis]# pwd
/usr/local/codis/src/github.com/CodisLabs/codis
[[email protected] codis]# cd
[[email protected] ~]# 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 

[[email protected] ~]# ls
redis-4.0.1  redis-4.0.1.tar.gz

安装gcc -y

 

[[email protected] redis-4.0.1]#  mkdir -p /data/cluster/7000
[[email protected] redis-4.0.1]# cp redis.conf /data/cluster/7000/
cp: overwrite `/data/cluster/7000/redis.conf'? y

[[email protected] redis-4.0.1]#  vim /data/cluster/7000/redis.conf
[[email protected] redis-4.0.1]# cp redis.conf /data/cluster/7000/
cp: overwrite `/data/cluster/7000/redis.conf'? y'
[[email protected] redis-4.0.1]# vim /data/cluster/7000/redis.conf
[[email protected] 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
[[email protected] redis-4.0.1]#  ps -ef |grep 7000
root      5132  1337  0 06:17 pts/0    00:00:00 grep 7000

 

server3

[[email protected] ~]# ls
redis-4.0.1  redis-4.0.1.tar.gz


[[email protected] redis-4.0.1]# vim redis.conf
[[email protected] 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
[[email protected] redis-4.0.1]#  ps -ef |grep 7001
root      4675  1334  0 06:21 pts/0    00:00:00 grep 7001

 

修改server1的配置文件

[[email protected] ~]# vim /etc/profile

 

export GOPATH=/usr/local/codis
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin

 

[[email protected] ~]# 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

 

[[email protected] ~]# 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

 

[[email protected] ~]# vim /usr/local/codis/config.ini

zk=localhost:2181
product=test
proxy_id=proxy_1
net_timeout=5
dashboard_addr=localhost:18087
coordinator=zookeeper

 

[email protected] ~]# vim /data/cluster/7000/redis.conf

server2     server3同理

port 6379

daemonize yes

 

事件图片

http://172.25.77.1:9090/#codis-demo

 

配置codis 集群

 

配置codis 集群

相关文章: