Quantcast
Channel: Łukasz Gozda Gandecki
Viewing all articles
Browse latest Browse all 10

Moving your db from meteor.com to your own replica set, with oplog

$
0
0

Step by step instruction to move your database from free meteor.com hosting to your own already deploy replica set, with oplog enabled.

Run

 meteor mongo --url <your_app_domain>

To get your temporary db information.

Dump your data with:

mongodump -u <client> -h <host> -d <application_name> -p <password>

Now, we should delete the dump for the system.users collection. This is meteor.com specific, we won’t need this, and it will probably cause your import to trip over, causing only partial restore.

 rm dump/<application_name>/system.users.* 

Finally, restore it to your new replica set:

mongorestore --db <yourdb> -h <your_first_server_ip> --port 27017 --username <yourDBAdmin> --password <password> dump/<your_dumped_application_name>

Now, to set up oplog. Log in to your mongo, and add an oplogger user, that will allow meteor to read from the oplog.

mongo
use admin;
db.createUser(
 {
 user: "oplogger",
 pwd: "<password>",
 roles:
 [
 {
 role: "read",
 db: "local"
 }
 ]
 }
)
db.runCommand({ createRole: "oplogger", privileges: [   { resource: { db: 'local', collection: 'system.replset'}, actions: ['find']}, ], roles: [{role: 'read', db: 'local'}] })
db.runCommand({ grantRolesToUser: 'oplogger', roles: ['oplogger']})


That’s it. Your db environment constant should look like that:

export MONGO_URL=mongodb://<username>:<password>@<first_db_ip>:<first_db_port>,<second_db_ip>:<second_db_port>/<yourDb>
export MONGO_OPLOG_URL=mongodb://oplogger:<oploggerPassword>@<first_db_ip>:<first_db_port>/local?authSource=admin

 


Viewing all articles
Browse latest Browse all 10

Trending Articles