Upload
severalnines
View
365
Download
3
Embed Size (px)
Citation preview
Confidential
Become a MongoDB DBA
If you’re really a MySQL user
Art van Scheppingen, Senior Support Engineer
Confidential
Logistics
☐ Webinar is recorded☐ Replay available soon☐ Feel free to ask questions at any time☐ Use your control panel to contact us☐ Or email us as well: [email protected]
Confidential
Agenda
☐ Introduction to becoming a MongoDB DBA☐ Installing & configuring MongoDB☐ What to monitor and how☐ How to perform backups☐ Live Demo
Confidential
Introduction to becoming a MongoDB DBA
Confidential
MongoDB: why should I install it?
☐ Not everyone is happy with (My)SQL☐ Some storage needs differ from what (My)SQL can offer☐ Complex problems require different storage systems
☐ Alternative data storage☐ Polyglot persistence
Confidential
Polyglot Persistence?
Does a carpenter only use one tool?
Confidential
Polyglot Persistence?
Carpenters use many tools
Confidential
Monoglot Persistence
Confidential
Polyglot Persistence
Confidential
How different is MongoDB from MySQL?
☐ Document store (JSON)☐ Flexible schemas☐ Out of the box scaling☐ Out of the box sharding☐ Enthusiastic development community
Confidential
Eventual consistency
Confidential
How similar (ops) is MongoDB to MySQL?
☐ You still need to do the database basics☐ Deployment☐ Management☐ Monitoring☐ Backups☐ Scaling/Sharding
☐ It is less different than you think!
Confidential
Deploying MongoDB
Confidential
Install MongoDB
☐ Install MongoDB ☐ Download packages☐ Set up repositories
☐ Watch log file☐ /var/log/mongodb/mongod.log
[initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 },
Confidential
Configure MongoDB
☐ Security☐ Authentication☐ Disable REST☐ Disable HTTP☐ Enable SSL
☐ Performance☐ Oplog☐ Cache
Confidential
Configure MongoDB
☐ MongoDB Configuration file is in YAMLnet: port: 27017 bindIp: 172.16.0.11 # Listen to local interface only, comment to listen on all interfaces. ssl: mode: requireSSL PEMKeyFile: /etc/ssl/mongodb.pem http: enabled: false RESTInterfaceEnabled: falsesecurity: authorization=true
☐ Restart mongod
Confidential
Install a second node
☐ Install packages☐ Change configuration
Confidential
Install a third node
☐ Install packages☐ Change configuration☐ This is getting boring...
Confidential
Automation
Confidential
Deployment Automation
☐ Deployment automation tools☐ Chef☐ Puppet☐ Ansible☐ Saltstack
Confidential
Chef
☐ Use mongodb3 cookbook☐ https://supermarket.chef.io/cookbooks/mongodb3☐ Others are not well maintained
☐ Handles configuration☐ Supports AWS☐ Supports replication and sharding☐ Supports mms_automation_agent
Confidential
Puppet
☐ Puppetlabs MongoDB module☐ https://github.com/puppetlabs/puppetlabs-mongodb☐ Still in beta: may change in the future☐ Well documented
☐ Handles☐ Installation☐ Configuration☐ Replication & sharding☐ Crude user management (admin user)
Confidential
Ansible
☐ Ansible MongoDB example☐ https://github.com/ansible/ansible-examples/tree/master/mongodb
☐ Installs a sharded MongoDB cluster☐ Expects RHEL/Centos 6 hosts☐ Covers only one use case
☐ You can alter a playbook, right?
Confidential
Ansible (cont.)
☐ Stouts.mongo Ansible role☐ https://github.com/Stouts/Stouts.mongodb
☐ Handles☐ Installation☐ Configuration☐ Replication
☐ Supports mms_automation_agent
Confidential
Saltstack
☐ MongoDB Formula☐ https://github.com/saltstack-formulas/mongodb-formula
☐ Handles☐ Installation☐ Configuration☐ Replication & Sharding
Confidential
Monitoring & Trending
Confidential
Confidential
Monitoring vs Trending
☐ Monitoring☐ Keeps an eye on your systems☐ Will alert if a threshold is met
☐ Trending☐ Insight into the system internals☐ Trends can warn you before anything has happened yet☐ Keep historical state/data
Confidential
Monitoring: Availability
☐ Do more than just opening a connection☐ Measure true status of nodes and cluster☐ Test read/write☐ Open essential databases and collections☐ Check the full topology☐ Keep an eye on the replication lag☐ Increase oplog size?
Confidential
Why you need to check the replication
Confidential
Monitoring Tools
☐ Open Source☐ Nagios☐ Zabbix
☐ Subscription based☐ MongoDB Cloud Manager☐ VividCortex☐ ClusterControl
Confidential
Nagios
☐ Nagios-MongoDB☐ https://github.com/mzupan/nagios-plugin-mongodb/☐ Performs some very important checks☐ Replication lag☐ Lock time percentage☐ Index miss ratio
Confidential
Zabbix
☐ MongoDB Zabbix monitoring plugin☐ https://github.com/nightw/mikoomi-zabbix-mongodb-monitoring☐ All the necessary metrics and more☐ Entries in oplog
☐ Pre-canned triggers
Confidential
Trending: Why do we need trends?
☐ Trending☐ Plot trends of key (performance) metrics☐ Find problems before they arise☐ Pre-emptive problem management
☐ Trending tools☐ Granularity of sampling☐ More datapoints = better
Confidential
Trending: What metrics to store?
☐ Resource monitoring☐ CPU☐ Memory☐ IO capacity☐ Diskspace
☐ Replication monitoring☐ Replication status☐ Replication lag☐ Oplog size and usage
Confidential
Trending: Solutions
☐ Trending tools☐ Statsd/Grafana☐ Cacti☐ Zabbix
☐ Subscription based☐ MongoDB Cloud Manager☐ VividCortex☐ ClusterControl
Confidential
Cacti
☐ Percona MongoDB Monitoring Templates☐ https://www.percona.com/doc/percona-monitoring-plugins/1.
1/cacti/mongodb-templates.html
Confidential
Cacti
Confidential
Backups
Confidential
Types of backups
☐ Logical backups☐ Dump of your data
☐ Physical backups☐ File(system) copy of your data
Confidential
Logical backups
☐ Mongodump☐ MongoDB Backup☐ Mongob
Confidential
Logical backups: mongodump
☐ Mongodump☐ BSON dump of the data☐ OEM tool☐ Works great but needs some wrapping
Confidential
Logical backups: MongoDB Backup
☐ MongoDB Backup☐ https://www.npmjs.com/package/mongodb-backup☐ Nodejs backup solution☐ CLI and API☐ Can stream backups
Confidential
Logical backups: Mongob
☐ Mongob☐ https://github.com/cmpitg/mongob☐ Python based CLI tool☐ MongoDB instance or bz2 target☐ Can copy data between collections☐ Incremental backups☐ Rate limiting
Confidential
Physical backups: Filesystem snapshots
☐ Filesystem snapshots☐ LVM☐ ZFS☐ XFS (xfs_freeze)☐ EBS
Confidential
Physical backups: Strata
☐ MongoRocks Strata☐ https://github.com/facebookgo/rocks-strata☐ Backs up on file level☐ Supports incremental backups☐ Queryable backups
Confidential
Backup Management
☐ Zmanada☐ https://github.com/matthewparsons/ammongodb☐ Supports mongodump and filesystem snapshots
Confidential
ClusterControl: live demo
Confidential
Orchestration System: ClusterControl
☐ ClusterControl☐ Deploy☐ Monitor☐ Manage☐ Scale
Confidential
Demo
Confidential
Q & A
Confidential
Thank you!
☐ Severalnines Blog☐ www.severalnines.com/blog-categories/mongodb
☐ ClusterControl ☐ www.severalnines.com/product/clustercontrol
☐ Contact: [email protected]