位置: 编程技术 - 正文

Mongodb 删除添加分片与非分片表维护(mongodb如何删除)

编辑:rootadmin

推荐整理分享Mongodb 删除添加分片与非分片表维护(mongodb如何删除),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:mongodb如何删除,mongodb删除数据释放空间,mongodb删除文档命令,mongodb增删改查,mongodb删除文档命令,mongodb如何删除,mongodb增删改查,mongodb如何删除,内容如对您有帮助,希望把文章链接给更多的朋友!

MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。

MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。

一、如何移除分片

1、确认balancer已经开启

mongos> sh.getBalancerState()true

2、移除分片

注:在admin db下执行命令。

3、检查迁移的状态

同样执行

remaining中的chunks表示还有多少数据块未迁移。

Mongodb 删除添加分片与非分片表维护(mongodb如何删除)

4、移除未分片数据

In a cluster, a database with unsharded collections stores those collections only on a single shard.That shard becomes the primary shard for that database. (Different databases in a cluster can have different primary shards.)WARNINGDo not perform this procedure until you have finished draining the shard.1)To determine if the shard you are removing is the primary shard for any of the cluster's databases, issue one of the following methods:sh.status()db.printShardingStatus()In the resulting document, the databases field lists each database and its primary shard.For example, the following database field shows that the products database uses mongodb0 as the primary shard:{ "_id" : "products", "partitioned" : true, "primary" : "mongodb0" }2)To move a database to another shard, use the movePrimary command. For example, to migrate all remaining unsharded data from mongodb0 to mongodb1, issue the following command:use admindb.runCommand( { movePrimary: "products", to: "mongodb1" }) --products为db nameThis command does not return until MongoDB completes moving all data, which may take a long time. The response from this command will resemble the following:{ "primary" : "mongodb1", "ok" : 1 }If you use the movePrimary command to move un-sharded collections, you must either restart all mongos instances,or use the flushRouterConfig command on all mongos instances before writing any data to the cluster. This action notifies the mongos of the new shard for the database.If you do not update the mongos instances' metadata cache after using movePrimary, the mongos may not write data to the correct shard. To recover, you must manually intervene.

根据上面所说,迁移非分片表 时 最好停机,在运行db.runCommand( { movePrimary: "products", to: "mongodb1" }) 命令完成之后,刷新所有mongos后(所有mongos上运行db.runCommand("flushRouterConfig")),再对外提供服务。当然也可以重新启动所有mongos实例 。

5、完成迁移

如果state为 completed,表示已完成迁移。

二、添加分片

1、首先确认balancer已经开启

mongos> sh.getBalancerState()true

2、执行添加分片的命令

如果出现以下错误,删除目标shard3上的test1数据库,再次执行命令

最后运行sh.status()命令确认迁移是否成功,可能会花比较长的时间。

以上内容是给大家介绍了Mongodb 删除添加分片与非分片表维护的全部叙述,希望对大家有所帮助。

MongoDB索引使用详解 索引就像书的目录,如果查找某内容在没有目录的帮助下,只能全篇查找翻阅,这导致效率非常的低下;如果在借助目录情况下,就能很快的定位具体

使用aggregate在MongoDB中查询重复数据记录的方法 MongoDB中聚合(aggregate)主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果。有点类似sql语句中的count(*)。aggregate()方法MongoDB中聚合的方

mongodb使用心得简单总结 1.mongodb特性1)mongo是一个面向文档的数据库,它集合了nosql和sql数据库两方面的特性。2)所有实体都是在首次使用时创建。3)没有严格的事务特性,但

标签: mongodb如何删除

本文链接地址:https://www.jiuchutong.com/biancheng/312100.html 转载请保留说明!

上一篇:Ubuntu系统中安装MongoDB及其启动命令mongod的教程(ubuntu系统安装教程)

下一篇:MongoDB索引使用详解(mongodb索引使用正则表达式)

  • 纳税人未缴少缴税款
  • 一般纳税人的发票抵扣进项税额
  • 资产减值损失与资产处置损益区别
  • 材料成本差异借贷方向
  • 固定资产大修理支出标准
  • 股权转让所得交所得税吗
  • 子公司的财报和母公司的财报并表吗
  • 购进货物取得
  • 个体户发放现金工资税务局认可吗
  • 农业企业销售林木是否要交印花税?
  • 出口退税对企业利润的影响
  • 二手房房产税税率
  • 房产契税什么时候可以退
  • 付给企业的律师费用
  • 劳务公司包工包料的法律法规
  • 服务业成本怎么做账
  • 增值税进项税怎么算
  • 境内单位和个人将船舶出租到境外的,不征收车船税
  • macbookpro怎么安装双系统
  • wordpress相关文章插件
  • 没按时报税罚款多少
  • 帝国cms移动端
  • php编程技术
  • 企业对员工罚款的法律依据
  • 总部资产减值测试例题
  • 长期借款的会计处理例题
  • 收到证券公司异常交易
  • vue.js devtools插件下载
  • labview oop
  • 老老实实的人
  • 比较好的微信名称有哪些
  • 小规模纳税人年收入超过500万必须转为一般纳税人吗
  • 公司向股东个人借款的会计分录
  • 关于公司预支工资制度
  • 税务稽查补税
  • 辞退员工福利
  • 企业其他应付款余额非常大的原因
  • 织梦如何使用
  • mysql行锁的作用
  • mongodb分区分片
  • 学电脑的网站
  • 暂估入账的固定资产,待办理竣工决算手续后
  • 异地预缴税款多交了有影响吗
  • sqlserver2008实例配置
  • 企业欠缴非税收据怎么写
  • 税务师考试的报名时间
  • 增值税税控系统专用设备费及技术维护费抵扣
  • 土地使用税是新征税吗
  • 附加税的印花税怎么计算
  • 暂估入库后发票来不了
  • 分公司独立核算和非独立核算哪个好
  • asp.net ui
  • 删除数据库重复
  • sql语言中delete删除命令语句详解
  • 根据日期算时间
  • xp系统没有鼠标自己乱跳
  • linux updatedb
  • mcupdate.dll
  • windows8设置自动关机
  • Win10 Mobile 10586.306提前上手视频评测
  • win8运行速度慢怎么办
  • linux系统安装程序
  • IE6支持position:fixed完美解决方法
  • 批处理清空文本内容
  • string剪切
  • node exit
  • python编码大全
  • js数组entries
  • js初级教程
  • javascript零基础入门
  • android 属性动画改变view大小
  • python设计二叉树结构
  • 广东省地方税务局发票查询
  • 开发区税务局咨询电话
  • 金税盘显示证书口令错误
  • 北京地税电子税票怎么开
  • 北京大兴开发区房价
  • 代理记账和代理的区别
  • app平台怎么投诉商家
  • 增值税发票报税流程
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设