gpt4 book ai didi

mongodb - errmsg 错误数字 "\"解析端口 30000 代码 93

转载 作者:IT老高 更新时间:2023-10-28 13:31:18 26 4
gpt4 key购买 nike

所以,我正在学习 Pluralsight 上的 MongoDB 教程,并且能够在同一台机器上创建 a、b 和 c 数据库。在成功创建所有三个之后,我在端口 30000 上运行 mongo,这是我的主数据库的端口。

>mongo --port 30000

它显示连接到端口,然后我输入

db.getMongo()

它与地址建立了连接

我输入了一个 javascript 对象,就像 Pluralsight 上的那个人所做的那样

>var democonfig={ _id: "demo", members: [{ _id: 0, host: 'localhost: 30000', priority: 10}, { _id: 1, host: 'localhost: 40000'}, { _id: 2, host: 'localhost: 50000', arbiterOnly: true}] };

按下回车后,我尝试使用文件 democonfig 运行 rs.initiate

rs.initiate(democonfig)

这是我得到的错误:

{ "ok" : 0, "errmsg" : "Bad digit \" \" while parsing 30000", "code" : 93 }

这就是我的replicaSet bat 文件的样子。

cd \Pluralsight\

md \Pluralsight\db1
md \Pluralsight\db2
md \Pluralsight\db3

@REM Primary
start "a" c:\MongoDB\bin\mongod.exe --dbpath ./db1 --port 30000 --replSet "demo"

@REM Secondary
start "b" c:\MongoDB\bin\mongod.exe --dbpath ./db2 --port 40000 --replSet "demo"

@REM Arbiter
start "c" c:\MongoDB\bin\mongod.exe --dbpath ./db3 --port 50000 --replSet "demo"

最佳答案

我在 Pluralsight 的“MongoDb 简介”教程中遇到了同样的问题。以下是我在“配置副本集”部分中使用的内容:

{
"_id": "demo",
"members": [
{
"_id": 0,
"host": "localhost:30000",
"priority": 10
},
{
"_id": 1,
"host": "localhost:40000"
},
{
"_id": 2,
"host": "localhost:50000",
"arbiterOnly": true
}
]
}

关于mongodb - errmsg 错误数字 "\"解析端口 30000 代码 93,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32636451/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com