redis4.0单机部署

环境
OS:Centos 7
db:4.0.14

 

 

需要安装gcc
yum install gcc-c++ -y

 

 

 

问题1:
make[1]: 进入目录“/soft/redis-4.0.14/src”
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录
#include <jemalloc/jemalloc.h>
^
解决办法:
make MALLOC=libc
make test

 


问题2:
You need tcl 8.5 or newer in order to run the Redis test
rpm -qa | grep tcl
解决办法:
yum install tcl

 

 

1.下载安装介质
我这里下载的是redis-4.0.14.tar.gz
下载地址:
http://download.redis.io/releases/

2.解压介质并安装
[root@localhost soft]# tar -xvf redis-4.0.14.tar.gz
[root@localhost soft]# cd redis-4.0.14
[root@localhost redis-4.0.14]# make
[root@localhost redis-4.0.14]# make test
没有问题的话,会输入如下信息
\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory `/soft/redis-4.0.14/src'
You have mail in /var/spool/mail/root

安装到指定的目录,默认是安装在/usr/bin目录,我们这里统一安装到/usr/local/services/redis目录,该目录不用提前创建
[root@localhost redis-4.0.14]# cd src
[root@localhost src]# make PREFIX=/usr/local/services/redis install
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install

拷贝 ./scr/redis-trib.rb到指定的目录,该脚本是用来创建集群用的
[root@localhost src]# cp redis-trib.rb /usr/local/services/redis/

3.创建目录并修改相应权限
[root@localhost src]# mkdir -p /home/middle/redis/conf
[root@localhost src]# mkdir -p /home/middle/redis/logs
[root@localhost src]# mkdir -p /home/middle/redis/run
[root@localhost src]# mkdir -p /home/middle/redis/data
修改配置文件
vi /home/middle/redis/conf/7051.conf
内如如下:
daemonize yes
pidfile /home/middle/redis/run/redis-7051.pid
port 7051
tcp-backlog 511
timeout 300
tcp-keepalive 300
loglevel notice
logfile "/home/middle/redis/logs/redis-7051.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump-7051.rdb
dir /home/middle/redis/data
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly yes
appendfilename "redis-7051.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
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
latency-monitor-threshold 0
notify-keyspace-events ""
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
hll-sparse-max-bytes 3000
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
hz 10
aof-rewrite-incremental-fsync yes
# Generated by CONFIG REWRITE
masterauth "hxl01059102"
requirepass "hxl01059102"
protected-mode yes

maxmemory-policy allkeys-lfu

 

maxmemory 9gb  ##根据实际情况调整
maxmemory-samples 5

 

 

4.启动
/usr/local/services/redis/bin/redis-server /home/middle/redis/conf/7051.conf

5.关闭
停掉每个节点
172.17.10.14
/usr/local/services/redis/bin/redis-cli -h 172.17.10.14 -a hxl01059102 -p 7051 shutdown

posted @ 2019-09-06 16:41  slnngk  阅读(601)  评论(0编辑  收藏  举报