CentOS 6.5下搭建Codis3.1集群详解(2)

执行全部指令后,会在 bin 文件夹内生成 codis-admin、codis-dashboard、codis-fe、codis-ha、codis-proxy、codis-server 六个可执行文件。
另外, bin/assets 文件夹是 codis-dashboard http 服务需要的前端资源, 需要和codis-dashboard 放置在同一文件夹下

5.4 创建codis所需目录
mkdir /opt/codis -p
mkdir -p /opt/codis/{logs,conf,scripts,db,run}
mkdir -p /opt/codis/db/{redis_data_6379,redis_data_6380}

5.5 拷贝codis的bin目录
cp -rf /opt/gopath/src/github.com/CodisLabs/codis/bin/ /opt/codis/

由于codis 本身只有codis-server ,没有Redis-cli,需要把redis 2.8.21 安装包里面的redis-cli copy到/usr/local/codis/bin 下面:
cd /opt/gopath/src/github.com/CodisLabs/codis/extern/redis-2.8.21/src
cp redis-cli /opt/codis/bin/

5.6 配置和启动各组件

配置和启动 Codis的Redis
配置文件 : /usr/local/codis/redis_conf/redis6379.conf
设置密码: xxxxx
考虑性能,主库关闭aof和rdp,从库只开启aof:

cd /opt/gopath/src/github.com/CodisLabs/codis/extern/redis-2.8.21/

cp redis.conf /opt/codis/conf/redis6379.conf

将redis6379.conf更改以下参数(主库):

[root@data-1-1 conf]# grep '^[a-z]' redis6379.conf

daemonize yes

pidfile /opt/codis/run/redis6379.pid

port 6379

tcp-backlog 511

timeout 86400

tcp-keepalive 60

loglevel notice

logfile "/opt/codis/logs/redis6379.log"

databases 16

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename dump6379.rdb

dir /opt/codis/db/redis_data_6379

masterauth ""

slave-serve-stale-data yes

repl-disable-tcp-nodelay no

slave-priority 100

requirepass ""

maxmemory 10gb

maxmemory-policy volatile-lru

appendonly no

appendfsync everysec

no-appendfsync-on-rewrite yes

auto-aof-rewrite-percentage 100

auto-aof-rewrite-min-size 64mb

aof-load-truncated yes

lua-time-limit 5000

slowlog-log-slower-than 10000

slowlog-max-len 128

hash-max-ziplist-entries 512

hash-max-ziplist-value 64

list-max-ziplist-entries 512

list-max-ziplist-value 64

set-max-intset-entries 512

zset-max-ziplist-entries 128

zset-max-ziplist-value 64

client-output-buffer-limit normal 0 0 0

client-output-buffer-limit slave 0 0 0

client-output-buffer-limit pubsub 0 0 0

hz 10

aof-rewrite-incremental-fsync yes

将redis6380.conf更改以下参数(从库):

cp /opt/codis/conf/redis6379.conf /opt/codis/conf/redis6380.conf

vim redis6380.conf

:%s/6379/6380/g

保存退出

5.7 启动redis

执行之前注意将log和data的文件生成目录建好,不然会启动失败

/opt/codis/bin/codis-server /opt/codis/conf/redis6379.conf &

/opt/codis/bin/codis-server /opt/codis/conf/redis6380.conf &

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/64efc3e5c8a5759181af029b16bef2e4.html