位置: 编程技术 - 正文

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

  • 广告制作要交文化部门吗
  • 长期债权投资是什么科目借贷
  • 个人所得税B表和C表
  • 小规模企业能否抵扣
  • 小规模企业所得税多少
  • 应付债券利息调整是什么意思
  • 无形资产摊销年限
  • 或有负债在报表附注哪里
  • 代开增值税票普票专票税点一样吗
  • 跨年的材料专票怎么做会计分录?
  • 向境外销售货物交增值税吗?
  • 会计核算体系的中心环节是什么
  • 电子发票和增值税电子普通发票的区别
  • 房地产退房款会计分录
  • 折扣发票有什么作用
  • 增值税专用发票几个点
  • 未分配利润转增股本 个人所得税
  • 税控盘280减免代码
  • 跨年补交企业所得税
  • 银行没有流水怎么开证明
  • 个人转让股权的合理费用都有哪些
  • 无线网连上却上不了网络
  • 高新企业开办费是多少
  • 分红个人所得税在哪里查询
  • MAC OS X 10.12.5 beta 4怎么升级 OS X 10.12.5 beta 4升级图文教程
  • vue页面获取url参数
  • 最常用的成本核算方法表
  • 会计分录编制的步骤
  • 代理买卖证券款属于什么科目
  • yii框架运行原理
  • 公司借款利息可以用对公户转账吗
  • 用抵扣券买了东西可以退吗
  • matlab进行图像处理
  • mobilenet模型
  • php怎么转go
  • emacs scheme
  • 销售旧货税率
  • 购入固定资产预付款怎么做账
  • 缴纳印花税的会计凭证怎么做
  • linux mongodb创建用户
  • 织梦怎么用
  • 单位购买预付卡可以用现金吗
  • 房产税计入管理费用还是税金附加
  • 房地产城建税计税依据
  • 发票冲红和作废有啥区别
  • SqlServer 2005 T-SQL Query 学习笔记(2)
  • 九月份个人所得税的调整
  • 代垫电费收回开票吗
  • 个人所得税能说明什么
  • 安装调试费收费标准
  • 出口收入没有及时申报怎么处罚
  • 广告公司收到广告收入会计分录
  • 一般纳税人内外账
  • 转账支票怎么填写会计凭证
  • 计划成本法和实际成本法的适用范围
  • 根据企业会计准则第4号固定资产,企业可选用的折旧方法
  • uc聊天大厅
  • VMware虚拟机中安装MATE桌面环境
  • linux wk
  • linux增加命令
  • 电脑重装windows
  • xp启动加速
  • linux ...
  • win10怎么检查
  • aix操作命令
  • centos哪个版本最好用2022
  • linux wc-w
  • win7鼠标突然不能用了
  • js自动执行点击事件
  • cocos creator性能
  • macos unity
  • javascript中对象一般由什么组成
  • perl 读文件
  • c#在unity的作用
  • unity-3d
  • unity3d初学者教程视频
  • 什么是碰撞检测
  • shell脚本关闭指定程序
  • python中迭代例子
  • android开发前景
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设