Thermostat/MongoStatSetup

From IcedTea

Jump to: navigation, search

Here are the steps to get a user set up in mongodb which is allowed to run mongostat for the latest Thermostat.

$ ./distribution/target/image/bin/thermostat storage --start --permitLocalhostException 
$ mongo 127.0.0.1:27518/thermostat
mongo> use admin
mongo> db.auth("thermostat-admin", "mongodevpassword")
mongo> db.grantRolesToUser("thermostat-admin",[{role:"clusterMonitor",db:"admin"}])
mongo> quit()
$ ./distribution/target/image/bin/thermostat storage --stop
$ ./distribution/target/image/bin/thermostat web-storage-service
$ mongostat -u thermostat-admin -p mongodevpassword --authenticationDatabase admin --host 127.0.0.1:27518



Here are two useful scripts to do the above quickly:

Place them both in the thermostat bin folder and run:

$ ./mongostat-setup.sh


mongostat-setup.sh

#!/bin/bash

./thermostat storage --start --permitLocalhostException
mongo 127.0.0.1:27518/thermostat mongostat-setup.js
./thermostat storage --stop

mongostat-setup.js

conn = new Mongo("127.0.0.1:27518")
db = conn.getDB("thermostat")
db = db.getSiblingDB("admin")
db.auth("thermostat-admin", "mongodevpassword")
db.grantRolesToUser("thermostat-admin",[{role:"clusterMonitor",db:"admin"}])
quit()
Personal tools