一、安裝redis並配置主從
1.安裝redis
# tar zxvf redis-3.0.3.tar.gz
# cd redis-3.0.3
# make PREFIX=/data/install/redis install
2.查看安裝後目錄/文件
# ls -R /data/install/redis/
/data/install/redis/:
bin
/data/install/redis/bin:
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server
3.默認沒有配置文件,創建目錄,倒入配置
mkdir /data/install/redis/conf
mkdir /data/install/redis/data
mkdir /data/log/redis/
cp/data/redis/redis-3.0.3/redis.conf /data/install/redis/conf/ (源路徑看實際情況)
=====redis.conf==模板====(直接拷貝就好了,注意標紅)
daemonize yes
pidfile"/data/install/redis/redis.pid"
port 6379
tcp-backlog511
timeout0
tcp-keepalive0
loglevelnotice
logfile " /data/log/redis/redis.log"
databases16
save 9001
save 30010
save 6010000
stop-writes-on-bgsave-erroryes
rdbcompressionyes
rdbchecksumyes
dbfilenamedump.rdb
dir"/data/install/redis/data"
slave-serve-stale-datayes
slave-read-onlyyes
maxmemory 128M
masterauth "test123"
requirepass "test123"
repl-diskless-syncno
repl-diskless-sync-delay5
repl-disable-tcp-nodelayno
slave-priority100
appendonlyno
appendfilename"appendonly.aof"
appendfsynceverysec
no-appendfsync-on-rewriteno
auto-aof-rewrite-percentage100
auto-aof-rewrite-min-size64mb
aof-load-truncatedyes
lua-time-limit5000
slowlog-log-slower-than10000
slowlog-max-len128
latency-monitor-threshold0
notify-keyspace-events""
hash-max-ziplist-entries512
hash-max-ziplist-value64
list-max-ziplist-entries512
list-max-ziplist-value64
set-max-intset-entries512
zset-max-ziplist-entries128
zset-max-ziplist-value64
hll-sparse-max-bytes3000
activerehashingyes
client-output-buffer-limitnormal 0 0 0
client-output-buffer-limitslave 256mb 64mb 60
client-output-buffer-limitpubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsyncyes
===========End===========