{"id":6622,"date":"2018-02-01T12:34:06","date_gmt":"2018-02-01T17:34:06","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=6622"},"modified":"2018-02-01T12:34:06","modified_gmt":"2018-02-01T17:34:06","slug":"running-admin-commands-on-secondary-mongodb-server","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2018\/02\/01\/running-admin-commands-on-secondary-mongodb-server\/","title":{"rendered":"Running admin commands on secondary mongodb server"},"content":{"rendered":"<p>You have to let your session know that reading this information from a non-primary server is OK (literally)&#8230;<\/p>\n<pre>\r\n-bash-4.1$ mongo\r\nrs1:SECONDARY> show dbs\r\n2018-02-01T10:37:58.457-0500 E QUERY    [thread1] Error: listDatabases failed:{\r\n        \"operationTime\" : Timestamp(1517499476, 1),\r\n        \"ok\" : 0,\r\n        \"errmsg\" : \"not master and slaveOk=false\",\r\n        \"code\" : 13435,\r\n        \"codeName\" : \"NotMasterNoSlaveOk\",\r\n        \"$clusterTime\" : {\r\n                \"clusterTime\" : Timestamp(1517499476, 1),\r\n                \"signature\" : {\r\n                        \"hash\" : BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\"),\r\n                        \"keyId\" : NumberLong(0)\r\n                }\r\n        }\r\n} :\r\n_getErrorWithCode@src\/mongo\/shell\/utils.js:25:13\r\nMongo.prototype.getDBs@src\/mongo\/shell\/mongo.js:65:1\r\nshellHelper.show@src\/mongo\/shell\/utils.js:813:19\r\nshellHelper@src\/mongo\/shell\/utils.js:703:15\r\n@(shellhelp2):1:1\r\nrs1:SECONDARY> rs.slaveOk()\r\nrs1:SECONDARY> show dbs\r\nadmin             0.000GB\r\nconfig            0.000GB\r\nlocal             0.001GB\r\nmongoengine_test  0.004GB\r\nrs1:SECONDARY>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You have to let your session know that reading this information from a non-primary server is OK (literally)&#8230; -bash-4.1$ mongo rs1:SECONDARY> show dbs 2018-02-01T10:37:58.457-0500 E QUERY [thread1] Error: listDatabases failed:{ &#8220;operationTime&#8221; : Timestamp(1517499476, 1), &#8220;ok&#8221; : 0, &#8220;errmsg&#8221; : &#8220;not&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2018\/02\/01\/running-admin-commands-on-secondary-mongodb-server\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,94],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6622"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=6622"}],"version-history":[{"count":1,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6622\/revisions"}],"predecessor-version":[{"id":6624,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6622\/revisions\/6624"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=6622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=6622"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=6622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}