Posts

Showing posts from April, 2013

Mongorestore using knife

This post is a continuation to my post Taking a Mongodump using Knife . Keeping the assumptions the same as the previous post, this post outlines a knife plugin to restore your mongo database from a dump taken as above. module KnifePlugins   class MongoDumpApply < Chef::Knife     banner 'knife mongo dump apply'         option :db_env,       :long => '--db-env DB_ENV',       :description => 'Environment to apply the dump to'      option :dump_dir,       :long => '--dump-dir DUMP_DIR',       :description => 'Full path to dump location'    deps do       require 'chef/search/query'    end     def run       @dump_dir = config[:dump_dir]       @env = config[:db_env]      if !vali...

Mongodump and upload to S3 using knife

Quite recently I have had to write a knife plugin to take mongo dumps. This post contains the code for the same with a few assumptions in place. Assumptions: 1.  CentOS 6.3, mongo db version 2.4.1 2.  Chef environment has the db config as below :      override_attributes({ database:  { user: 'db_user',                  dump_dir: '/opt/mongodb-dump',                  auth: true,                  replica: {                         id: 'rsTest',                         mongo_primary:'x.x...

Load Balancer with SSL offloading - nginx + HAProxy

Image
HAProxy and nginx can be configured together to work as an SSL offloader and a load balancer. Listed below are the steps to achieve the same on a centOS instance. Assume 192.168.1.1 and 192.168.1.2 running web servers on port 80 and 192.168.1.3 running haproxy on port 8181. Starting with HAPROXY set up. 1.  Install haproxy.        yum install -y haproxy 2.  Edit the haproxy configuration to update the backend web servers and keep it at the basic log level.     global   log 127.0.0.1   local2   chroot          /var/lib/haproxy   pidfile         /var/run/haproxy.pid   maxconn         4096   user            haproxy   group           haproxy   daemon   ...