52
MMS – Using MMS to Build New Environments MMS Technical Account Manager, MongoDB Peter C. Gravelle @mongodb

Using MMS to Build New Environments

  • Upload
    mongodb

  • View
    5.095

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Using MMS to Build New Environments

MMS – Using MMS to Build New Environments

MMS Technical Account Manager, MongoDB

Peter C. Gravelle

@mongodb

Page 2: Using MMS to Build New Environments

What you are going to get out of today’s talk

A. What is MMSA. MonitoringB. Backup

B. What you can do with MMS BackupA. Spin up secondaries with minimal impact on

your primaryB. Build a sandbox for development or analytics to

play in

Page 3: Using MMS to Build New Environments

What is MMS?

Page 4: Using MMS to Build New Environments

MMS

MongoDB Management System

Page 5: Using MMS to Build New Environments

What can I do?

Page 6: Using MMS to Build New Environments

Two Deployment Models

Using MongoDB Servers: cloud version

Using my servers: on-premise

Page 7: Using MMS to Build New Environments

Monitoring

Page 8: Using MMS to Build New Environments

What does MMS Monitoring give you?

• Server metrics

• Activity feed

• Alerts

• Hardware stats (optional)

• User management

• Logs and profiling data

Page 9: Using MMS to Build New Environments

Server Metrics

Page 10: Using MMS to Build New Environments

Cluster View

Page 11: Using MMS to Build New Environments

Activity Feed

Page 12: Using MMS to Build New Environments

Alerts

Page 13: Using MMS to Build New Environments

Logs and Profile data

Page 14: Using MMS to Build New Environments

Hardware stats (CPU, disk)

Page 15: Using MMS to Build New Environments

DB Stats

Page 16: Using MMS to Build New Environments

User Management

Page 17: Using MMS to Build New Environments

MMS Monitoring Setup

Page 18: Using MMS to Build New Environments

Cloud Version

1. Go to http://mms.mongodb.com

2. Create an account

3. Install one agent in your datacenter

4. Add hosts from the web interface

5. Enjoy!

Page 19: Using MMS to Build New Environments

Backups

Page 20: Using MMS to Build New Environments

MMS Backup

• Backup a replica set or sharded cluster

• Initial sync + incremental

• Generated snapshots every 6 hs

• Restore via HTTPS or SCP

• Restore replica sets to point-in-time (last 24hs)

• Restore sharded clusters to any 15 minute (last 24hs)

Page 21: Using MMS to Build New Environments

Picking a snapshot to restore

Page 22: Using MMS to Build New Environments

MMS Backup Setup

Page 23: Using MMS to Build New Environments

Cloud Version - Billing

• 12-months pre-paid:

• $50 / GB / year• 6-hour interval snapshot stored for two days• Weekly snapshots stored for 1 month• Monthly snapshots stored for 1 year• Payment method: invoiced

Page 24: Using MMS to Build New Environments

Cloud Version - Billing

• Pay as you go

• Oplog processing: $1 / GB / month• Snapshot storage: $0.08 / GB / month• Customer defines snapshot frequency and

retention policy• Payment method: online

Page 25: Using MMS to Build New Environments

What kind of environments can you create with MMS Backup?

Page 26: Using MMS to Build New Environments

What kind of environments can you create?

• Spin up a new secondary quicker at minimal additional load

• Build a sandbox for analytics or developers

Page 27: Using MMS to Build New Environments

Spin up a secondary quickly

Page 28: Using MMS to Build New Environments

Using Backup Snapshots to Spin Up Secondaries

Spinning up secondaries can take a long time if the data size is large.

You can make your own data file snapshots by taking down a secondary and copying it off.

But why? MMS Backup has your data files already!

Page 29: Using MMS to Build New Environments

Spinning up secondary overview

1. Prepare your new environment

2. Get your restore files

3. Extract the restores

4. Make it a secondary

Page 30: Using MMS to Build New Environments

Preparing to spin up the secondary

Make sure you have room for your snapshot

Page 31: Using MMS to Build New Environments

More preparation

Ensure that you have enough oplog window to prevent an initial sync. Remember you have to download the snapshot and startup a mongod process.

Page 32: Using MMS to Build New Environments

Spinning up secondary overview

1. Prepare your new environment

2. Get your restore files

3. Extract the restores

4. Make it a secondary

Page 33: Using MMS to Build New Environments

