How to build a production mongodb by self?


#1

Are there any good guide on how to make a production mongodb server?

we have multiple meteor app that might use 1 or mutiple mongodb but share some collection.

Any good tips ?


#2

Mongo Installation for Ubuntu w/Replica Set Configuration


#3

thank you watson ~
thank you watson ~
thank you watson ~


#4

:slight_smile:

Glad I could help!

One favor, if I can ask it: if you set up the entire replica set, and get to the rs.slaveOk() command, you’ll find that syntax is from the Mongo <2.4 driver and has been deprecated. If you could post or submit a PR with the current syntax, that would be great.


#5

Hey @awatson1978 thanks for your help, and after reading your cookbook and then i’ve found a script can setup replica set, but i can’t get oplog to work.

cookbook
replica set script
i’ve followed oplog official readme

osx 10.10.3
meteor 1.0.4
mongodb 3.0.2

terminal 1

export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; meteor --port 5000;

terminal 2

export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; subl .; meteor run android-device --mobile-server=http://192.168.0.201:3000;

But it seems terminal 2(“the mobile app”) doesn’t use same db as normal.

it doesn’t work.


#6

Hi!
Well, at a glance, I’d say that the port 3000 and 5000 need to match in the second terminal, like so:

export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; subl .; meteor run android-device --mobile-server=http://192.168.0.201:5000;
```

#7

I use MMS: https://mms.mongodb.com/


#8

i’ve messed up my post.
let me try to explain.

service1 is a meteor instance that run as mobile app server it use normal 3000 port on same server and it has “Clients collection”.
service2 is a meteor iot server that run mosca mqtt broker it start as 5000 port and use same db as service1. it has “Clients collection” too.

for now if i use one server and put all 2 app stuffs in one server all db reactive are fine.
but i want to run my app as multiple services but use same db. and some collection can still reactive.


#9

Ah. I think you need three terminals then. meteor run android-device --mobile-server doesn’t launch a meteor server; it only spins up the phonegap emulator, right? So you need to run the iot server, then run the mobile app server, then run the phonegap emulator and connect it to the mobile app server.


terminal 1

export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; meteor --port 5000;
```

terminal 2

```
export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; meteor --port 3000;
```
terminal 3

```
export MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@localhost:27017/testdb01; subl .; meteor run android-device --mobile-server=http://192.168.0.201:3000;
```

#10

lol we can’t use a blocked services, because we’re behind the Great Firewall!


#11

i’ve try to use internal mongodb with "service1"
and pass mongo_url to mongodb://localhost:3001/meteor; meteor --port 5000
and reactive works, but take to long too responding observeChanges.

terminal1
mobile app use normal port and mongodb should be on 3001 port

meteor

terminal2

export MONGO_URL=mongodb://localhost:3001/meteor; meteor --port 5000