Redis本地集群部署

Linux版本:
cat /proc/version
Linux version 3.10.0-862.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018

CentOS版本:
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

Redis版本:redis-6.0.12.tar.gz

编译安装Redis:
make && make install

报错:
cd src && make all
make[1]: 进入目录“/usr/local/redis/7001/redis-6.0.12/src”
CC Makefile.dep
make[1]: 离开目录“/usr/local/redis/7001/redis-6.0.12/src”
make[1]: 进入目录“/usr/local/redis/7001/redis-6.0.12/src”
CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 错误 127
make[1]: 离开目录“/usr/local/redis/7001/redis-6.0.12/src”
make: *** [all] 错误 2

解决方式:
yum install gcc-c++

再次编译安装,报错:
cd src && make all
make[1]: 进入目录“/usr/local/redis/7001/redis-6.0.12/src”
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录

include

                           ^

编译中断。
make[1]: *** [adlist.o] 错误 1
make[1]: 离开目录“/usr/local/redis/7001/redis-6.0.12/src”
make: *** [all] 错误 2

解决方式:使用libc编译
make MALLOC=libc && make install

再次报错:gcc版本过低
make[1]: *** [server.o] 错误 1
make[1]: 离开目录“/usr/local/redis/7001/redis-6.0.12/src”
make: *** [all] 错误 2

解决方式:升级gcc
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
gcc -v
成功编译与安装

目录结构:


image.png

conf:


image.png

批量启动脚本:


image.png

创建集群命令:
redis-cli -a 123456 --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006 --cluster-replicas 1

集群创建成功:


image.png

底下的博客可以不用看了
官方文档:http://www.redis.cn/topics/cluster-tutorial.html

参考博客:
https://blog.csdn.net/weixin_40836179/article/details/108245436
https://blog.csdn.net/honchou56/article/details/53994708
https://blog.csdn.net/miss1181248983/article/details/90056960
https://blog.csdn.net/weixin_54617991/article/details/114445186

你可能感兴趣的:(Redis本地集群部署)