Redis在CentOS for LInux上安装详细教程

1.首先上传安装包,这里我以 redis-5.0.8.tar.gz 为例子。

Linux下载redis地址:wget http://download.redis.io/releases/redis-5.0.8.tar.gz

先在opt目录下建立一个软件包上传文件夹  mkdir  /opt/software

把 redis-5.0.8.tar.gz 上传到 /opt/software/

2.下载Redis安装依赖编译环境

 yum -y install gcc gcc-c++ 安装gcc编译环境,用来执行make命令

3.在/opt/software/下使用命令

    tar -xzvf redis-5.0.8.tar.gz

4.把解压的redis源码文件移动到/usr/local/src/目录下

mv /opt/software/redis-5.0.8  /usr/local/src/

5.进入到 /usr/local/src/redis-5.0.8 目录下输入make命令进行源码的编译

 make

6.之后进入/usr/local/src/redis-5.0.8/src/下,输入如下命令,目的是给redis安装指定目录

make install PREFIX=/usr/local/redis

7.建立一个文件夹用来处方自定义的redis.conf 文件

mkdir /etc/redis/

8.把 /usr/local/src/redis-5.0.8/redis.conf 复制到 /etc/redis/

  cp  /usr/local/src/redis-5.0.8/redis.conf   /etc/redis/

9.修改 /etc/redis/redis.conf 配置文件

 vim  /etc/redis/redis.conf 

10.核心redis.conf 配置修改代码如下:

bind 0.0.0.0
protected-mode no
port
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis/redis_master.log
databases
always-show-logo yes
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /opt/redis_data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
replica-priority
maxmemory 10000000kb
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
stream-node-max-bytes
stream-node-max-entries
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit replica 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

可以把我的配置配置文件进行复制到你的配置文件中。

11.配置文件中有的路径需要建立相应目录

1.mkdir  /var/log/redis/

    2.mkdir  /opt/redis_data

12.开始运行redis

/usr/local/redis/bin/redis-server  /etc/redis/redis.conf 

13.检测后台进程是否存在

 ps -ef |grep redis

14.使用客户端可以进行测试了

 /usr/local/redis/bin/redis-cli   回车

15.关闭redis

redis-cli shutdown

16.强制关闭redis

  kill -9  PID(你的进程ID,通过这个命令进行查询ps -ef |grep redis )

或者 pkill redis

上一篇:dlib人脸关键点检测的模型分析与压缩


下一篇:BZOJ_2792_[Poi2012]Well_二分答案