Difference between revisions of "Mongodb"

From Wiki2
Line 1: Line 1:
===replica set===
I'd like to configure replica set for development so I can use mongod on my laptop when the internet is not available and use a server hosted mongod when the internet is available.
so far...
*you need three instances so I've added a third on another host
*rs.add(host) happens on the primary, my laptop has no known url so it needs to be the primary
*before I go offline I need to run mongod on the laptop
*when I have internet, I kill mongod on the laptop causing the serverhosted db to take over as primary (by making the other secondary decline the honor)
*when the laptop mongod comes back up it takes control and gets the current data.
* rinse repeat
===mongoskin===
===mongoskin===
[http://www.hacksparrow.com/mongoskin-tutorial-with-examples.html tutorial]
[http://www.hacksparrow.com/mongoskin-tutorial-with-examples.html tutorial]

Revision as of 14:03, 1 October 2014

replica set

I'd like to configure replica set for development so I can use mongod on my laptop when the internet is not available and use a server hosted mongod when the internet is available.

so far...

  • you need three instances so I've added a third on another host
  • rs.add(host) happens on the primary, my laptop has no known url so it needs to be the primary
  • before I go offline I need to run mongod on the laptop
  • when I have internet, I kill mongod on the laptop causing the serverhosted db to take over as primary (by making the other secondary decline the honor)
  • when the laptop mongod comes back up it takes control and gets the current data.
  • rinse repeat


mongoskin

tutorial

basic mongo

mongo meteor

sudo ps -x |grep mongo
2251 pts/2    Sl+    0:00 /home/tim/.meteor/tools/09b63f1ed5/mongodb/bin/mongod --bind_ip 127.0.0.1:3002 
--dbpath /var/www/fworks/meteor/stuff2get/.meteor/local/db --oplogSize 8 --replSet meteor 
mongo --port 3002


from https://www.openshift.com/blogs/day-15-meteor-building-a-web-app-from-scratch-in-meteor

where is mongo?

   tim@TIM-HP ~
   $ mongo
   MongoDB shell version: 2.4.8
   connecting to: test
   > show dbs
   angular-directory-db    0.203125GB
   local   0.078125GB
   test    0.203125GB
   > use angular-directory-db
   switched to db angular-directory-db
   > show collections
   employees
   system.indexes
   > db.employees.find().pretty()

installing-mongodb-on-windows-the-wamp-way

on parleyV12

https://www.digitalocean.com/community/articles/how-to-install-mongodb-on-ubuntu-12-04

sudo service mongodb start

The MongoDB instance stores its data files in the /var/lib/mongodb and its log files in /var/log/mongodb/mongodb.log

on ubuntu lucid