MongoDB 5.0.9 分片配置

Deploy Sharded Cluster using Ranged Sharding — MongoDB Manual

组件

mongos  负责router
config 负责配置(必须副本集)
mongod 负责存储(必须副本集)

Lua

Config 配置

processManagement:
   fork: true
net:
   bindIp: localhost
   port: [**自定义端口**]
storage:
   dbPath: /Volumes/SAO/data/mongo-sharding/db/c
systemLog:
   destination: file
   path: "/Volumes/SAO/data/mongo-sharding/logs/mongoc.log"
   logAppend: true
storage:
   journal:
      enabled: true
replication:
   oplogSizeMB: 1024
   replSetName: rs2
sharding:
  clusterRole: configsvr

YAML

mongod 配置

processManagement:
   fork: true
net:
   bindIp: localhost
   port: [**自定义端口**]
storage:
   dbPath: /Volumes/SAO/data/mongo-sharding/db/s1
systemLog:
   destination: file
   path: "/Volumes/SAO/data/mongo-sharding/logs/mongod1.log"
   logAppend: true
storage:
   journal:
      enabled: true
sharding:
  clusterRole: shardsvr
replication:
  replSetName: sh1
operationProfiling:
   mode: slowOp
   slowOpThresholdMs: 500

YAML

mongos 配置

processManagement:
   fork: true
net:
   bindIp: localhost
   port: 27018
systemLog:
   destination: file
   path: "/Volumes/SAO/data/mongo-sharding/logs/mongos.log"
   logAppend: true
sharding:
   configDB: rs2/127.0.0.1:27021,127.0.0.1:27022,127.0.0.1:27023

YAML

#步骤

初始化mongod副本集

添加sharding

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值