I installed MongoDB in an Ubuntu Server VM inside VMware using these instructions: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/. Everything works fine, and I can access MongoDB at the regular port 27017
./mongo 172.16.150.131:27017
Now, I want to make a dummy replica set and another db instance for testing my app. I'm used to doing the following commands in four separate terminals on my local computer:
./mongod --port 27027 --dbpath ~/mongodb/solo
./mongod --port 27028 --dbpath ~/mongodb/rs0-0 --replSet rs0
./mongod --port 27029 --dbpath ~/mongodb/rs0-1 --replSet rs0
./mongod --port 27030 --dbpath ~/mongodb/rs0-2 --replSet rs0
How can I do this in the VM? I SSH into my VM, and after running the commands and closing my terminals (in OS X), they should still be running.
I tried:
service mongodb --port 27027 --dbpath ~/mongodb/solo
service mongodb ~/mongodb/solo/mongodb.conf
But both get the following error (with different contexts):
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mongodb --config=~/mongodb/solo/mongodb.conf
The script you are attempting to invoke has been converted to an Upstart
job, but --config=~/mongodb/solo/mongodb.conf is not supported for Upstart jobs.
How do I get this working? First time working with Ubuntu as a server. Thanks.
Context - goal is to create my db in a VM to create some sort of lag while testing my app, but mostly so I can just suspend the VM instead of copying and pasting scripts into different terminals to setup MongoDB whenever I restart my laptop.