在Windows上部署MongoDB分片集群,你需要准备三种角色的服务器:配置服务器(Config Server)、分片(Shard)服务器和路由(Mongos)服务器。以下是部署的基本步骤和示例配置:
- 安装MongoDB并确保版本支持分片。
 - 配置配置服务器,在
mongod.cfg中设置configsvr标记。 - 配置分片服务器,在
mongod.cfg中设置shardsvr和不同的端口。 - 启动配置服务器和分片服务器。
 - 使用
mongos启动路由服务,并添加配置服务器。 - 设置分片,通过
mongos执行sh.addShard()。 
以下是示例配置和启动命令:
配置服务器配置(config-svr.cfg):
systemLog:
  destination: file
  logAppend: true
storage:
  dbPath: C:\data\configdb
net:
  port: 27019
  bindIp: localhost
processManagement:
  fork: true
replication:
  replSetName: configrs
sharding:
  clusterRole: configsvr分片服务器配置(shard-svr1.cfg):
systemLog:
  destination: file
  logAppend: true
storage:
  dbPath: C:\data\sharddb
net:
  port: 27018
  bindIp: localhost
processManagement:
  fork: true
replication:
  replSetName: shardrs
sharding:
  autoSplit: true
  clusterRole: shardsvr启动配置服务器:
mongod --config config-svr.cfg启动分片服务器:
mongod --config shard-svr1.cfg启动路由服务(Mongos):
mongos --configdb localhost:27019 --port 27017在Mongos中添加分片:
sh.addShard("localhost:27018")确保你的防火墙和安全组设置允许相应端口的通信。这只是一个基础示例,根据你的实际网络环境和安全需求,你可能需要进行相应的调整。