常用项解释
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
protected-mode no #保护模式
bind 192.168.246.202 #只监听内网IP
daemonize yes #开启后台模式将on改为yes
port 6379 #端口号
dir /data/application/redis/data #本地数据库存放持久化数据的目录该目录-----需要存在
创建存放数据的目录
开始
cd
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
tar xf redis-4.0.9.tar.gz
cd redis-4.0.9
make
原文:https://www.cnblogs.com/mafly/p/redis_cluster.htm
mkdir /usr/local/redis-cluster
cd /usr/local/redis-cluster
mkdir -p 6380/data 6381/data 6382/data 6383/data 6384/data 6385/data
mkdir redis-cluster/bin
cd /root/redis-4.0.9/src
cp mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server redis-trib.rb /usr/local/redis-cluster/bin
cp /root/redis-4.0.9/* /usr/local/redis-cluster/6380
修改参数
port 6380(每个节点的端口号)
daemonize yes
bind 127.0.0.1(绑定当前机器 IP)
dir /usr/local/redis-cluster/6380/data/(数据文件存放位置)
pidfile /var/run/redis_6380.pid(pid 6380和port要对应)
cluster-enabled yes(启动集群模式)
cluster-config-file nodes6380.conf(6380和port要对应)
cluster-node-timeout 15000
appendonly yes
\cp -rf /usr/local/redis-cluster/6380/* /usr/local/redis-cluster/6381
依次
%s/6380/6381 #修改其他端口的配置参数
/usr/local/redis-cluster/bin/redis-server /usr/local/redis-cluster/6385/redis.conf
依次
yum install ruby(安装完成后版本过低 请用升级脚本升级)
————————————————
升级脚本
————————————
ruby -v #查看当前版本
gem sources --remove http://rubygems.org/
gem sources -a http://mirrors.aliyun.com/rubygems/
gem sources -l
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
wget https://codeload.github.com/rvm/rvm/tar.gz/1.29.3
tar xf 1.29.3
cd rvm-1.29.3/
./install
source /etc/profile.d/rvm.sh
rvm list known
rvm install 2.7.1
ruby -v
——————————————————
yum install rubygems
gem install redis
/usr/local/redis-cluster/bin/redis-trib.rb create --replicas 1 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384 127.0.0.1:6385
yes
cluster info
cluster nodes