Skip to content

在 OSX 上安装 Redis 2.8.13

Published: at 00:00
说明
只做内存服务器
mem_allocator 用的是 libc
不要用于生产环境
下载
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar zxvf redis-2.8.13.tar.gz
cd redis-2.8.13
安装
sudo make PREFIX=/opt/redis install
配置
sudo mkdir -p /opt/redis/etc
sudo cp ./redis.conf /opt/redis/etc/

sudo vim /opt/redis/etc/redis.conf

daemonize yes
pidfile /var/run/redis.pid
port 10000
tcp-backlog 511
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/var/log/redis.log"
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 /data/redis/

slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100

requirepass 123123

maxclients 10000
maxmemory 2G
maxmemory-policy volatile-lru
maxmemory-samples 3

appendonly no
appendfilename "appendonly.aof"
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

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-entries 512
list-max-ziplist-value 64
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
创建软链接
sudo ln -s /opt/redis/bin/redis-server /usr/bin/redis-server
sudo ln -s /opt/redis/bin/redis-cli /usr/bin/redis-cli
启动
sudo /opt/redis/bin/redis-server /opt/redis/etc/redis.conf
停止
redis-cli -h 127.0.0.1 -p 10000 -a 123123 shutdown