webinar - manage mongodb with puppet

23
OlinData Webinar 2015 - https://docs.google.com/presentation/d/ 1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing Manage MongoDB (NoSQL) with Puppet Configuration management with puppet

Upload: olindata

Post on 05-Aug-2015

241 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Manage MongoDB (NoSQL) with Puppet

Configuration management with puppet

Page 2: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Who am I?

• Krishna Prajapati, Systems Engineer at Olindata

http://www.olindata.com/

Page 3: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Overview• What is puppet (for those not aware)?• What is MongoDB?• Puppet Module selection for Mongodb• Search and Install puppet module• MongoDB client• Deploying MongoDB Server• MongoDB Management: global, database, user, replicaset etc• Questions

Page 4: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

What is Puppet and why do we care?• Configuration management software- http://www.olindata.com/blog/2014/08/puppet-master-agent-setup- http://olindata.com/blog/2015/03/setup-puppet-server-centos-70

• Scales very well (from 1 to 200k+ nodes)• Multi-platform (windows, *nix, Mac OS, BSD)• Commercially supported Open Source• Infrastructure as code

Page 5: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

What is MongoDB ?• MongoDB is a document oriented database. • MongoDB was the most popular NoSQL database system• Opensource• Multi-platform (windows, *nix, Mac OS, Solaris)• Component of the widely used LAMP

Page 6: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

1. Puppet forge https://forge.puppetlabs.com/2. Puppetlabs modules. https://forge.puppetlabs.com/puppetlabs/mongodb3. Supported modules. https://forge.puppetlabs.com/supported

Puppet Module selection?

Page 7: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Install puppet moduleroot@monit:/etc/puppet# puppet module search mongodbNotice: Searching https://forgeapi.puppetlabs.com ...NAME DESCRIPTION AUTHOR KEYWORDS thias-mongodb MongoDB simple module @thias nosql mongodb dwerder-mongodb MongoDB module with sharding @dwerder debian ubuntu rhel nosql

mongodb puppetlabs-mongodb Installs MongoDB on RHEL/Ubuntu/Debian. @puppetlabs cluster nosql mongodb mongo

example42-mongodb Puppet module for mongodb @example42 example42 mongo synyx-mongodb Puppet module to install and manage mongodb from 10gen repo @synyx

…. …. SillentTroll-mongodbmms MongoDB MMS monitoring installation on Ubuntu @SillentTroll mongodb mms

SchnWalter-happydev Setup a Development Environment @SchnWalter mysql php mongodb

linux drush lamp hairmare-hairmareyumrepo Setup the yum.hairmare.ch package repo @hairmare mongodb yum centos

severalnines-clustercontrol Installs ClusterControl on your existing database cluster. @severalnines mysql mongodb

galera pxc dbaas root@monit:/etc/puppet#

Page 8: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Install mongodb puppet moduleroot@monit:/etc/puppet# puppet module install puppetlabs-

mongodbNotice: Preparing to install into /etc/puppet/modules/common ...Notice: Downloading from https://forgeapi.puppetlabs.com ...Notice: Installing -- do not interrupt .../etc/puppet/modules/common└─ ┬ puppetlabs-mongodb (v0.10.0) └─ ┬ puppetlabs-apt (v1.8.0) └── puppetlabs-stdlib (v4.5.1)root@monit:/etc/puppet#

Page 9: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

List Puppet Modulesroot@monit:/etc/puppet# puppet module list/etc/puppet/modules/common

── ├ puppetlabs-apt (v1.8.0)── ├ puppetlabs-mongodb (v0.10.0)

└── puppetlabs-stdlib (v4.5.1)/etc/puppet/modules/custom

── ├ profile (???)└── role (???)root@monit:/etc/puppet#

Page 10: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

MongoDB Globals

• Global settings

class { '::mongodb::globals': manage_package_repo => true, version => '3.0.4', }

Page 11: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

MongoDB Client

MongoDB client gets installed with mongodb server.

