标签:logfile make pen user filename 下载 server comm 编辑
下载redis源码包,我下载的是redis2.8.17
解压缩该源码包
tar zxf redis-2.8.17.tar.gz
进入解压缩后的目录
cd redis-2.8.17/
添加redis用户
useradd -s /sbin/nologin redis
安装Make命令
apt-get install make
编译
make
缺少gcc安装gcc
apt-get install gcc
再次编译
make
缺少 jemalloc,搜索
apt-cache search jemalloc
安装 jemalloc
apt-get install libjemalloc-dev
清理错误的make
make distclean
再次make
make
完成后进入到src文件夹
cd src
拷贝编译好的二进制文件到/usr/local/bin下
cp -a mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server /usr/local/bin/
编辑redis配置文件和sentinel配置文件
redis的
#####################################
daemonize yes
pidfile /var/run/redis.pid
port 6379##端口###
slaveof 172.17.3.21 6379 ###这里指的是这个节点是从节点,主节点地址172.17.3.21,如果要做主节点,就把这个选项屏蔽掉###
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel warning
logfile /data/logs/redis/redis.log ###日志路径##
databases 16
save 1200 1
save 900 10000
save 300 100000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /data/redis/6379###数据文件存放路径###
slave-serve-stale-data yes
slave-read-only yes
slave-priority 100
appendonly yes
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 1024
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
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
rename-command CONFIG ""
################################
以下是sentinel的
#########################
port 26379
daemonize yes
logfile "/data/logs/redis/sentinel.log"
sentinel monitor mymaster 172.17.3.21 6379 2
sentinel config-epoch mymaster 250
sentinel leader-epoch mymaster 250
# Generated by CONFIG REWRITE
dir "/usr/local/etc"
sentinel known-slave mymaster 172.17.3.22 6379
sentinel known-slave mymaster 172.17.3.20 6379
sentinel known-sentinel mymaster 172.17.3.22 26379 8f827aaeda5ae907ba956bd480fe3048104f9f96
sentinel known-sentinel mymaster 172.17.3.20 26379 fa24f5ae497b7c7f46b1012d179a326b4e36b722
sentinel current-epoch 250
##############################
建立日志文件夹路径和数据文件夹路径
mkdir /data/logs/redis/ -p
mkdir /data/redis/6379 -p
更改文件夹用户为redis
chown -R redis.redis redis/
修改内核设置
vim /etc/sysctl.conf
增加如下
vm.overcommit_memory=1
使之生效
sysctl -p
启动redis和哨兵sentinel
/usr/local/bin/redis-server /usr/local/etc/redis.conf
/usr/local/bin/redis-sentinel /usr/local/etc/sentinel.conf
以上是在debian9下部署过程,比较简单不麻烦
如果在centos 7 下面大同小异,只是安装依赖的方法不同而已。
标签:logfile make pen user filename 下载 server comm 编辑
原文地址:http://www.cnblogs.com/hh2737/p/7520675.html