#bind 192.168.206.5 (绑定当前机器ip)66# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES67# JUST COMMENT THE FOLLOWING LINE.68# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~69bind127.0.0.1 192.168.206.5
7071# Protected mode is a layer of security protection, in order to avoid that72# Redis instances left open on the internet are accessed and exploited.
#port 700191# If port 0 is specified Redis will not listen on a TCP socket.92 port 700193
#daemonize yes203# By default Redis does not run as a daemon. Use 'yes' if you need it.204# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.205 daemonize yes206207# If you run Redis from upstart or systemd, Redis can interact with your
#pidfile /var/run/redis_7001.pid225# Creating a pid file is best effort: if Redis is not able to create it226# nothing bad happens, the server will start and run normally.227 pidfile /var/run/redis_7001.pid
228229# Specify the server verbosity level.230# This can be one of:
#appendonly yes1036# Please check http://redis.io/topics/persistence for more information.10371038 appendonly yes10391040# The name of the append only file (default: "appendonly.aof")
#cluster-config-file nodes70011176# Make sure that instances running in the same system do not have1177# overlapping cluster configuration file names.1178#1179 cluster-config-file nodes-7001.conf
11801181# Cluster node timeout is the amount of milliseconds a node must be unreachable1182# for it to be considered in failure state.
#cluster-enabled yes(必须配置 启动集群模式)1168# started as cluster nodes can. In order to start a Redis instance as a1169# cluster node enable the cluster support uncommenting the following:1170#1171 cluster-enabled yes11721173# Every cluster node has a cluster configuration file. This file is not1174# intended to be edited by hand. It is created and updated by Redis nodes.
配置好redis01 实例之后复制出5个副本
cp redis01/* redis02
cp redis01/* redis03
cp redis01/* redis04
cp redis01/* redis05
cp redis01/* redis06
#分别用vi 或vim编辑各个实例的配置文件,此次修改仅仅需要关注7001的地方修改为对应端口vim redis02/redis.conf
vim redis03/redis.conf
vim redis04/redis.conf
vim redis05/redis.conf
vim redis06/redis.conf
#写操作会在主节点之间转发,不一定存在哪个节点上。#从节点的信息跟随的主节点存储的数据一致。192.168.206.5:7001>ping
PONG
192.168.206.5:7001>set k1 v1
-> Redirected to slot [12706] located at 127.0.0.1:7003
OK
127.0.0.1:7003>set k2 v2
-> Redirected to slot [449] located at 127.0.0.1:7001
OK
127.0.0.1:7001>set k3 ve
OK
127.0.0.1:7001>set k4 v4
-> Redirected to slot [8455] located at 127.0.0.1:7002
OK
127.0.0.1:7002>set k5 v5
-> Redirected to slot [12582] located at 127.0.0.1:7003
OK
127.0.0.1:7003>set k6 v6
-> Redirected to slot [325] located at 127.0.0.1:7001
OK
127.0.0.1:7001>set k7 v7
OK
127.0.0.1:7001>set k8 v8
-> Redirected to slot [8331] located at 127.0.0.1:7002
OK
127.0.0.1:7002>set k9 v9
-> Redirected to slot [12458] located at 127.0.0.1:7003