Created
September 27, 2017 12:04
-
-
Save freyes/d62db77be1b9fff3ef5f3b91bcd18474 to your computer and use it in GitHub Desktop.
reconfigure mongodb to a single node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > rs.status() | |
| { | |
| "startupStatus" : 1, | |
| "ok" : 0, | |
| "errmsg" : "loading local.system.replset config (LOADINGCONFIG)" | |
| } | |
| > rs.config() | |
| { | |
| "_id" : "juju", | |
| "version" : 109633, | |
| "members" : [ | |
| { | |
| "_id" : 0, | |
| "host" : "192.168.1.10:37017" | |
| }, | |
| { | |
| "_id" : 1, | |
| "host" : "192.168.1.11:37017" | |
| } | |
| ] | |
| } | |
| > var cfg = rs.config() | |
| > cfg.members = [{"_id" : 3, "host" : "192.168.1.11:37017"}] | |
| [ { "_id" : 3, "host" : "192.168.1.11:37017" } ] | |
| > rs.reconfig(cfg , {force : true}) | |
| { | |
| "msg" : "will try this config momentarily, try running rs.conf() again in a few seconds", | |
| "ok" : 1 | |
| } | |
| > rs.conf() | |
| { | |
| "_id" : "juju", | |
| "version" : 109633, | |
| "members" : [ | |
| { | |
| "_id" : 3, | |
| "host" : "192.168.1.11:37017" | |
| } | |
| ] | |
| } | |
| $ sudo service juju-db restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment