位置: 编程技术 - 正文

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

  • 公司股东向公司借款
  • 增值税是什么意思
  • 计提所得税费用会计分录
  • 新个税计算公式怎么输入excel
  • 现金流量套期与什么无关
  • 取得的股息红利收入计入哪个科目
  • 蔬菜开税票纳税吗
  • 车间职工报销医药费能使用现金吗
  • 企业想成为退税商店需具备哪些条件
  • 小规模附加税减免政策2023最新
  • 以现金形式发工资的说明范文
  • 增值税是先交税还是先开票
  • 土地增值税哪些可以加计扣除
  • 进项税不够有别的税吗
  • 水利建设基金有优惠政策吗
  • 民办非企业能开据服务发票吗?
  • 金税盘用途
  • 应税行为扣除额怎么填
  • 关联关系的判定标准
  • 纳税调整额怎么算出来的
  • 购车装修能不能算固定资产
  • 小额零星业务上限是多少
  • 国际工程物资采购网
  • 软件固定资产还是无形资产
  • 利息支出为什么不是经营成本
  • 新版edge浏览器兼容ie
  • 什么叫冲减进项税额
  • 以前年度损益调整
  • 如何更改windows11显示语言
  • 深入分析php引用文献
  • 借股东现金会计分录
  • macOS Big Sur 11.3 公开测试版正式推送(附更新内容)
  • 什么食物含胆固醇高不能吃
  • 表单校验html5
  • 开发票如何计算税率
  • php数组拼接成字符串
  • 安装libtool
  • 年终企业所得税怎么结转
  • 汽修厂利润能达到一半吗
  • 企业之间支付的管理费指什么
  • 土增尾盘销售应该如何申报收入
  • 信用减值损失属于什么类
  • 固定资产处置的账务处理 终于搞明白了!
  • 货物运输企业的经营内容
  • 混合销售举例说明
  • 公司股东投资是什么意思
  • 个体户查账征收个人所得税税率
  • 房租进项发票怎么处理
  • 增值税普通发票有什么用
  • 进口货物会计处理举例
  • 本年利润的会计分录
  • 人力资源劳务费计入什么科目
  • 自产自用进项税额
  • 个人借款产生的利息怎么计算的
  • 固定资产发票怎么处理
  • 开户一定要去银行吗
  • 保险可以税前扣除吗
  • 委托收款的流程
  • sql语句训练题及答案
  • win8正版系统
  • ubuntu16.04安装拼音输入法
  • centos6.5共享文件夹
  • 国产系统叫啥
  • windowsxp注册表在哪
  • weather.exe - weather 进程是什么文件
  • ubuntu下安装windows
  • mac 特殊符号
  • apache2.4.46配置
  • windows server 2012 r2关机在哪
  • 华硕安装win7系统
  • microsoft/微软
  • linux usb audio
  • js表格上移下移
  • js获取选中的checkbox
  • jquery弹窗弹出一个页面
  • jquery使用教程
  • jquery使用方法
  • androidsdk的计算机
  • 广州市国家税务局稽查局举报中心
  • 安徽马鞍山税务局体检名单
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设