6.
D:\Software\MongoDb\mongodb\bin>mongo.exe or goto line no 199
7.
MongoDB shell
version: 3.0.7
8.
connecting to:
test
9.
>
rs.initiate()
10. {
11. "info2" : "no
configuration explicitly specified -- making one",
12. "me" :
"IN-L1155:27017",
13. "ok" : 1
14. }
15. kartik:SECONDARY>
rs.add("192.168.65.143:27017")
16. {
17. "ok" : 0,
18. "errmsg" : "Quorum
check failed because not enough voting nodes responded; required 2 but only
the following 1 voting nodes responded: IN-L1155:27017; the following nodes
did not respond affirmatively: 192.168.65.143:27017 failed with Failed
attempt to connect to 192.168.65.143:27017; couldn't connect to server
192.168.65.143:27017 (192.168.65.143), connection attempt failed",
19. "code" : 74
20. }
21. kartik:PRIMARY>
rs.add("192.168.65.143:27017")
22. {
23. "ok" : 0,
24. "errmsg" : "Quorum
check failed because not enough voting nodes responded; required 2 but only
the following 1 voting nodes responded: IN-L1155:27017; the following nodes
did not respond affirmatively: 192.168.65.143:27017 failed with Failed
attempt to connect to 192.168.65.143:27017; couldn't connect to server
192.168.65.143:27017 (192.168.65.143), connection attempt failed",
25. "code" : 74
26. }
27.
28. kartik:PRIMARY>
rs.add("192.168.208.181:27018")
29. { "ok"
: 1 }
30. kartik:PRIMARY>
rs.config()
31. {
32. "_id" : "rs0",
33. "version" : 2,
34. "members" : [
35. {
36. "_id" : 0,
37. "host" :
"IN-L1155:27017",
38. "arbiterOnly"
: false,
39. "buildIndexes"
: true,
40. "hidden" : false,
41. "priority"
: 1,
42. "tags" : {
43.
44. },
45. "slaveDelay"
: 0,
46. "votes" : 1
47. },
48. {
49. "_id" : 1,
50. "host" :
"192.168.208.181:27018",
51. "arbiterOnly"
: false,
52. "buildIndexes"
: true,
53. "hidden" :
false,
54. "priority"
: 1,
55. "tags" : {
56.
57. },
58. "slaveDelay"
: 0,
59. "votes" : 1
60. }
61. ],
62. "settings" : {
63. "chainingAllowed" :
true,
64. "heartbeatTimeoutSecs"
: 10,
65. "getLastErrorModes"
: {
66.
67. },
68. "getLastErrorDefaults"
: {
69. "w" : 1,
70. "wtimeout"
: 0
71. }
72. }
73. }
74. kartik:PRIMARY>
rs.add("192.168.208.181:27019")
75. { "ok"
: 1 }
76. kartik:PRIMARY>
rs.config()
77. {
78. "_id" : "rs0",
79. "version" : 3,
80. "members" : [
81. {
82. "_id" : 0,
83. "host" :
"IN-L1155:27017",
84. "arbiterOnly"
: false,
85. "buildIndexes"
: true,
86. "hidden" :
false,
87. "priority"
: 1,
88. "tags" : {
89.
90. },
91. "slaveDelay" : 0,
92. "votes" : 1
93. },
94. {
95. "_id" : 1,
96. "host" :
"192.168.208.181:27018",
97. "arbiterOnly"
: false,
98. "buildIndexes" : true,
99. "hidden" :
false,
100. "priority"
: 1,
101. "tags" : {
102.
103. },
104. "slaveDelay"
: 0,
105. "votes" : 1
106. },
107. {
108. "_id" : 2,
109. "host" :
"192.168.208.181:27019",
110. "arbiterOnly"
: false,
111. "buildIndexes"
: true,
112. "hidden" :
false,
113. "priority"
: 1,
114. "tags" : {
115.
116. },
117. "slaveDelay"
: 0,
118. "votes" : 1
119. }
120. ],
121. "settings" : {
122. "chainingAllowed" :
true,
123. "heartbeatTimeoutSecs"
: 10,
124. "getLastErrorModes"
: {
125.
126. },
127. "getLastErrorDefaults"
: {
128. "w" : 1,
129. "wtimeout"
: 0
130. }
131. }
132. }
133. kartik:PRIMARY>
rs.status()
134. {
135. "set" : "rs0",
136. "date" :
ISODate("2016-10-13T12:29:48.413Z"),
137. "myState" : 1,
138. "members" : [
139. {
140. "_id" : 0,
141. "name" :
"IN-L1155:27017",
142. "health" :
1,
143. "state" :
1,
144. "stateStr"
: "PRIMARY",
145. "uptime" :
3268,
146. "optime" :
Timestamp(1476361776, 1),
147. "optimeDate"
: ISODate("2016-10-13T12:29:36Z"),
148. "electionTime"
: Timestamp(1476358572, 2),
149. "electionDate"
: ISODate("2016-10-13T11:36:12Z"),
150. "configVersion" : 3,
151. "self" :
true
152. },
153. {
154. "_id" : 1,
155. "name" :
"192.168.208.181:27018",
156. "health" :
1,
157. "state" :
2,
158. "stateStr"
: "SECONDARY",
159. "uptime" :
136,
160. "optime" :
Timestamp(1476361776, 1),
161. "optimeDate"
: ISODate("2016-10-13T12:29:36Z"),
162. "lastHeartbeat"
: ISODate("2016-10-13T12:29:46.551Z"),
163. "lastHeartbeatRecv"
: ISODate("2016-10-13T12:29:48.213Z"),
164. "pingMs" :
0,
165. "syncingTo"
: "IN-L1155:27017",
166. "configVersion"
: 3
167. },
168. {
169. "_id" : 2,
170. "name" :
"192.168.208.181:27019",
171. "health" :
1,
172. "state" :
2,
173. "stateStr"
: "SECONDARY",
174. "uptime" :
11,
175. "optime" :
Timestamp(1476361776, 1),
176. "optimeDate"
: ISODate("2016-10-13T12:29:36Z"),
177. "lastHeartbeat" :
ISODate("2016-10-13T12:29:46.554Z"),
178. "lastHeartbeatRecv"
: ISODate("2016-10-13T12:29:46.570Z"),
179. "pingMs" :
0,
180. "configVersion"
: 3
181. }
182. ],
183. "ok" : 1
184. }
185. kartik:PRIMARY>
|