简体   繁体   English

MongoDB - 无法识别的选项:clusterRole

[英]MongoDB - Unrecognized Option: clusterRole

I am new to mongodb, this is my second day learning mongodb and trying to setup a sharded cluster.What I did is created virtual boxes of Ubuntu 18.04.1 LTS and installed mongodb version 4.2.8. I am new to mongodb, this is my second day learning mongodb and trying to setup a sharded cluster.What I did is created virtual boxes of Ubuntu 18.04.1 LTS and installed mongodb version 4.2.8. after installing MongoDB on all of my VMs, I updated the mongod.conf file as follows (to configure Config Servers Replica Set, I connected to one of my VMs. I will be implementing 3 replica sets of Config servers)在我所有的虚拟机上安装 MongoDB 后,我更新了 mongod.conf 文件如下(为了配置配置服务器副本集,我连接到我的一个虚拟机。我将实现 3 个配置服务器副本集)

net:
port: 27019
bindIP: 0.0.0.0,192.168.1.22,127.0.0.1

replication:
replSetName: rs01

sharding: 
clusterRole: configsvr

after that, I restarted mongodb service using this command之后,我使用此命令重新启动了 mongodb 服务

sudo systemctl restart mongod

and when I try to connect to mongo shell or run this command当我尝试连接到 mongo shell 或运行此命令时

mongod --config /etc/mongod.conf

I get this error "Unrecognized Option: clusterRole".我收到此错误“无法识别的选项:clusterRole”。 I am following official mongodb documentation on this link https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/我在此链接上关注官方 mongodb 文档https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/

Any help would be greatly appreciated.任何帮助将不胜感激。

You are missing indentation in the yaml file.您在 yaml 文件中缺少缩进。 Suboptions need to be indented:子选项需要缩进:

net:
    port: 27019
    bindIP: 0.0.0.0,192.168.1.22,127.0.0.1

replication:
    replSetName: rs01

sharding: 
    clusterRole: configsvr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM