目录
前言
1. 先确定redis版本,5.0版本以前,Linux需要安装ruby命令,
通过运行redis-trib.rb搭建集群;
2. 5.0版本以后,redis可以通过运行redis-cli,搭建集群;
3.通过redis-trib.rb搭建集群需要6个节点;
4.通过redis-cli搭建集群最少3个(没验证),本文也是6个节点;
本文redis版本为:redis-5.0.12.tar.gz提取码pqd1
对前言1、2举例说明:登录linux服务器
[redis@redis src]$ ./redis-trib.rb create --replicas 1 10.36.0.50:6379 10.36.0.50:6380 10.36.0.50:6381 10.36.0.50:6382 10.36.0.50:6383 10.36.0.50:6384
WARNING: redis-trib.rb is not longer available!
You should use redis-cli instead.All commands and features belonging to redis-trib.rb have been moved
to redis-cli.
In order to use them you should call redis-cli with the --cluster
option followed by the subcommand name, arguments and options.Use the following syntax:
redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]Example:
redis-cli --cluster create 10.36.0.50:6379 10.36.0.50:6380 10.36.0.50:6381 10.36.0.50:6382 10.36.0.50:6383 10.36.0.50:6384 --cluster-replicas 1To get help about all subcommands, type:
redis-cli --cluster help
系统会提示你应该用redis-cli