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