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

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

      Linux下载redis地址:wget

    先在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=http://www.likecs.com/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 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize yes supervised no pidfile /var/run/redis_6379.pid loglevel notice logfile /var/log/redis/redis_master.log databases 16 always-show-logo yes save 900 1 save 300 10 save 60 10000 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 5 repl-disable-tcp-nodelay no replica-priority 100 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 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes aof-use-rdb-preamble 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-size -2 list-compress-depth 0 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 stream-node-max-bytes 4096 stream-node-max-entries 100 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit replica 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 dynamic-hz yes aof-rewrite-incremental-fsync yes rdb-save-incremental-fsync yes

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

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