Anj*_*ala 5 database mongoose mongodb replicaset
所以,我正在关注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}]}
| 归档时间: | 
 | 
| 查看次数: | 1723 次 | 
| 最近记录: |