当前位置: 首页 > wzjs >正文

专业做视频的网站怎么创建一个自己的网站

专业做视频的网站,怎么创建一个自己的网站,建材做哪些网站好,交网站建设域名计入什么科目🧱 Windows 系统搭建 Redis 原生集群详细图文指南 适用于:Redis 单机多实例集群部署(伪分布式集群) 📁 一、目录结构规划 我们将使用以下路径来组织 Redis 集群: C:\software\redis # Redis 安…

🧱 Windows 系统搭建 Redis 原生集群详细图文指南

适用于:Redis 单机多实例集群部署(伪分布式集群)


📁 一、目录结构规划

我们将使用以下路径来组织 Redis 集群:

C:\software\redis            # Redis 安装目录
C:\RedisCluster               # 集群主目录
C:\RedisCluster\6380          # 实例1配置目录(端口6380)
C:\RedisCluster\6381          # 实例2配置目录(端口6381)
...
C:\RedisCluster\6385          # 实例6配置目录(端口6385)

🔧 二、环境准备

1. 下载并解压 Redis

前往官方归档地址下载 Redis for Windows:

🔗 https://github.com/microsoftarchive/redis/releases

推荐下载版本:

  • Redis-x64-3.2.100.zip(稳定性最好)
  • Redis-x64-5.0.14.1.zip(功能更全)

将下载的压缩包解压至:

C:\software\redis

确保包含以下关键文件:

  • redis-server.exe
  • redis-cli.exe

🧰 三、创建六个 Redis 实例(端口从 6380 到 6385)

打开 PowerShell(任意身份),依次执行以下步骤:

创建主目录

mkdir C:\RedisCluster

实例 1: 端口 6380

mkdir C:\RedisCluster\6380
$conf = @"
port 6380
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6380.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6380\redis-6380.conf" -Value $conf

实例 2: 端口 6381

mkdir C:\RedisCluster\6381
$conf = @"
port 6381
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6381.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6381\redis-6381.conf" -Value $conf

实例 3: 端口 6382

mkdir C:\RedisCluster\6382
$conf = @"
port 6382
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6382.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6382\redis-6382.conf" -Value $conf

实例 4: 端口 6383

mkdir C:\RedisCluster\6383
$conf = @"
port 6383
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6383.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6383\redis-6383.conf" -Value $conf

实例 5: 端口 6384

mkdir C:\RedisCluster\6384
$conf = @"
port 6384
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6384.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6384\redis-6384.conf" -Value $conf

实例 6: 端口 6385

mkdir C:\RedisCluster\6385
$conf = @"
port 6385
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6385.conf
cluster-node-timeout 5000
appendonly yes
requirepass 123456
masterauth 123456
"@
Set-Content -Path "C:\RedisCluster\6385\redis-6385.conf" -Value $conf

▶️ 四、启动所有 Redis 实例

在 PowerShell 中依次运行以下命令:

启动实例 6380

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6380\redis-6380.conf'"

启动实例 6381

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6381\redis-6381.conf'"

启动实例 6382

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6382\redis-6382.conf'"

启动实例 6383

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6383\redis-6383.conf'"

启动实例 6384

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6384\redis-6384.conf'"

启动实例 6385

cd "C:\software\redis"
Start-Process powershell.exe "-NoExit", "& '$PWD\redis-server.exe' 'C:\RedisCluster\6385\redis-6385.conf'"

🌐 五、创建 Redis 集群

等待上面所有实例成功运行后,在一个新的 PowerShell 窗口中执行下面命令来创建集群:

cd "C:\software\redis"
.\redis-cli.exe --cluster create 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 --cluster-replicas 1 -a 123456 --cluster-yes

🔍 六、验证 Redis 集群状态

继续在同一窗口中执行:

$commands = @"
cluster info
cluster nodes
exit
"@echo $commands | .\redis-cli.exe -c -p 6380 -a 123456

输出示例:

cluster_state:ok
cluster_slots_assigned:16384
cluster_known_nodes:6
...

表示集群已经正确生成!


📜 七、附录:完整 .ps1 脚本一键部署(带路径检测)

你可以将此脚本保存为 setup-redis-cluster.ps1 并运行:

