MongoDB副本集配置系列四:节点的关闭顺序
接上一篇博客:http://www.cnblogs.com/xiaoit/p/4522218.html Primary Secondary Arbiter
1:关闭顺序PSA :会报错
2:关闭顺序PAS :可以
3:关闭顺序SAP :主节点会变为从节点
4:关闭顺序SPA :会报错
5:关闭顺序APS
6:关闭顺序ASP :主节点会变为从节点
1:关闭顺序PSA
gechongrepl:PRIMARY> rs.isMaster()
{
"setName" : "gechongrepl",
"setVersion" : 13,
"ismaster" : true,
"secondary" : false,
"hosts" : [
"192.168.91.133:27017",
"192.168.91.132:27017",
"192.168.91.132:27018"
],
"arbiters" : [
"192.168.91.135:27017"
],
"primary" : "192.168.91.133:27017",
"me" : "192.168.91.133:27017",
"electionId" : ObjectId("5568098a6de3d53a2ea91c64"),
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 1000,
"localTime" : ISODate("2015-05-29T06:39:36.548Z"),
"maxWireVersion" : 3,
"minWireVersion" : 0,
"ok" : 1
}
P:
gechongrepl:PRIMARY> use admin
switched to db admin
gechongrepl:PRIMARY> db.shutdownServer()
S:
从变为了:gechongrepl:PRIMARY> gechongrepl:PRIMARY> use admin
switched to db admin
gechongrepl:PRIMARY> db.shutdownServer()
assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:48:06.022-0700
Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:48:06.022-0700
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4
2015-05-28T23:48:06.023-0700 E QUERY Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:48:06.022-0700
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4 at src/mongo/shell/assert.js:13
A:
gechongrepl:ARBITER> use admin
switched to db admin
gechongrepl:ARBITER> db.shutdownServer()
再次关闭S:
S变为了:ggechongrepl:SECONDARY> gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
2:关闭顺序PAS : 已经验证,不报错。
3:关闭顺序SAP
S:
gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
A:
gechongrepl:ARBITER> use admin
switched to db admin
gechongrepl:ARBITER> db.shutdownServer()
P:
主变为了:gechongrepl:SECONDARY> gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
4:关闭顺序SPA
S:
gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
P:
gechongrepl:PRIMARY> use admin
switched to db admin
gechongrepl:PRIMARY> db.shutdownServer()
assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:59:19.685-0700
Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:59:19.685-0700
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4
2015-05-28T23:59:19.702-0700 E QUERY Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-28T23:59:19.685-0700
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4 at src/mongo/shell/assert.js:13
A:
gechongrepl:ARBITER> use admin
switched to db admin
gechongrepl:ARBITER> db.shutdownServer()
再次关闭P:
gechongrepl:PRIMARY> use admin
switched to db admin
2015-05-29T00:00:44.938-0700 I NETWORK DBClientCursor::init call() failed
2015-05-29T00:00:44.940-0700 I NETWORK trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2015-05-29T00:00:44.941-0700 I NETWORK reconnect 127.0.0.1:27017 (127.0.0.1) ok
gechongrepl:SECONDARY> db.shutdownServer()
下面猜测:在关闭最后的Primary节点之前,先关掉仲裁节点即不会报错。(首先关掉Primary节点,还有其他Secondary不属于这种情况)
5:关闭顺序APS : 不会报错
6:关闭顺序ASP : 不会报错
验证猜测:
5:关闭顺序APS
A:
gechongrepl:ARBITER> use admin
switched to db admin
gechongrepl:ARBITER> db.shutdownServer()
P:
gechongrepl:PRIMARY> use admin
switched to db admin
gechongrepl:PRIMARY> db.shutdownServer()
S:因为仲裁节点关闭了。所以Primary节点不会再自动切换
gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
6:关闭顺序ASP
A:
gechongrepl:ARBITER> use admin
switched to db admin
gechongrepl:ARBITER> db.shutdownServer()
S:
gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
P:
gechongrepl:PRIMARY>
2015-05-29T00:12:23.962-0700 I NETWORK DBClientCursor::init call() failed
2015-05-29T00:12:23.965-0700 I NETWORK trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2015-05-29T00:12:23.966-0700 I NETWORK reconnect 127.0.0.1:27017 (127.0.0.1) ok
gechongrepl:SECONDARY>
gechongrepl:SECONDARY> use admin
switched to db admin
gechongrepl:SECONDARY> db.shutdownServer()
总结:
1:先关闭从节点、仲裁节点。或者先关闭仲裁节点,最后关闭从节点。则:主节点自动变为从节点
2:先关闭主节点,则从节点自动变为主节点,在仲裁节点关闭之前,新主节点不能关闭
初始化的时候主从节点受priority的影响
priority: 是优先级,默认为1,优先级0为被动节点,不能成为活跃节点。优先级不位0则按照有大到小选出活跃节点。
MongoDB副本集配置系列四:节点的关闭顺序的更多相关文章
- MongoDB副本集配置系列五:副本集的在线迁移
MongoDB副本集的在线迁移 查看当前集群的状态: { "setName" : "gechongrepl", "setVersion" : ...
- MongoDB副本集配置系列三:副本集的认证方式
1:副本集配置参考这篇博客: http://www.cnblogs.com/xiaoit/p/4478951.html 2:副本集的认证 假设有两台机器已经配置好了副本集(副本集罪一般最少3台机器,这 ...
- MongoDB副本集配置系列二:配置MongoDB副本集
接上一篇博客: http://www.cnblogs.com/xiaoit/p/4479066.html 1:首先创建3台虚拟机作为配置环境 IP1:192.168.91.128 IP2:192.16 ...
- MongoDB副本集配置系列十一:MongoDB 数据同步原理和自动故障转移的原理
1:数据同步的原理: 当Primary节点完成数据操作后,Secondary会做出一系列的动作保证数据的同步: 1:检查自己local库的oplog.rs集合找出最近的时间戳. 2:检查Primary ...
- MongoDB副本集配置系列十:MongoDB local库详解和数据同步原理
1:local库是MongoDB的系统库,记录着时间戳和索引和复制集等信息 gechongrepl:PRIMARY> use local switched to db local gechong ...
- MongoDB副本集配置系列七:MongoDB oplog详解
1:oplog简介 oplog是local库下的一个固定集合,Secondary就是通过查看Primary 的oplog这个集合来进行复制的.每个节点都有oplog,记录这从主节点复制过来的信息,这样 ...
- MongoDB副本集配置系列九:MongoDB 常见问题
What is a namespace in MongoDB? If you remove a document, does MongoDB remove it from disk? When doe ...
- MongoDB副本集配置系列八:MongoDB监控
1:Mongostat MongoDB2.6版本 MongoDB3.0版本 2:db.setProfilingLevel(2):打开profiler 类似于MySQL的slow log Profile ...
- MongoDB副本集配置系列六:定位MongoDB慢的原因
1:想知道哪些操作拖慢了MongoDB的速度,首先需要检查当前正在执行哪些操作. gechongrepl:PRIMARY> db.currentOp() "opid" : 7 ...
随机推荐
- SpringBoot下的Job定时任务
编写Job定时执行任务十分有用,能解决很多问题,这次实习的项目里做了一下系统定时更新三方系统订单状态的功能,这里用到了Spring的定时任务使用的非常方便,下面总结一下如何使用: 一,@schedul ...
- 唐顿庄园第一至五季/全集Downton Abbey迅雷下载
本季Downton Abbey 1(2010)看点:ITV古装剧剧<唐顿庄园>由曾因<高斯福德庄园>而荣获奥斯卡的金牌编剧Julian Fellowes一手打造,明星云集的演员 ...
- 豪斯医生第一季/全集House M.D 1迅雷下载
豪斯医生 第一季 House M.D. Season 1 (2004)本季看点:态度无礼,表情凶恶,跛足拄着一根藤棍,永远是牛仔裤运动鞋的便装打扮而不是整洁的白大褂,普林斯顿大学附属医院的格雷戈·豪斯 ...
- C# byte[]和文件FileStream相互转化
, pReadByte.Length); } catch { return false; ...
- 可重入读写锁ReentrantReadWriteLock基本原理分析
前言 本篇适用于了解ReentrantLock或ReentrantReadWriteLock的使用,但想要进一步了解原理的读者.见于之前的分析都是借鉴大量的JDK源码,这次以流程图的形式代替源码,希望 ...
- 附1 踩过的jedis的一些坑
1.java.lang.Long to java.lang.B]类型转换异常 解决方案:归还资源部分,使用jedis.close() 2.jedis数组越界异常 解决方案:版本太低,升到2.8.0
- 关于UI设计中的交互软件Axure7.0运用
Axure RP是一个专业的快速原型设计工具.让负责定义需求和规格.设计功能和界面的人员能够快速创建应用软件或Web网站的线框图.流程图.原型和规格说明文档. 作为专业的原型设计工具,它能快速.高效的 ...
- C++模拟键盘消息
实现功能:在现有DLL程序中向特定的EXE窗口中发送模拟键盘的消息 使用API根据窗口标题递归查找特定的窗口句柄,之后模拟调用. 注意:keybd_event函数不能在VS下使用,所以用SendInp ...
- Gradle - Manifest
Manifest DSL提供了配置以下Manifest条目的功能: minSdkVersion / targetSdkVersion / versionCode / versionName / app ...
- 用于文本分类的RNN-Attention网络
用于文本分类的RNN-Attention网络 https://blog.csdn.net/thriving_fcl/article/details/73381217 Attention机制在NLP上最 ...