释放双眼,带上耳机,听听看~!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 1#!/bin/bash
2# create by lihuibin
3# date 2014-04-15
4# desc install redis
5basedir=`pwd`
6homepath=/usr/local/redis
7[ -d $homepath ] && {
8echo "redis already installed "
9exit
10} || {
11 echo "begin init redis dir"
12 for i in bin etc data log ;do
13 mkdir -pv $homepath/$i
14 done
15}
16[ -f redis-2.8.8.tar.gz ] || {
17echo "begin to download redis package"
18wget http://download.redis.io/releases/redis-2.8.8.tar.gz
19echo " download redis package completed"
20}
21echo "begin to make source code"
22tar xzf redis-2.8.8.tar.gz
23cd redis-2.8.8
24make
25echo "make source code completed"
26cd src
27cp -r redis-benchmark redis-check-aof redis-check-dump redis-sentinel redis-cli redis-server $homepath/bin
28[ -f $basedir/redis.conf ] && {
29 echo "start redis-server"
30 for conf in redis.conf redis_salve.conf ;do
31 cp $basedir/$conf $homepath/etc/
32 $homepath/bin/redis-server $homepath/etc/$conf
33 done
34} || {
35 echo "not found $basedir/redis.conf"
36}
37
主:6379
从:6380
主:redis.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 1daemonize yes
2pidfile /var/run/redis.pid
3port 6379
4tcp-backlog 511
5timeout 0
6tcp-keepalive 0
7loglevel notice
8logfile "/usr/local/redis/log/redis.log"
9databases 16
10save 900 1
11save 300 10
12save 60 10000
13stop-writes-on-bgsave-error yes
14rdbcompression yes
15rdbchecksum yes
16dbfilename dump.rdb
17dir /usr/local/redis/data
18slave-serve-stale-data yes
19slave-read-only no
20repl-disable-tcp-nodelay no
21slave-priority 100
22appendonly no
23appendfilename "appendonly.aof"
24appendfsync everysec
25no-appendfsync-on-rewrite no
26auto-aof-rewrite-percentage 100
27auto-aof-rewrite-min-size 64mb
28lua-time-limit 5000
29slowlog-log-slower-than 10000
30slowlog-max-len 128
31notify-keyspace-events ""
32hash-max-ziplist-entries 512
33hash-max-ziplist-value 64
34list-max-ziplist-entries 512
35list-max-ziplist-value 64
36set-max-intset-entries 512
37zset-max-ziplist-entries 128
38zset-max-ziplist-value 64
39activerehashing yes
40client-output-buffer-limit normal 0 0 0
41client-output-buffer-limit slave 256mb 64mb 60
42client-output-buffer-limit pubsub 32mb 8mb 60
43hz 10
44aof-rewrite-incremental-fsync yes
45
从:redis_salve.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 1daemonize yes
2pidfile /var/run/redis_salve.pid
3port 6380
4tcp-backlog 511
5timeout 0
6tcp-keepalive 0
7loglevel notice
8logfile "/usr/local/redis/log/redis_slave.log"
9databases 16
10save 900 1
11save 300 10
12save 60 10000
13stop-writes-on-bgsave-error yes
14rdbcompression yes
15rdbchecksum yes
16dbfilename dump_salve.rdb
17dir /usr/local/redis/data
18slave-serve-stale-data yes
19slave-read-only no
20repl-disable-tcp-nodelay no
21slave-priority 100
22appendonly no
23appendfilename "appendonly.aof"
24appendfsync everysec
25no-appendfsync-on-rewrite no
26auto-aof-rewrite-percentage 100
27auto-aof-rewrite-min-size 64mb
28lua-time-limit 5000
29slowlog-log-slower-than 10000
30slowlog-max-len 128
31notify-keyspace-events ""
32hash-max-ziplist-entries 512
33hash-max-ziplist-value 64
34list-max-ziplist-entries 512
35list-max-ziplist-value 64
36set-max-intset-entries 512
37zset-max-ziplist-entries 128
38zset-max-ziplist-value 64
39activerehashing yes
40client-output-buffer-limit normal 0 0 0
41client-output-buffer-limit slave 256mb 64mb 60
42client-output-buffer-limit pubsub 32mb 8mb 60
43hz 10
44aof-rewrite-incremental-fsync yes
45SLAVEOF 127.0.0.1 6379
46