# 设置变量
$redisPath = "C:\software\redis"
$clusterDir = "C:\RedisCluster"
$instances = @(6380, 6381, 6382, 6383, 6384, 6385)
$password = "123456"# 检查 Redis 是否安装正确
if (-Not (Test-Path "$redisPath")) {Write-Host "❌ 错误:未找到 Redis 安装目录,请检查路径是否为:$redisPath" -ForegroundColor Redexit
}if (-Not (Test-Path "$redisPath\redis-server.exe") -or -Not (Test-Path "$redisPath\redis-cli.exe")) {Write-Host "❌ 错误:未找到 redis-server.exe 或 redis-cli.exe,请确认是否已正确解压 Redis 到该目录。" -ForegroundColor Redexit
}# 创建主目录
New-Item -ItemType Directory -Force -Path $clusterDir | Out-Null# 创建每个实例的目录和配置文件
foreach ($port in $instances) {$dir = "$clusterDir\$port"New-Item -ItemType Directory -Force -Path $dir | Out-Null$confFile = "$dir\redis-$port.conf"$content = @"
port $port
bind 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-$port.conf
cluster-node-timeout 5000
appendonly yes
requirepass $password
masterauth $password
"@Set-Content -Path $confFile -Value $contentWrite-Host "✅ 已创建配置文件:$confFile"
}# 启动实例
foreach ($port in $instances) {$confFile = "$clusterDir\$port\redis-$port.conf"Start-Process powershell.exe "-NoExit", "& '$redisPath\redis-server.exe' '$confFile'"Write-Host "🔌 已启动 Redis 实例,端口:$port"
}# 等待启动完成
Write-Host "`n⏳ 正在等待 Redis 实例启动完成(10秒)..." -ForegroundColor Yellow
Start-Sleep -Seconds 10# 创建集群
Write-Host "`n🧱 正在创建 Redis 集群..." -ForegroundColor Green
$nodes = $instances | ForEach-Object { "127.0.0.1:$_" }
& "$redisPath\redis-cli.exe" --cluster create @nodes --cluster-replicas 1 -a $password --cluster-yes# 验证集群
Write-Host "`n🔍 正在验证 Redis 集群状态..." -ForegroundColor Green
$commands = @"
cluster info
cluster nodes
exit
"@echo $commands | & "$redisPath\redis-cli.exe" -c -p 6380 -a $password# 结束提示
Write-Host "`n🎉 Redis 集群搭建完成!" -ForegroundColor Green
Write-Host "你可以通过 redis-cli 连接测试,例如:" -ForegroundColor Cyan
Write-Host "   cd C:\software\redis" -ForegroundColor Cyan
Write-Host "   redis-cli.exe -c -p 6380 -a 123456" -ForegroundColor Cyan

✅ 总结

步骤内容
1Redis 安装路径为:C:\software\redis
2六个配置文件分别创建,不省略任何重复步骤
3每个实例单独启动一个窗口
4使用 redis-cli 创建集群
5验证 cluster infocluster nodes
6提供完整 .ps1 脚本,支持一键运行
http://www.dtcms.com/wzjs/404694.html

相关文章:

  • 专业手机建站公司windows优化大师和鲁大师
  • 网站建设公司的发展前景seo排名公司
  • 福鼎网站建设培训设计师经常用的网站
  • 佛山网站优化流程搜索引擎网站排名优化方案
  • 南城仿做网站网站生成app
  • 免费建站网站号经典seo伪原创
  • 西安网站开发有哪些公司推广方案怎么写模板
  • 十大免费货源网站百度官网登录入口手机版
  • 源码出售网站百度最新收录方法
  • 物流的网站模板百度全网营销
  • 给网站做蜘蛛抓取济南seo排名优化推广
  • 网站建设有那些内容做网络销售感觉自己是骗子
  • 营销型外贸网站如何做网络推广运营
  • 网站制作经费预算推广渠道有哪些平台
  • 官网建站平台seo渠道是什么意思
  • 正规公司代办西安seo王
  • 做网站包括备案吗新东方
  • php网站管理系统下载南通百度网站快速优化
  • 南昌企业制作网站设计黑帽seo
  • 网站美工设计收费吉林seo外包
  • 想做一个网站平台怎么做十大免费网站推广
  • 武汉 光谷 网站建设佛山全市核酸检测
  • 北京门头沟住房和城乡建设委员会网站360官方网站网址
  • 柏乡企业做网站国外域名注册平台
  • 用万网建设网站教程视频企业网络推广方式
  • 即给做网站又给我们做推广的公司呢南昌seo技术外包
  • 网站开发 维护岗位职责贵州网站seo
  • php网站开发实训指导书河北seo平台
  • wordpress客户端连接不上seo关键词如何布局
  • 漳州手机网站建设营销软文写作