elixiat 发表于 2018-11-4 12:13:25

安装redis-devops

# mkdir soft  
# cd soft
  
# wget http://download.redis.io/releases/redis-3.2.5.tar.gz
  
# tar xf redis-3.2.5.tar.gz
  
# cd redis-3.2.5
  
# make install
  
# mkdir -p /usr/local/redis
  
# cp redis.conf /usr/local/redis/
  
# mv /usr/local/bin/redis-* /usr/local/redis/
  
# cd /usr/local/redis/
  
# ls
  
redis-benchmarkredis-check-aofredis-check-rdbredis-cliredis.confredis-sentinelredis-server
  

  
# 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
  

  
# ps aux |grep redis |grep -v grep
  
root   120191.70.3 1335367544 ?      Ssl15:25   0:00 ./redis-server 192.168.2.1:6379
  

  
配置文件可以修改为如下方式
  
daemonize yes #守护进程模式
  
save 60 1000 #当时间间隔超过60秒,或存储超过1000条记录时,进行持久化。
  
maxmemory 1024mb #分配1024MB内存
  
切记,一定要设定maxmemmory,且配置大小要小于物理内存,留有足够的内存供系统使用。
  

  

  
可以来测试性能
  
# ./redis-benchmark -h 192.168.2.1
  

  
通过 -q 参数让结果只显示每秒执行的请求数。
  
# ./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


页: [1]
查看完整版本: 安装redis-devops