【搭建环境】windows环境redis\集群;rabbitmq
windows环境下
一 redis 单机模式
解压redis,调整 redis.windows.conf
bind 0.0.0.0
protected-mode no
port 6379
cluster-enabled no
bind 0.0.0.0 表示允许任何ip访问
保护模式关掉避免访问不通
端口默认6379
集群模式no
可做个start.bat启动脚本,再快捷方式到桌面,方便启动。cmd启动redis也是在根目录执行这句:
redis-server redis.windows.conf
二 redis集群(redis5)
下载地址
Releases · microsoftarchive/redis · GitHub --这是redis3的,这里搭集群不用这个
Releases · tporadowski/redis · GitHub --这是redis5的,用这个
1 解压redis,调整 redis.windows.conf
bind 0.0.0.0
protected-mode no
port 6374
cluster-enabled yes
cluster-config-file nodes-6374.conf
cluster-node-timeout 15000
# cluster-replica-validity-factor 10
# cluster-migration-barrier 1
# cluster-require-full-coverage yes
# cluster-replica-no-failover no
tcp-backlog 511
timeout 0
tcp-keepalive 300
loglevel notice
logfile ""
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
# cluster-announce-ip 10.1.1.5
# cluster-announce-port 6379
# cluster-announce-bus-port 6380
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
主要是cluster打开,设置 node-xxx.conf文件
启动时可能报下面的配置错误,报啥注释啥
2 复制5份,共6份,每个修改端口和 node-xxx.conf 的 xxx
3 逐个启动。也可以放成下述结构,用脚本启动
.每个里面都放上启动脚本,端口修改成对应的
startC.bat
title redis-6379
redis-server.exe redis.windows.conf
上级放一个
startCluster.bat
@echo off
setlocal
rem 获取脚本所在的目录作为父目录
set "parent_directory=%~dp0"
rem 遍历父目录下的每个子目录
for /d %%D in ("%parent_directory%*") do (
rem 检查子目录是否包含 start.bat 文件
if exist "%%~D\startC.bat" (
rem 进入子目录并运行 start.bat
pushd "%%~D"
start startC.bat
popd
)
)
endlocal
就可以点击上级这个一次启动6个了
4 随便找其中一个redis根目录,打开cmd,执行
.\redis-cli.exe --cluster create 127.0.0.1:6379 127.0.0.1:6378 127.0.0.1:6377 127.0.0.1:6376 127.0.0.1:6375 127.0.0.1:6374 --cluster-replicas 1
还需要输个yes
三 windows rabbitmq
1 下载
环境erl
https://github.com/erlang/otp/releases/download/OTP-27.3/otp_win64_27.3.exe
rabbitmq
Installing on Windows | RabbitMQ
2 安装
3 到rabbitmq的 根目录/sbin ,打开cmd,执行
.\rabbitmq-plugins.bat enable rabbitmq_management
rabbitmq-server.bat 启动
访问
http://localhost:15672/
打不开,看
window安装RabbitMQ教程_windows安装rabbitmq-CSDN博客