Start the download

Choose HTTPS or SCP

Page 34: Using MMS to Build New Environments

Spinning up secondary overview

1. Prepare your new environment

2. Get your restore files

3. Extract the restores

4. Make it a secondary

Page 35: Using MMS to Build New Environments

Extract Image and Start mongod

tar –xvf backup-restore-file-name.tar.gz

mv backup-restore-file-name data

mongod --port PORT --dbpath data --logpath=data/monogdb.log

This brings up your data in a standalone.

Page 36: Using MMS to Build New Environments

Spinning up secondary overview

1. Prepare your new environment

2. Get your restore files

3. Extract the restores

4. Make it a secondary

Page 37: Using MMS to Build New Environments

Seed the standalone as a secondary

Run seedSecondary.sh with its appropriate options to create the oplog collection with the correct timestamp.

Shut down the mongod process when this is complete

Page 38: Using MMS to Build New Environments

Start up the secondary with the seeded oplog

mongod --port=PORT --dbpath=data --logpath=data/mongodb.log --

replSet=REPLICASETNAME

This PORT can be different than the other mongod process you started. The REPLICASETNAME should be the same as the name of the replica set that you will be connecting it back to.

Page 39: Using MMS to Build New Environments

Connect the new secondary

On the primary, connect a mongo shell and run:

rs.add(“NEWSECONDARY:PORT”)

Where NEWSECONDARY is the hostname of the secondary you just spun up, and PORT is the port defined in the previous examples.

Now, just wait for rs.status() for the NEWSECONDARY to report that it’s in status SECONDARY. (Or check MMS!)

Page 40: Using MMS to Build New Environments

Lets build a sandbox!

Page 41: Using MMS to Build New Environments

Analytics, am I right?!

The analytics people can be a bane to ops. Why?

• They want to do big queries

• They want to do slow queries

• Their queries are just infrequent enough to not justify building indexes for them

• Never mind the performance penalty for each index

Page 42: Using MMS to Build New Environments

Developers, Developers, Developers!

They also want to disrupt your nicely running system

• Try new schemas

• Change application server behavior

• Stress test things

Page 43: Using MMS to Build New Environments

So build them a sandbox!

They can have their own (non-customer-impacting) DB off of your most recent snapshot.

• Keeps them off the production servers

• Lets them process the data as they wish

• New collections with generated data• Lets them try new methods and

applications

Page 44: Using MMS to Build New Environments

How to build a sandbox

1. Get your restore files

2. Extract them

3. Set up sharding

Page 45: Using MMS to Build New Environments

Get your Restore files

The same rules apply:

• Make sure you have the space

• Choose push or pull (SCP/HTTPS)

• Pick the snapshot you want

• Wait for the download to complete

Page 46: Using MMS to Build New Environments

How to build a sandbox

1. Get your restore files

2. Extract them

3. Set up sharding

Page 47: Using MMS to Build New Environments

Extract your snapshot

tar –xvf backup-restore-file-name.tar.gz

mv backup-restore-file-name data

mongod --port PORT --dbpath data --logpath=data/monogdb.log

This brings up your data in a standalone. You can stop here (unless you’re sharding).

Page 48: Using MMS to Build New Environments

How to build a sandbox

1. Get your restore files

2. Extract them

3. Set up sharding

Page 49: Using MMS to Build New Environments

Sharding Step 1

Bring up the config server

tar –xvf backup-restore-file-name.tar.gz

mv backup-restore-file-name data

mongod --port=CONFIGSRVRPORT --dbpath=data

--logpath=data/mongodb.log --configsvr=true

Page 50: Using MMS to Build New Environments

Sharding step 2

Update the shard metadata: Remember, you have a new environment here, new hosts & ports!

mongo --port=CONFIGSRVRPORT

use config

db.shards.find().pretty()

Repeat if you’re setting up multiple config servers, but this is not necessary for this non-production environment.

Remember, this only tells you what you need to update!

Page 51: Using MMS to Build New Environments

What you got out of today’s talk

A. What is MMSA. MonitoringB. Backup

B. What you can do with MMS BackupA. Spin up secondaries with minimal impact on

your primaryB. Build a sandbox for development or analytics to

play in

Page 52: Using MMS to Build New Environments

Thank You

MMS Technical Account Manager, MongoDB

Peter C. Gravelle

@mongodb