window10 redis集群安装

下载资源

  • Redis-x64-3.2.100.zip

  • rubyinstaller-2.3.3-x64.exe

  • redis-3.3.3.gem

  • redis-trib.rb

    资源下载地址

步骤

安装redis

  • 解压Redis-x64-3.2.100.zip,复制六份(建议放在同一文件夹下),并重命名文件夹为7000、7001、7002、7003、7004、7005
  • 分别进入相应的文件夹修改文件redis.windows.conf
port 7000   
bind 0.0.0.0  
loglevel notice    
logfile "F:/redis/log/redis7000_log.txt"       
appendonly yes
appendfilename appendonly.7000.aof
cluster-enabled yes                                    
cluster-config-file nodes.7000.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes
#requirepass 123456
  • 创建redis服务的脚本 service-install.bat
@echo off
F:
cd redis
for %%i in (0 1 2 3 4 5) do (
if %%i == 0 (
cd 700%%i
start redis-server.exe --service-install redis.windows.conf --service-name  redis700%%i
) else (
cd ../700%%i
start redis-server.exe --service-install redis.windows.conf --service-name  redis700%%i
)
)

执行后
window10 redis集群安装_第1张图片

  • 创建启动redis服务的脚本 redis-start.bat,并执行
@echo off
F:
cd redis
for %%i in (0 1 2 3 4 5) do (
if %%i == 0 (
cd 700%%i
start redis-server.exe --service-start --service-name redis700%%i
) else (
cd ../700%%i
start redis-server.exe --service-start --service-name redis700%%i
)
)
  • 创建停止redis服务的脚本 redis-stop.bat
@echo off
F:
cd redis
for %%i in (0 1 2 3 4 5) do (
if %%i == 0 (
cd 700%%i
start redis-server.exe --service-stop --service-name redis700%%i
) else (
cd ../700%%i
start redis-server.exe --service-stop --service-name redis700%%i
)
)
  • 项目结构
    window10 redis集群安装_第2张图片

构建集群

  • 双击rubyinstaller-2.3.3-x64.exe
    window10 redis集群安装_第3张图片
  • 运行命令:gem install --local F:\redis\redis-3.3.3.gem
  • .\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:7005window10 redis集群安装_第4张图片如果redis设置了密码修改redis-trib.rbwindow10 redis集群安装_第5张图片window10 redis集群安装_第6张图片

你可能感兴趣的:(redis集群)