mongoDBfor sysadminsJordi Soucheiron - @jordixouSoftware developer & sysadmin @ DEXMA@sudoersbcn 2013/6/4
What is mongoDB Document oriented noSQL database Auto sharding -> scales horizontally Auto replication -> high availabi...
What is it used for? Storing files Storing logs Queue systems Data mining …
Basic mongoDB setup Pros: Simple Cons: No sharding, no high-availability
Small mongoDB setup Pros: High-availability, optional delayed node Cons: No sharding
Advanced mongoDB setup
Advanced mongoDB setup Pros: High-availability Reads and writes are distributed amongst all nodes You choose what kind...
Demo time
Configure Vagrant Init Vagrant: Modify Vagrantfile:Vagrant.configure("2") do |config|config.vm.box = "precise64"config.v...
Configure Puppet mkdir Manifests vi init.pp:package { mongodb:ensure => present,}
Start Vagrant and mongoDB vagrant up vagrant ssh sudo /etc/init.d/mongodb stop mkdir –p ~/mongo/db1 ~/mongo/db2 ~/mong...
Add nodes to the replica set mongo --port 27017rsconf = {_id: "rs0",members: [{_id: 0,host: "127.0.0.1:27017"}]}rs.initia...
Questions
Upcoming SlideShare
Loading in …5
×

mongoDB for sysadmins

1,696 views

Published on

Quick intro to mongoDB for sysadmins. With a simple vagrant demo

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,696
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
35
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

mongoDB for sysadmins

  1. 1. mongoDBfor sysadminsJordi Soucheiron - @jordixouSoftware developer & sysadmin @ DEXMA@sudoersbcn 2013/6/4
  2. 2. What is mongoDB Document oriented noSQL database Auto sharding -> scales horizontally Auto replication -> high availability Atomic in-place updates No transaction support JSON queries and results Open source with commercial support by 10gen
  3. 3. What is it used for? Storing files Storing logs Queue systems Data mining …
  4. 4. Basic mongoDB setup Pros: Simple Cons: No sharding, no high-availability
  5. 5. Small mongoDB setup Pros: High-availability, optional delayed node Cons: No sharding
  6. 6. Advanced mongoDB setup
  7. 7. Advanced mongoDB setup Pros: High-availability Reads and writes are distributed amongst all nodes You choose what kind of replication you want You choose what collections are sharded You choose the sharding key Cons: More complexity than the other solutions You ALWAYS want 3 config servers
  8. 8. Demo time
  9. 9. Configure Vagrant Init Vagrant: Modify Vagrantfile:Vagrant.configure("2") do |config|config.vm.box = "precise64"config.vm.box_url = "http://files.vagrantup.com/precise64.box"config.vm.provision :puppet do |puppet|puppet.manifests_path = "manifests"puppet.manifest_file = "init.pp"endendvmvagrant init precise64 http://files.vagrantup.com/precise64.box
  10. 10. Configure Puppet mkdir Manifests vi init.pp:package { mongodb:ensure => present,}
  11. 11. Start Vagrant and mongoDB vagrant up vagrant ssh sudo /etc/init.d/mongodb stop mkdir –p ~/mongo/db1 ~/mongo/db2 ~/mongo/db3 mongod --port 27017 --dbpath ~/mongo/db1 --replSet rs0 --smallfiles --oplogSize 128 --rest mongod --port 27018 --dbpath ~/mongo/db2 --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27019 --dbpath ~/mongo/db3 --replSet rs0 --smallfiles --oplogSize 128
  12. 12. Add nodes to the replica set mongo --port 27017rsconf = {_id: "rs0",members: [{_id: 0,host: "127.0.0.1:27017"}]}rs.initiate( rsconf )rs.add("127.0.0.1:27018")rs.add("127.0.0.1:27019")
  13. 13. Questions

×