本文教你如何在 CentOS for Linux 系统上安装redis。 |
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/
安装 gcc编译环境,用来执行make 命令:
yum -y install gcc gcc-c++
tar -xzvf redis-5.0.8.tar.gz
mv /opt/software/redis-5.0.8 /usr/local/src/
make
make install PREFIX=/usr/local/redis
mkdir /etc/redis/
cp /usr/local/src/redis-5.0.8/redis.conf /etc/redis/
vim /etc/redis/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
可以把我的配置配置文件进行复制到你的配置文件中。
mkdir /var/log/redis/mkdir /opt/redis_data
/usr/local/redis/bin/redis-server /etc/redis/redis.conf
ps -ef |grep redis
/usr/local/redis/bin/redis-cli
回车
redis-cli shutdown
kill -9 PID
(你的进程 ID,通过这个命令进行查询 ps -ef |grep redis )
或者
pkill redis
原文来自: https://www.linuxprobe.com/centos-redis.html