Guest User

Untitled

a guest
Aug 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.98 KB | None | 0 0
  1. mongodb sharding replica sets with authentication via keyfile
  2. SECONDARY> rs.status();
  3. {
  4. "set" : "testdata1",
  5. "date" : ISODate("2011-11-08T15:30:14Z"),
  6. "myState" : 2,
  7. "members" : [
  8. {
  9. "_id" : 0,
  10. "name" : "192.162.1.19:10001",
  11. "health" : 1,
  12. "state" : 2,
  13. "stateStr" : "SECONDARY",
  14. "optime" : {
  15. "t" : 1320763306000,
  16. "i" : 1
  17. },
  18. "optimeDate" : ISODate("2011-11-08T14:41:46Z"),
  19. "self" : true
  20. },
  21. {
  22. "_id" : 1,
  23. "name" : "192.162.1.29:10002",
  24. "health" : 0,
  25. "state" : 8,
  26. "stateStr" : "(not reachable/healthy)",
  27. "uptime" : 0,
  28. "optime" : {
  29. "t" : 0,
  30. "i" : 0
  31. },
  32. "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
  33. "lastHeartbeat" : ISODate("2011-11-08T15:30:13Z"),
  34. "pingMs" : 0,
  35. "errmsg" : "need to login"
  36. },
  37. {
  38. "_id" : 2,
  39. "name" : "192.162.1.29:10003",
  40. "health" : 0,
  41. "state" : 8,
  42. "stateStr" : "(not reachable/healthy)",
  43. "uptime" : 0,
  44. "optime" : {
  45. "t" : 0,
  46. "i" : 0
  47. },
  48. "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
  49. "lastHeartbeat" : ISODate("2011-11-08T15:30:13Z"),
  50. "pingMs" : 0,
  51. "errmsg" : "need to login"
  52. }
  53. ],
  54. "ok" : 1
  55. }
  56.  
  57. Below of the log details which we have configured and getting the log details.
  58. ===============================================================================
  59.  
  60. [192.162.1.19]
  61. nohup mongod --rest --shardsvr --replSet testdata1 --port 10001 --oplogSize 50 --nojournal --keyFile /data/mongopwdkey/shardkey --dbpath /data/db/shardrepl_pri_1 > /tmp/shardrepl_pri_1.txt &
  62.  
  63. [192.162.1.29]
  64. nohup mongod --rest --shardsvr --replSet testdata1 --port 10002 --oplogSize 50 --nojournal --keyFile /data/mongopwdkey/shardkey --dbpath /data/db/shardrepl_sec_1 > /tmp/shardrepl_sec_1.txt &
  65. nohup mongod --rest --shardsvr --replSet testdata1 --port 10003 --oplogSize 10 --nojournal --keyFile /data/mongopwdkey/shardkey --dbpath /data/db/shardrepl_arb_1 > /tmp/shardrepl_arb_1.txt &
  66.  
  67.  
  68. [192.162.1.19]
  69. mongo --port 10001
  70. conf = {_id : "testdata1",members : [{_id : 0, host : "192.162.1.19:10001", votes : 2},{_id : 1, host : "192.162.1.29:10002", votes : 1},{_id:2, host: "192.162.1.29:10003", votes : 3, arbiterOnly: true}]}
  71. rs.initiate(conf)
  72. rs.status()
  73. use admin;
  74. db.addUser("admin","admin");
  75. exit;
  76.  
  77. # mongo -port 10001 admin -u admin -p
  78. MongoDB shell version: 2.0.1
  79. Enter password:
  80. connecting to: 127.0.0.1:10001/admin
  81. SECONDARY> rs.status();
  82. {
  83. "set" : "testdata1",
  84. "date" : ISODate("2011-11-09T10:11:46Z"),
  85. "myState" : 2,
  86. "members" : [
  87. {
  88. "_id" : 0,
  89. "name" : "192.162.1.19:10001",
  90. "health" : 1,
  91. "state" : 2,
  92. "stateStr" : "SECONDARY",
  93. "optime" : {
  94. "t" : 1320763306000,
  95. "i" : 1
  96. },
  97. "optimeDate" : ISODate("2011-11-08T14:41:46Z"),
  98. "self" : true
  99. },
  100. {
  101. "_id" : 1,
  102. "name" : "192.162.1.29:10002",
  103. "health" : 0,
  104. "state" : 8,
  105. "stateStr" : "(not reachable/healthy)",
  106. "uptime" : 0,
  107. "optime" : {
  108. "t" : 0,
  109. "i" : 0
  110. },
  111. "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
  112. "lastHeartbeat" : ISODate("2011-11-09T10:11:45Z"),
  113. "pingMs" : 0,
  114. "errmsg" : "need to login"
  115. },
  116. {
  117. "_id" : 2,
  118. "name" : "192.162.1.29:10003",
  119. "health" : 0,
  120. "state" : 8,
  121. "stateStr" : "(not reachable/healthy)",
  122. "uptime" : 0,
  123. "optime" : {
  124. "t" : 0,
  125. "i" : 0
  126. },
  127. "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
  128. "lastHeartbeat" : ISODate("2011-11-09T10:11:45Z"),
  129. "pingMs" : 0,
  130. "errmsg" : "need to login"
  131. }
  132. ],
  133. "ok" : 1
  134. }
  135.  
  136. [192.162.1.29]
  137. [root@dev_bmapp ~]# mongo -port 10002 admin -u admin -p
  138. MongoDB shell version: 2.0.1
  139. Enter password:
  140. connecting to: 127.0.0.1:10002/admin
  141. SECONDARY> rs.status();
  142. {
  143. "set" : "testdata1",
  144. "date" : ISODate("2011-11-09T10:13:41Z"),
  145. "myState" : 2,
  146. "members" : [
  147. {
  148. "_id" : 0,
  149. "name" : "192.162.1.19:10001",
  150. "health" : 1,
  151. "state" : 2,
  152. "stateStr" : "SECONDARY",
  153. "uptime" : 67411,
  154. "optime" : {
  155. "t" : 1320763306000,
  156. "i" : 1
  157. },
  158. "optimeDate" : ISODate("2011-11-08T14:41:46Z"),
  159. "lastHeartbeat" : ISODate("2011-11-09T10:13:40Z"),
  160. "pingMs" : 0
  161. },
  162. {
  163. "_id" : 1,
  164. "name" : "192.162.1.29:10002",
  165. "health" : 1,
  166. "state" : 2,
  167. "stateStr" : "SECONDARY",
  168. "optime" : {
  169. "t" : 1320763306000,
  170. "i" : 1
  171. },
  172. "optimeDate" : ISODate("2011-11-08T14:41:46Z"),
  173. "self" : true
  174. },
  175. {
  176. "_id" : 2,
  177. "name" : "192.162.1.29:10003",
  178. "health" : 1,
  179. "state" : 5,
  180. "stateStr" : "STARTUP2",
  181. "uptime" : 67411,
  182. "optime" : {
  183. "t" : 0,
  184. "i" : 0
  185. },
  186. "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
  187. "lastHeartbeat" : ISODate("2011-11-09T10:13:41Z"),
  188. "pingMs" : 0
  189. }
  190. ],
  191. "ok" : 1
  192. }
  193.  
  194.  
  195. Primary Node Log [192.162.1.19]
  196. ==============================
  197. Tue Nov 8 20:45:19 [initandlisten] MongoDB starting : pid=31771 port=10001 dbpath=/usr/db/shardrepl_pri_1 64-bit host=tedst.com
  198. Tue Nov 8 20:45:19 [initandlisten] db version v2.0.1, pdfile version 4.5
  199. Tue Nov 8 20:45:19 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
  200. Tue Nov 8 20:45:19 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
  201. Tue Nov 8 20:45:19 [initandlisten] options: { dbpath: "/usr/db/shardrepl_pri_1", keyFile: "/data/mongopwdkey/shardkey", nojournal: true, oplogSize: 50, port: 10001, replSet: "testdata1", rest: true, shardsvr:
  202.  
  203. true }
  204. Tue Nov 8 20:45:19 [initandlisten] waiting for connections on port 10001
  205. Tue Nov 8 20:45:19 [websvr] admin web console waiting for connections on port 11001
  206. Tue Nov 8 20:45:19 [rsStart] warning: getaddrinfo("localhost") failed: Name or service not known
  207. Tue Nov 8 20:45:19 [initandlisten] connection accepted from 127.0.0.1:44334 #1
  208. Tue Nov 8 20:45:19 [conn1] authenticate: { authenticate: 1, nonce: "ef53058aadd66cdb", user: "__system", key: "cbb8f221a881a90f8335edfb872a2300" }
  209. Tue Nov 8 20:45:19 [conn1] end connection 127.0.0.1:44334
  210. Tue Nov 8 20:45:19 [initandlisten] connection accepted from 127.0.0.1:44335 #2
  211. Tue Nov 8 20:45:19 [conn2] authenticate: { authenticate: 1, nonce: "86291a3e4c0c34e7", user: "__system", key: "2767d3377e700e50ab5a981a1c912516" }
  212. Tue Nov 8 20:45:19 [rsStart] replSet STARTUP2
  213. Tue Nov 8 20:45:19 [rsMgr] replSet total number of votes is even - add arbiter or give one member an extra vote
  214. Tue Nov 8 20:45:19 [rsSync] replSet SECONDARY
  215. Tue Nov 8 20:45:19 [rsHealthPoll] couldn't connect to 192.162.1.29:10002: couldn't connect to server 192.162.1.29:10002
  216. Tue Nov 8 20:45:19 [rsHealthPoll] couldn't connect to 192.162.1.29:10003: couldn't connect to server 192.162.1.29:10003
  217. Tue Nov 8 20:45:19 [rsHealthPoll] replSet info 192.162.1.29:10002 is down (or slow to respond): socket exception
  218. Tue Nov 8 20:45:19 [rsHealthPoll] replSet member 192.162.1.29:10002 is now in state DOWN
  219. Tue Nov 8 20:45:19 [rsMgr] replSet can't see a majority, will not try to elect self
  220. Tue Nov 8 20:45:19 [rsHealthPoll] replSet info 192.162.1.29:10003 is down (or slow to respond): socket exception
  221. Tue Nov 8 20:45:19 [rsHealthPoll] replSet member 192.162.1.29:10003 is now in state DOWN
  222. Tue Nov 8 20:45:34 [rsSync] waiting for 6 pings from other members before syncing
  223. Tue Nov 8 20:45:45 [initandlisten] connection accepted from 192.162.1.29:39967 #3
  224. Tue Nov 8 20:45:45 [conn3] authenticate: { authenticate: 1, nonce: "fedd49f05b5d622a", user: "__system", key: "e935b883e38f43df80ec4d2f0dc44203" }
  225. Tue Nov 8 20:45:49 [rsSync] waiting for 6 pings from other members before syncing
  226. Tue Nov 8 20:46:04 [rsSync] waiting for 6 pings from other members before syncing
  227. Tue Nov 8 20:46:19 [clientcursormon] mem (MB) res:32 virt:338 mapped:80
  228. Tue Nov 8 20:46:19 [rsSync] waiting for 6 pings from other members before syncing
  229. Tue Nov 8 20:46:32 [initandlisten] connection accepted from 127.0.0.1:59064 #4
  230. Tue Nov 8 20:46:32 [conn4] authenticate: { authenticate: 1.0, user: "admin", nonce: "5a933fe3ff7d0f19", key: "f5a9f4d430188708bc1bfc599ce0cfd8" }
  231. Tue Nov 8 20:46:34 [rsSync] waiting for 6 pings from other members before syncing
  232. Tue Nov 8 20:46:49 [rsSync] waiting for 6 pings from other members before syncing
  233. Tue Nov 8 20:47:04 [rsSync] waiting for 6 pings from other members before syncing
  234. Tue Nov 8 20:47:19 [clientcursormon] mem (MB) res:48 virt:419 mapped:160
  235. Tue Nov 8 20:47:19 [rsSync] waiting for 6 pings from other members before syncing
  236. Tue Nov 8 20:47:34 [rsSync] waiting for 6 pings from other members before syncing
  237.  
  238. Second Node Log [192.162.1.29]
  239. ==============================
  240.  
  241. Tue Nov 8 21:00:10 [initandlisten] MongoDB starting : pid=26348 port=10002 dbpath=/usr/db/shardrepl_sec_1 64-bit host=dev_bmapp
  242. Tue Nov 8 21:00:10 [initandlisten] db version v2.0.1, pdfile version 4.5
  243. Tue Nov 8 21:00:10 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
  244. Tue Nov 8 21:00:10 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
  245. Tue Nov 8 21:00:10 [initandlisten] options: { dbpath: "/usr/db/shardrepl_sec_1", keyFile: "/data/mongopwdkey/shardkey", nojournal: true, oplogSize: 50, port: 10002, replSet: "testdata1", rest: true, shardsvr:
  246.  
  247. true }
  248. Tue Nov 8 21:00:10 [initandlisten] waiting for connections on port 10002
  249. Tue Nov 8 21:00:10 [websvr] admin web console waiting for connections on port 11002
  250. Tue Nov 8 21:00:10 [rsStart] warning: getaddrinfo("localhost") failed: Name or service not known
  251. Tue Nov 8 21:00:10 [initandlisten] connection accepted from 127.0.0.1:49277 #1
  252. Tue Nov 8 21:00:10 [conn1] authenticate: { authenticate: 1, nonce: "d70feca6820c2618", user: "__system", key: "5a722a819e43d1d7d71732206c39bac8" }
  253. Tue Nov 8 21:00:10 [conn1] end connection 127.0.0.1:49277
  254. Tue Nov 8 21:00:10 [initandlisten] connection accepted from 127.0.0.1:49278 #2
  255. Tue Nov 8 21:00:10 [conn2] authenticate: { authenticate: 1, nonce: "ec42a3430be2cea3", user: "__system", key: "b2d06709594afb1a747784a2a98aee68" }
  256. Tue Nov 8 21:00:10 [rsStart] replSet STARTUP2
  257. Tue Nov 8 21:00:10 [rsMgr] replSet total number of votes is even - add arbiter or give one member an extra vote
  258. Tue Nov 8 21:00:10 [rsSync] replSet SECONDARY
  259. Tue Nov 8 21:00:10 [rsHealthPoll] replSet info member 192.162.1.29:10003 is up
  260. Tue Nov 8 21:00:10 [rsHealthPoll] replSet member 192.162.1.29:10003 is now in state STARTUP2
  261. Tue Nov 8 21:00:10 [rsHealthPoll] replSet info member 192.162.1.19:10001 is up
  262. Tue Nov 8 21:00:10 [rsHealthPoll] replSet member 192.162.1.19:10001 is now in state SECONDARY
  263. Tue Nov 8 21:00:10 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  264. Tue Nov 8 21:00:10 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  265. Tue Nov 8 21:00:11 [initandlisten] connection accepted from 192.162.1.29:45450 #3
  266. Tue Nov 8 21:00:11 [initandlisten] connection accepted from 192.168.1.19:56403 #4
  267. Tue Nov 8 21:00:16 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  268. Tue Nov 8 21:00:22 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  269. Tue Nov 8 21:00:26 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  270. Tue Nov 8 21:00:28 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  271. Tue Nov 8 21:00:34 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  272. Tue Nov 8 21:00:40 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  273. Tue Nov 8 21:00:41 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  274. Tue Nov 8 21:00:46 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  275. Tue Nov 8 21:00:52 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  276. Tue Nov 8 21:00:56 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  277. Tue Nov 8 21:00:58 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  278. Tue Nov 8 21:01:04 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  279. Tue Nov 8 21:01:10 [clientcursormon] mem (MB) res:32 virt:329 mapped:80
  280. Tue Nov 8 21:01:10 [rsMgr] not electing self, 192.162.1.29:10003 would veto
  281.  
  282. Arbitor Log [192.162.1.29]
  283. ========================
  284. Tue Nov 8 20:45:43 [initandlisten] MongoDB starting : pid=25602 port=10003 dbpath=/usr/db/shardrepl_arb_1 64-bit host=dev_bmapp
  285. Tue Nov 8 20:45:43 [initandlisten] db version v2.0.1, pdfile version 4.5
  286. Tue Nov 8 20:45:43 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
  287. Tue Nov 8 20:45:43 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
  288. Tue Nov 8 20:45:43 [initandlisten] options: { dbpath: "/usr/db/shardrepl_arb_1", keyFile: "/data/mongopwdkey/shardkey", nojournal: true, oplogSize: 10, port: 10003, replSet: "testdata1", rest: true, shardsvr:
  289.  
  290. true }
  291. Tue Nov 8 20:45:43 [initandlisten] waiting for connections on port 10003
  292. Tue Nov 8 20:45:43 [websvr] admin web console waiting for connections on port 11003
  293. Tue Nov 8 20:45:43 [rsStart] warning: getaddrinfo("localhost") failed: Name or service not known
  294. Tue Nov 8 20:45:43 [initandlisten] connection accepted from 127.0.0.1:35243 #1
  295. Tue Nov 8 20:45:43 [conn1] authenticate: { authenticate: 1, nonce: "58de2a6831f1e8d9", user: "__system", key: "6a91a713f03914981bf02291ed2be857" }
  296. Tue Nov 8 20:45:43 [conn1] end connection 127.0.0.1:35243
  297. Tue Nov 8 20:45:43 [initandlisten] connection accepted from 127.0.0.1:35244 #2
  298. Tue Nov 8 20:45:43 [conn2] authenticate: { authenticate: 1, nonce: "5b004a2a3b5dc6aa", user: "__system", key: "6b558e1b9f108f1b0ddfa2186d037fd7" }
  299. Tue Nov 8 20:45:43 [rsStart] replSet STARTUP2
  300. Tue Nov 8 20:45:43 [rsMgr] replSet total number of votes is even - add arbiter or give one member an extra vote
  301. Tue Nov 8 20:45:43 [rsHealthPoll] couldn't connect to 192.162.1.29:10002: couldn't connect to server 192.162.1.29:10002
  302. Tue Nov 8 20:45:43 [rsHealthPoll] replSet info 192.162.1.29:10002 is down (or slow to respond): socket exception
  303. Tue Nov 8 20:45:43 [rsHealthPoll] replSet member 192.162.1.29:10002 is now in state DOWN
  304. Tue Nov 8 20:45:43 [initandlisten] connection accepted from 192.168.1.19:58278 #3
  305. Tue Nov 8 20:45:45 [rsHealthPoll] replSet info member 192.162.1.19:10001 is up
  306. Tue Nov 8 20:45:45 [rsHealthPoll] replSet member 192.162.1.19:10001 is now in state SECONDARY
  307. Tue Nov 8 20:46:43 [clientcursormon] mem (MB) res:32 virt:254 mapped:80
  308. Tue Nov 8 20:51:43 [clientcursormon] mem (MB) res:32 virt:254 mapped:80
  309. Tue Nov 8 20:56:43 [clientcursormon] mem (MB) res:32 virt:254 mapped:80
  310. Tue Nov 8 21:00:10 [initandlisten] connection accepted from 192.162.1.29:51209 #4
  311. Tue Nov 8 21:00:10 [conn4] authenticate: { authenticate: 1, nonce: "645eb986e2df4ea6", user: "__system", key: "11937268ef824799913b556c48cbd146" }
  312. Tue Nov 8 21:01:43 [clientcursormon] mem (MB) res:32 virt:255 mapped:80
  313. Tue Nov 8 21:02:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  314. Tue Nov 8 21:07:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  315. Tue Nov 8 21:12:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  316. Tue Nov 8 21:17:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  317. Tue Nov 8 21:22:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  318. Tue Nov 8 21:27:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  319. Tue Nov 8 21:32:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  320. Tue Nov 8 21:37:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  321. Tue Nov 8 21:42:43 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  322. Tue Nov 8 21:47:44 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  323. Tue Nov 8 21:52:44 [clientcursormon] mem (MB) res:32 virt:319 mapped:80
  324. "/tmp/shardrepl_arb_1.txt" 249L, 18928C
Add Comment
Please, Sign In to add comment