mongodb - MongoDB分片
问题描述
我是 mongodb 的新手。我想创建一个具有单个副本集的 Shard Cluster,将来,如果我想扩展它会很容易。
现在,有 4 台 Ubuntu 机器,其中 1 台用作路由器(mongos),其余 3 台用作副本集(主要、次要、次要)。
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /mnt/md0/data/mongodb/dbdata/
journal:
enabled: true
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /mnt/md0/data/mongodb/logs/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
security:
keyFile: /opt/mongo/mongo-keyfile
#operationProfiling:
replication:
replSetName: rs0
sharding:
clusterRole: configsvr
## Enterprise-Only Options:
#auditLog:
#snmp:**strong text**
#mongos.conf
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongos.log
# network interfaces
net:
port: 27017
#bindIp: 127.0.0.1,192.10.10.10
security:
keyFile: /opt/mongo/mongo-keyfile
sharding:
configDB: rs0/Primary_Rs:27017,Secondary1_Rs:27017,Secondary2_Rs:27017
当我尝试在 mongos 控制台中添加 Shard 时,出现错误
请帮我解决这个问题。先感谢您
解决方案
看到你的 conf 文件中有 2 个分片部分......第一个将 clusterRole 配置为 configsvr => 删除/评论这个,然后重试
推荐阅读
- python - Kivy:如何将 x 轴刻度从数字更改为 kivy 花园图中的日期或时间值?
- javascript - 如何使用 PHP 向我的数据库提交多步骤表单
- python - .text 函数在 Python 中使用 selenium 库
- performance - 我的 C++ 应用程序在 docker 容器中运行速度较慢
- node.js - 无服务器框架函数中的上下文和 module.exports
- mysql - 如何从具有唯一列的表中获取行,由另一列指示
- python-3.x - 如何使用 keras 为每个新预测重新训练 LSTM?
- c++ - 如何调试boost归档异常输入流错误
- graphql - 为特定列表/数组索引更新 Apollo 本地缓存
- python - XGBoostError:参数 num_class 的值 0 应大于等于 1