windows下MongoDB4.0的副本集搭建

复制三个MongoDB Server,一个为主节点Primary ,一个为辅节点Secondary,另一个为仲裁节点Arbiter

以无认证方式启动三个Server节点

server1> mongod --noauth --config mongod.cfg   
server2> mongod --noauth --config mongod.cfg
server3> mongod --noauth --config mongod.cfg

//server1 mongod.cfg
net: port: 27017 bindIp: 0.0.0.0
replication: oplogSizeMB: 200 replSetName: replset

//server2 mongod.cfg net: port: 27018 bindIp: 0.0.0.0
replication: oplogSizeMB: 200 replSetName: replset

//server3 mongod.cfg net: port: 27019 bindIp: 0.0.0.0
replication: oplogSizeMB: 200 replSetName: replset

连接server1

> mongo
> rs.initiate(); //初始化副本集设置
> rs.add('mg.imily.net:27018'); //添加server2
> rs.addArb('mg.imily.net:27019'); //添加server3
> cfg = rs.conf();
> cfg.members[0].priority = 100; //设置server1优先级
> cfg.members[1].priority = 50; //设置server2优先级
> rs.reconfig(cfg); //重新配置副本集信息

按照上一篇方式创建帐号密码后,接着需要创建节点之间的认证keyfile,用来在各节点之间的认证。

> openssl.exe rand 128 -base64 -out ./keyfile
//附下载: openssl.zip

//创建后复制到server1,server2,server3的bin目录中,并在三个mongod.cfg中添加 security: authorization: enabled keyFile: keyfile

最后添加server1,server2,server3作为系统服务,启动即可

显示更多

100 thoughts on “windows下MongoDB4.0的副本集搭建

  1. Pingback: ItWiseLink
  2. Pingback: สล็อต
  3. Pingback: canadian cialis
  4. Pingback: kevasw.webgarden.com
  5. Pingback: site128620615.fo.team
  6. Pingback: buy tadalafil
  7. Pingback: buy tadalafil pills
  8. Pingback: buy viagra now
  9. Pingback: northwestpharmacy
  10. Pingback: canadian drugs
  11. Pingback: canadian drugs
  12. Pingback: canada viagra
  13. Pingback: site656670376.fo.team
  14. Pingback: site561571227.fo.team
  15. Pingback: hekluy.ucraft.site
  16. Pingback: canada medication
  17. Pingback: canadianpharmacy
  18. Pingback: canada viagra
  19. Pingback: swenqw.company.site
  20. Pingback: canada pharmacies
  21. Pingback: pharmacy canada
  22. Pingback: canadian viagra
  23. Pingback: kwersv.proweb.cz
  24. Pingback: sdtyli.zombeek.cz
  25. Pingback: site955305180.fo.team

发表评论