Skip to content

Instantly share code, notes, and snippets.

@reedobrien
Forked from niedbalski/mongo.sh
Created July 13, 2016 03:10
Show Gist options
  • Save reedobrien/7190dc91669be226e86300e365537910 to your computer and use it in GitHub Desktop.
Save reedobrien/7190dc91669be226e86300e365537910 to your computer and use it in GitHub Desktop.
Connect to Juju Mongodb
$ juju ssh 0
machine-0# sudo apt-get install mongodb-clients
machine-0# mongo --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
MongoDB shell version: 2.4.9
connecting to: localhost:37017/admin
juju:PRIMARY> db = db.getSiblingDB("juju")
juju
juju:PRIMARY> db.machines.update({'_id': "32"}, {$set:{'addresses.0.value':'172.24.0.58'}})
juju:PRIMARY> db.machines.update({'_id': "32"}, {$set:{'addresses.1.value':'192.168.128.58'}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment