redis3.2.9安装-源码编译

redis3.2.9安装-源码编译

1.安装redis3.2.9

[root@localhost ~]# yum -y install gcc gcc-c++

[root@localhost ~]# ls

redis-3.2.9.tar.gz

[root@localhost ~]# tar -zxf redis-3.2.9.tar.gz 

[root@localhost ~]# ls

redis-3.2.9  redis-3.2.9.tar.gz

[root@localhost ~]# cd redis-3.2.9

[root@localhost redis-3.2.9]# ls

00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README.md   runtest          runtest-sentinel  src    utils

BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests

[root@localhost redis-3.2.9]# make

#如果报错,执行make MALLOC=libc #参考:编译redis的时候出现zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory问题的解决办法_4yuk的博客-CSDN博客

[root@localhost redis-3.2.9]# make PREFIX=/usr/local/redis install   #安装redis

[root@localhost redis-3.2.9]# ls /usr/local/redis/                 #查看安装后的redis目录

bin

[root@localhost redis-3.2.9]# ls /usr/local/redis/bin/

redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server

[root@localhost redis-3.2.9]# mkdir /usr/local/redis/conf         #优化目录结构

[root@localhost redis-3.2.9]# cp redis.conf  /usr/local/redis/conf/

[root@localhost redis-3.2.9]# echo "PATH=/usr/local/redis/bin/:$PATH" >> /etc/profile

[root@localhost redis-3.2.9]# source /etc/profile

[root@localhost redis-5.0.5]# redis-cli -v

redis-cli 3.2.9

[root@localhost redis-3.2.9]# vim /usr/local/redis/conf/redis.conf

port 6379

bind 192.168.27.128

daemonize yes

requirepass 1hbl3qt

[root@localhost redis-3.2.9]# redis-server /usr/local/redis/conf/redis.conf

[root@localhost redis-3.2.9]# ps -ef |grep redis

root       1624      1  0 20:04 ?        00:00:00 redis-server 192.168.27.128:6379

root       1628   1272  0 20:04 pts/1    00:00:00 grep --color=auto redis

[root@localhost redis-3.2.9]# netstat -anput |grep 6379

tcp        0      0 192.168.27.128:6379     0.0.0.0:*               LISTEN      1624/redis-server 1

[root@localhost redis-3.2.9]# redis-cli -h 192.168.27.128 -a 1hbl3qt

192.168.27.128:6379> keys *

(empty list or set)

192.168.27.128:6379> set k1 v1

OK

192.168.27.128:6379> keys *

1) "k1"

192.168.27.128:6379> quit

2.搭建最后查看redis的配置文件如下:  和肿瘤生产redis配置相差不大,配置可用

[root@localhost conf]# cat redis.conf |grep -vE "^$|#"

bind 192.168.27.128

protected-mode yes

port 6379

tcp-backlog 511

timeout 0

tcp-keepalive 300

daemonize yes

supervised no

pidfile /var/run/redis_6379.pid

loglevel notice

logfile ""

databases 16

save 900 1

save 300 10

save 60 10000

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename dump.rdb

dir ./

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

requirepass 1hbl3qt

appendonly no

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

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

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

3.查看肿瘤登记生产redis配置:

[root@9-95-nginx-redis redis-3.2.9]# cat redis.conf |grep -vE "^$|#"

protected-mode no

port 6379

tcp-backlog 511

timeout 0

tcp-keepalive 300

daemonize no

supervised no

pidfile /var/run/redis_6379.pid

loglevel notice

logfile ""

databases 16

save 900 1

save 300 10

save 60 10000

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename dump.rdb

dir ./

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

requirepass 1hbl3qt

appendonly no

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

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维实战课程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值