the syntax for mongodb client is below.

class { ‘::mongodb::client’: }

Page 12: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Deploy MongoDB Server

Deploying mongodb server is as simple as including mongodb server class.

Syntax:class { ‘::mongodb::server’: } OR

include ‘::mongodb::server’

Page 13: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Creating mongodb database

• 'mongodb_database' can be used to create and manage databases within MongoDB.

mongodb_database { 'products': ensure => present, tries => 10, }

tries: The maximum amount of two second tries to wait MongoDB startup. Default: 10

Page 14: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

MongoDB User• 'mongodb_user' can be used to create and manage users

within MongoDB database. mongodb_user { userprod: username => 'userprod', ensure => present, password_hash => mongodb_password('userprod', 'pa55word'),

database => products, roles => ['readWrite', 'dbAdmin'], tries => 10, }

Page 15: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

MongoDB Replicaset• 'mongodb_replset' can be used to create and manage

MongoDB replicasets.

mongodb_replset { rsmain: ensure => present, members => ['host1:27017', 'host2:27017', 'host3:27017']

}

Page 16: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Profileroot@monit:/etc/puppet# cat modules/custom/profile/manifests/mongo.pp

class profile::mongo {

class { '::mongodb::globals':

manage_package_repo => true,

version => '3.0.4',

}

class { '::mongodb::client':}

class { '::mongodb::server':

port => 27017,

verbose => true,

logpath => '/var/log/mongodb/mongodb.log',

dbpath => '/var/lib/mongodb',

auth => true,

}

Page 17: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

mongodb_database { 'products': ensure => present, tries => 10, }

mongodb_user { userprod:

username => 'userprod',

ensure => present,

password_hash => mongodb_password('userprod', 'pa55word'),

database => products,

roles => ['readWrite', 'dbAdmin'],

tries => 10,

}

}

root@monit:/etc/puppet#

Page 18: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Roleroot@monit:/etc/puppet# cat modules/custom/role/manifests/nosql.pp

class role::nosql {

include profile::mongo

}

root@monit:/etc/puppet#

root@monit:/etc/puppet# cat manifests/site.pp

node 'db02.olindata.com' {

include role::nosql

}

root@monit:/etc/puppet#

Page 19: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

MongoDB Data> db.system.indexes.find()

{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "products.dummyData", "name" : "_id_" }

> db.dummyData.find()

{ "_id" : ObjectId("5588bb47a1920eb78c4358fe"), "created_by_puppet" : 1 }

> db.system.indexes.find().toArray()

[

{

"v" : 1,

"key" : {

"_id" : 1

},

"ns" : "products.dummyData",

"name" : "_id_"

}

]

>

Page 20: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Upcoming trainingVisit the link for full list of trainings: http://olindata.com/training/upcoming

Puppet Fundamentals Training, Kuala Lumpur – July 2015

Wednesday, July 8, 2015 - 09:00

Malaysia

PupPuppet

Puppet Fundamentals Training, Bangalore – July 2015

Monday, July 13, 2015 - 09:00

India

Puppet

Puppet Fundamentals Training, Singapore – July 2015

Monday, July 27, 2015 - 09:00

Singapore

Puppet

Puppet Fundamentals Training, Manila – August 2015

Monday, August 3, 2015 - 09:00

Philippines

Page 21: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1R87rdMwZNVWkMSFaMWTV1iddi5xSFhumdsl9DN68buQ/edit?usp=sharing

Previous Webinars

• https://www.youtube.com/results?search_query=olindata

Page 22: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

We’re hiring!EU and Asia based trainers

[email protected]

Page 23: Webinar - Manage MongoDB with Puppet

OlinData Webinar 2015 - https://docs.google.com/presentation/d/1eI9744jfsIIg74tScusgwe3aB3b3-hkRFBleOETx45E/edit?usp=sharing

Questions?

@krishna / @olindata

http://www.olindata.com

[email protected]

http://github.com/olindata