首页 > 代码库 > 安装redis
安装redis
[root@centos-01 ~]# mkdir soft [root@centos-01 ~]# cd soft [root@centos-01 soft]# wget http://download.redis.io/releases/redis-3.2.5.tar.gz [root@centos-01 soft]# tar xf redis-3.2.5.tar.gz [root@centos-01 soft]# cd redis-3.2.5 [root@centos-01 redis-3.2.5]# make install [root@centos-01 redis-3.2.5]# mkdir -p /usr/local/redis [root@centos-01 redis-3.2.5]# cp redis.conf /usr/local/redis/ [root@centos-01 redis-3.2.5]# mv /usr/local/bin/redis-* /usr/local/redis/ [root@centos-01 redis-3.2.5]# cd /usr/local/redis/ [root@centos-01 redis]# ls redis-benchmark redis-check-aof redis-check-rdb redis-cli redis.conf redis-sentinel redis-server [root@centos-01 redis]# cat redis.conf |grep -v ^# |grep -v ^$ bind 192.168.2.1 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 maxmemory 1024M 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 [root@centos-01 redis]# ps aux |grep redis |grep -v grep root 12019 1.7 0.3 133536 7544 ? Ssl 15:25 0:00 ./redis-server 192.168.2.1:6379 配置文件可以修改为如下方式 daemonize yes #守护进程模式 save 60 1000 #当时间间隔超过60秒,或存储超过1000条记录时,进行持久化。 maxmemory 1024mb #分配1024MB内存 切记,一定要设定maxmemmory,且配置大小要小于物理内存,留有足够的内存供系统使用。 可以来测试性能 [root@centos-01 redis]# ./redis-benchmark -h 192.168.2.1 通过 -q 参数让结果只显示每秒执行的请求数。 [root@centos-01 redis]# ./redis-benchmark -h 192.168.2.1 -q PING_INLINE: 79808.46 requests per second PING_BULK: 66401.06 requests per second SET: 73529.41 requests per second GET: 72568.94 requests per second INCR: 76452.60 requests per second LPUSH: 81037.28 requests per second RPUSH: 74571.22 requests per second LPOP: 79872.20 requests per second RPOP: 77101.00 requests per second SADD: 75700.23 requests per second SPOP: 73046.02 requests per second LPUSH (needed to benchmark LRANGE): 81833.06 requests per second LRANGE_100 (first 100 elements): 33411.29 requests per second LRANGE_300 (first 300 elements): 11392.12 requests per second LRANGE_500 (first 450 elements): 8919.81 requests per second LRANGE_600 (first 600 elements): 6779.20 requests per second MSET (10 keys): 61199.51 requests per second
本文出自 “devops” 博客,谢绝转载!
安装redis
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。