Ubuntu搭建Redis 集群
1.源码编译
查看需要下载版本:http://download.redis.io/releases/
本人保存路径:/usr/local/soft/
wget http://download.redis.io/releases/redis-4.0.12.tar.gz
tar xzf redis-4.0.12.tar.gz
cd redis-4.0.12
make
备注:不安装到指定位置,那么程序默认放在redis-4.0.12/src文件夹下:比较重要的redis-cli、redis-server命令
2.在redis-4.0.12目录下创建集群文件及文件夹(目录不是必须的,可以是任意目录)
mkdir cluster-test
cd cluster-test
mkdir 7000 7001 7002 7003 7004 7005
将src下面的redis-server复制到7000 7001 7002 7003 7004 7005,并创建redis配置文件 redis.conf ,内容如下:
port 7000 #改成对应的端口
deamonize yes #后台启动
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
分别启动6台reids:
cd 7000
./redis-server redis.conf
查看运行结果:
ps -ef|grep redis
3.安装ruby环境及ruby-redis插件
安装ruby
apt-get install ruby
进入redis-4.0.12/src文件夹下,通过gem安装redis
gem install redis
4.启动redis集群
在 redis-4.0.12/src 目录下 redis-trib.rb ,使用以下命令执行:
./redis-trib.rb create --replicas 1 127.0.0.1:7000 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
期间提示输入yes,完成启动。
再查看redis进程:
5.测试集群
通过集群模式连接其中一个节点:
./redis-cli -c -p 7002
set test 11111
quit
退出后连接另一个节点:
./redis-cli -c -p 7001
get test
查询成功,集群创建成功。
下面关于Redis的文章您也可能喜欢,不妨参考下:
CentOS 7下Redis5安装部署与开机自启动 https://www.linuxidc.com/Linux/2019-06/159178.htm
Redis集群以及自动故障转移测试 https://www.linuxidc.com/Linux/2019-01/156599.htm
CentOS 7下Redis的安装与配置 https://www.linuxidc.com/Linux/2017-02/140363.htm
Ubuntu 16.04环境中安装PHP7.0 Redis扩展 https://www.linuxidc.com/Linux/2016-09/135631.htm
Redis 单机&集群离线安装部署 https://www.linuxidc.com/Linux/2017-03/141403.htm
CentOS 7.0 安装Redis 3.2.1详细过程和使用常见问题 https://www.linuxidc.com/Linux/2016-09/135071.htm
Ubuntu 16.04环境中安装PHP7.0 Redis扩展 https://www.linuxidc.com/Linux/2016-09/135631.htm
Redis实战 中文PDF http://www.linuxidc.com/Linux/2016-04/129932.htm
- ubuntu/centos 搭建 搭建 redis 集群
- ubuntu/centos 搭建 搭建 redis 集群
- [李景山php] ubuntu/centos 搭建 搭建 redis 集群
- redis 集群搭建 Ubuntu
- Ubuntu下搭建Redis集群
- 在Linux上(我的服务器是Ubuntu) 用redis-trib.rb搭建redis集群,并在客户端使用spring-data-redis连接(亲测)
- ubuntu/centos 搭建 搭建 redis 集群
- 基于Ubuntu18.04的Redis安装,并搭建伪集群
- 基于ubuntu搭建Redis(4.0) Cluster 高可用(HA)集群环境
- ubuntu下搭建redis集群
- ubuntu虚拟机搭建docker内的redis集群
- ubuntu/centos 搭建 搭建 redis 集群
- 使用redis-trib.rb搭建Redis集群(Ubuntu 16.04)
- Linux(ubuntu)安装redis集群,redis集群搭建
- ubuntu/centos 搭建 搭建 redis 集群
- ubuntu/centos 搭建 搭建 redis 集群
- ubuntu/centos 搭建 搭建 redis 集群
- ubuntu/centos 搭建 搭建 redis 集群
- Ubuntu14.04下Hadoop2.2.0集群搭建
- Centos6.4搭建Redis集群遇到的几个问题汇总