redis的shell安装脚本,实现在linux下本机主从架构

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
#!/bin/bash
# create by lihuibin
# date 2014-04-15
# desc install redis
basedir=` pwd `
homepath= /usr/local/redis
[ -d $homepath ] && {
echo  "redis already installed "
exit
} || {
         echo  "begin init redis dir"
         for  in  bin etc data log ; do
                 mkdir  -pv $homepath/$i
         done
}
[ -f redis-2.8.8. tar .gz ] || {
echo  "begin to download redis package"
wget http: //download .redis.io /releases/redis-2 .8.8. tar .gz
echo  " download redis package completed"
}
echo  "begin to make source code"
tar  xzf redis-2.8.8. tar .gz
cd  redis-2.8.8
make
echo  "make source code completed"
cd  src
cp  -r redis-benchmark redis-check-aof redis-check-dump redis-sentinel redis-cli redis-server $homepath /bin
[ -f $basedir /redis .conf ] && {
         echo  "start redis-server"
         for  conf  in  redis.conf redis_salve.conf ; do
         cp  $basedir/$conf $homepath /etc/
         $homepath /bin/redis-server  $homepath /etc/ $conf
         done
} || {
  echo  "not found $basedir/redis.conf"
}


主:6379

从:6380

wKioL1NYb6yheqOnAABtT6b2o3w954.jpg


wKioL1NYcL-xS9CIAADHnx_f7eo465.jpg


wKioL1NYcbWxVTwYAADlrek864Y197.jpg


wKiom1NYcd-i3S8EAACr4TySZME947.jpg


主: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
daemonize  yes
pidfile  /var/run/redis .pid
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile  "/usr/local/redis/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  /usr/local/redis/data
slave-serve-stale-data  yes
slave- read -only no
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename  "appendonly.aof"
appendfsync everysec
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
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
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


从: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
daemonize  yes
pidfile  /var/run/redis_salve .pid
port 6380
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile  "/usr/local/redis/log/redis_slave.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error  yes
rdbcompression  yes
rdbchecksum  yes
dbfilename dump_salve.rdb
dir  /usr/local/redis/data
slave-serve-stale-data  yes
slave- read -only no
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename  "appendonly.aof"
appendfsync everysec
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
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
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
SLAVEOF 127.0.0.1 6379


本文转自birdinroom 51CTO博客,原文链接:http://blog.51cto.com/birdinroom/1401493,如需转载请自行联系原作者
优秀的个人博客,低调大师

微信关注我们

原文链接:https://yq.aliyun.com/articles/473707

转载内容版权归作者及来源网站所有!

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

相关文章

发表评论

资源下载

更多资源
Oracle Database,又名Oracle RDBMS

Oracle Database,又名Oracle RDBMS

Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域一直处于领先地位的产品。可以说Oracle数据库系统是目前世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小、微机环境。它是一种高效率、可靠性好的、适应高吞吐量的数据库方案。

Eclipse(集成开发环境)

Eclipse(集成开发环境)

Eclipse 是一个开放源代码的、基于Java的可扩展开发平台。就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境。幸运的是,Eclipse 附带了一个标准的插件集,包括Java开发工具(Java Development Kit,JDK)。

Java Development Kit(Java开发工具)

Java Development Kit(Java开发工具)

JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。

Sublime Text 一个代码编辑器

Sublime Text 一个代码编辑器

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。