位置: 编程技术 - 正文

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索引使用正则表达式)

  • 小规模纳税人销售自建不动产
  • 印花税购销合同改为买卖合同
  • 个人物品出售要交哪些税
  • 为员工代缴社保材料
  • 开了发票不做收入的账务处理
  • 冲红发票怎么写备注
  • 回单结算卡丢失了严重吗
  • 一般企业和小企业会计准则的区别
  • 知道税额怎么算含税金额
  • 小微企业附加税减半征收
  • 有发票章的存根联可以当发票用吗
  • 租赁房屋房产税
  • 从国外进口的免税商品
  • 林木育种的意义和作用
  • 国外汇款 用什么理由
  • 公司股权转让应纳税额怎么算
  • 如何理解纳税人资格
  • 发票停票会自动恢复吗
  • 借其他应收贷应付
  • 如何调用金三接口?
  • 增值税减免税明细表
  • 收取赔偿金开具什么发票
  • 不动产租金收入缴纳增值税
  • 股权出售是利空还是利好
  • win10应用显示模糊发虚
  • bios是什么请简要介绍一下
  • 刚成立的公司老总叫什么
  • ipados15什么时候发布
  • 企业补缴个人所得税罚款
  • elementui能做什么
  • win11系统咋样
  • 利息费用可扣除什么
  • form表单提交数组
  • vue多入口文件
  • 冰川国家公园在哪
  • framework4.0怎么打开
  • win11开机后开始菜单没反应
  • HTML与PyCharm
  • 基建账并账规定
  • 通过SQLServer 2008 操作 MySQL的方法
  • 影响留存收益变动的选折题
  • 省市县三级联动工作机制
  • 政府补助确认递延所得税负债
  • 已纳消费税扣除会计分录
  • 全额计提坏账准备有什么作用
  • 未开票收入不入账以规避税收
  • 经营性罚款在会计中怎么处理
  • 单位收到社保补贴会计怎样处理
  • 已认证的增值税专用发票可以作废吗
  • 企业所得税资产总额在哪里填列
  • 预缴所得税弥补以前年度亏损
  • 公司购买防疫物资的申请
  • 与其他企业联营
  • 可供出售金融资产和交易性金融资产
  • 视同销售收入涉及税务如何做账?
  • 住宿补贴需要交个税吗
  • 公转私钱最好的方法
  • 工业企业销售商品
  • mysql触发器的作用
  • mysql内存占用一直增高不释放
  • windows2008关闭ie增强
  • 怎么查看445端口有没有关闭
  • appcrash是什么文件
  • Ubuntu Update-rc.d命令详细介绍
  • sar 命令
  • os x10.11el capitan公测版下载地址(公测版计划注册教程)
  • win10新界面曝光
  • ubuntu必备软件10款
  • macbook如何安装苹果系统
  • win10修复dllregisterserver
  • win7系统出现问题怎么修复
  • win7恶意程序怎么清除
  • unix怎么操作
  • win7关掉wifi
  • 初始化opengl时出错
  • python利用while循环求1+2+3......+n的和
  • The method setClass(Context, Class<?>) in the type Intent is not applicable for the问题
  • shell中使用变量
  • 四川省税务局发票查询
  • 旧房转让土地增值税扣除项目
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设