linux下安装配置redis主从+哨兵

本文介绍了在Redhat 7.4环境下,如何配置和启动Redis的主从复制以及哨兵系统,包括 Sentinel 模式下的关键事件,如故障转移、主从切换等。在配置过程中,强调了关闭防火墙、设置复杂密码的重要性,并提到了通过shell脚本进行重启,以及结合keepalived高可用和Zabbix监控的建议。
摘要由CSDN通过智能技术生成

环境:

redhat 7.4、redis-5.0.5、2个节点(节点一:1主+1从+1哨兵,节点二:2从+1哨兵)

1、配置启动第一个节点(1主+1从)

[root@csy3 redis-5.0.5]# yum install gcc gcc-c++ -y
......
[root@csy3 tools]# pwd
/software/tools
[root@csy3 tools]# tar -zxvf redis-5.0.5.tar.gz
[root@csy3 tools]# ls
redis-5.0.5  redis-5.0.5.tar.gz
[root@csy3 tools]# cd redis-5.0.5/
[root@csy3 redis-5.0.5]# ls
00-RELEASENOTES  BUGS  CONTRIBUTING  COPYING  deps  INSTALL  Makefile  MANIFESTO  README.md  redis.conf  runtest  runtest-cluster  runtest-moduleapi  runtest-sentinel  sentinel.conf  src  tests  utils
[root@csy3 redis-5.0.5]# make
cd src && make all
make[1]: Entering directory `/software/tools/redis-5.0.5/src'
    CC Makefile.dep
make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
make[1]: Entering directory `/software/tools/redis-5.0.5/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
                               
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
make: *** [all] Error 2
[root@csy3 redis-5.0.5]# cat README.md  | grep -5 jemalloc  #针对上面的报错在README里面有说明
dependencies tree is modified in any other way, make sure to use the following
command in order to really clean everything and rebuild from scratch:

    make distclean

This will clean: jemalloc, lua, hiredis, linenoise.

Also if you force certain build options like 32bit target, no C compiler
optimizations (for debugging purposes), and other similar build time options,
those options are cached indefinitely until you issue a `make distclean`
command.
--
Allocator
---------

Selecting a non-default memory allocator when building Redis is done by setting
the `MALLOC` environment variable. Redis is compiled and linked against libc
malloc by default, with the exception of jemalloc being the default on Linux
systems. This default was picked because jemalloc has proven to have fewer
fragmentation problems than libc malloc.

To force compiling against libc malloc, use:

    % make MALLOC=libc

To compile against jemalloc on Mac OS X systems, use:

    % make MALLOC=jemalloc

Verbose build
-------------
......
[root@csy3 redis-5.0.5]# make MALLOC=libc   #如上说明,直接用README里面的
......
Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/software/tools/redis-5.0.5/src'
......
[root@csy3 redis-5.0.5]# cd src/
[root@csy3 src]# ll redis-*   #可以看到生成的redis-server这些直接用的命令
-rwxr-xr-x. 1 root root  354096 Aug 19 14:18 redis-benchmark
-rw-rw-r--. 1 root root   29605 May 16 00:07 redis-benchmark.c
-rw-r--r--. 1 root root  109136 Aug 19 14:18 redis-benchmark.o
-rwxr-xr-x. 1 root root 4046880 Aug 19 14:18 redis-check-aof
-rw-rw-r--. 1 root root    7175
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值