先上几个用到的yaml文件,以后有时间了再更新,我是借鉴的https://blog.csdn.net/zeroctu/article/details/71082168,本人按照上面的搭建,是可行的,不过一定要注意搭建的mongodb版本,不要选3.2,如果要用 sharding,一定要选用3.4以上版本,不然分片无效。

systemLog:
destination: file
path: "/usr/local/mongodb/instance/mongos/log/mongos.log"
net:
port: 27017
processManagement:
fork: true
sharding:
configDB: cfgSet/10.74.20.40:27019,10.74.20.14:27019,10.74.20.13:27019
cfg = {
_id: "shard01",
members:[
{
_id: 0,
host: "10.74.20.40:27018",
priority: 3
},
{
_id: 1,
host: "10.74.20.14:27018",
priority: 2
},
{
_id: 2,
host: "10.74.20.13:27018",
arbiterOnly: true
}
]
}
cfg = {
_id: "shard02",
members:[
{
_id: 0,
host: "10.74.20.40:27118",
arbiterOnly: true
},
{
_id: 1,
host: "10.74.20.14:27118",
priority: 3
},
{
_id: 2,
host: "10.74.20.13:27118",
priority: 2
}
]
}
cfg = {
_id: "shard03",
members:[
{
_id: 0,
host: "10.74.20.40:27218",
priority: 2
},
{
_id: 1,
host: "10.74.20.14:27218",
arbiterOnly: true
},
{
_id: 2,
host: "10.74.20.13:27218",
priority: 3
}
]
}
cfg =
{
_id: "cfgSet",
configsvr: true,
members:[
{
_id: 0,
host: "10.74.20.40:27019",
priority: 3
},
{
_id: 1,
host: "10.74.20.14:27019",
priority: 2
},
{
_id: 2,
host: "10.74.20.13:27019",
priority: 1
}
]
}
db.runCommand({addshard:"shard01/10.74.20.40:27018,10.74.20.14:27018,10.74.20.13:27018"})

db.runCommand({addshard:"shard02/10.74.20.40:27118,10.74.20.14:27118,10.74.20.13:27118"})

db.runCommand({addshard:"shard03/10.74.20.40:27218,10.74.20.14:27218,10.74.20.13:27218"})

Replica Set + sharding搭建mongodb集群的更多相关文章

  1. 搭建mongodb集群(副本集+分片)

    搭建mongodb集群(副本集+分片) 转载自:http://blog.csdn.net/bluejoe2000/article/details/41323051 完整的搭建mongodb集群(副本集 ...

  2. MongoDB系列—— Window 搭建Mongodb 集群

    Mongodb的集群方式的搭建有三种:Replica Set / Sharding / Master-Slaver.这里只说明最简单的集群搭建方式(Replica Set) Replica Set M ...

  3. 在 Azure 虚拟机上快速搭建 MongoDB 集群

    MongoDB 是目前在 NoSQL 市场上非常受欢迎的一个数据库,本文介绍如何使用 Azure PowerShell 和 Azure CLI 在 Azure 虚拟机上搭建单节点 MongoDB(测试 ...

  4. RedHat7搭建MongoDB集群

    下载RPM安装包# wget -c -r -N -np -nd -L -nH https://repo.mongodb.org/yum/redhat/7/mongodb-org/stable/x86_ ...

  5. mongodb 4.0.5 集群搭建五台集群

    配置文件采用yaml方式来配置 生产中取消了仲裁者的角色,因为仲裁者也不会存储数据,只是起到选举的作用,线上为了保证数据安全,每份数据都会配置两个副本集,也就是每份数据存储了三份. 优化配置,采用五台 ...

  6. mongodb集群性能优化

    mongodb集群性能优化 在前面两篇文章,我们介绍了如何去搭建mongodb集群,这篇文章我们将介绍如何去优化mongodb的各项配置,以达到最优的效果. 警告 不做任何的优化,集群搭建完成之后,使 ...

  7. 手把手教你用Docker部署一个MongoDB集群

    MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中最像关系数据库的.支持类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引 ...

  8. mongodb集群安装及到现在遇到的一些问题

    集群搭建 只有3台服务器,开始搭建mongodb集群里主要参照的是http://www.lanceyan.com/tech/arch/mongodb_shard1.html,端口的设置也是mongos ...

  9. Mongodb集群搭建之 Sharding+ Replica Sets集群架构(2)

    参考http://blog.51cto.com/kaliarch/2047358 一.概述 1.1 背景 为解决mongodb在replica set每个从节点上面的数据库均是对数据库的全量拷贝,从节 ...

随机推荐

  1. JS简单实现分页显示

    完整代码源码可以在这里下载 1.在 HTML文件建立列表目标节点和翻页器目标节点 <body> <!--页面控制器 --> <div id="nav" ...

  2. Module(CP343-1)Advanced system error SDB generation Error in rule file or rule file not found

    报这个故障的原因是因为安装目录下缺少三个 err文件.只要从好的目录下拷贝过来即可. C:\Program Files (x86)\SIEMENS\Step7\s7wbx\rul

  3. vscode插件安装失败的解决方案

    在vscode中点击对应插件的install按钮安装,安装失败,软件提示手动安装(manually install). 手动下载vsix安装包,然后点击install from VSIX...,选择v ...

  4. disconf安装问题

    安装参考文档:https://blog.csdn.net/fengyao1995/article/details/66491226 主要说说遇到的几个问题 1.在步骤6构建的时候,用jdk1.8,进行 ...

  5. Ultimate Guide to WhatsApp for Business 2019

    By Iaroslav Kudritskiy (Source: https://rocketbots.io/blog/the-ultimate-guide-to-whatsapp-business-a ...

  6. Sessions Hang on row cache lock

    Sessions Hang on "row cache lock" (dc_objects) While Creating & Dropping a Table Concu ...

  7. eolinker使用初体验(一)

    1.官网 https://www.eolinker.com 2.安装测试增强插件,由于chrome安装的时候有问题,建议移步firefox浏览器,不纠结.. 3.新建一个单例测试

  8. 定位属性position

    定位属性position小结 1.元素为fixed(固定的),则是固定定位,即使是子元素,也不参考父元素的位置,即以浏览器作为参考定位.相当于电脑屏幕的一只蚂蚁,你无论怎么滑动屏幕,还是在原来的位置. ...

  9. 更改oracle数据库密码(因为密码过期)

    更改system的密码,然后用此用户登录数据库,在数据库里修改指定用户密码 alter user username identified by newpassword; --修改忘记密码用户的密码 让 ...

  10. netcorec程序部署配置

    IIS方式: 1:iis配置netcore发布的文件 2:iis设置运行库无托管模式 3:安装DotNetCore.1.0.4_1.1.1-WindowsHosting.exe 4:安装dotnet- ...