Fork this blog on GitHub Fork this blog on GitHub

How to Restore an Append-Only Redis Master With a dump.rdb

How to Restore an Append-Only Redis Master With a dump.rdb

Follow these steps to restore a dump.rdb into a Redis master that is running in append-only mode. For some reason this is not documented very well. The master in this case had an issue and was unable to write to disk. I was able to get the dump.rdb from a slave.

Step 1 - Obtain a dump.rdb & check the size for later comparison

redis-cli -p $PORT save
redis-cli -p $PORT dbsize

Step 2 - Stop the master & all slaves

/etc/init.d/redis stop

Step 3 - Update the Redis working directory

Remove any old dump.rdb files and any ...

Continue reading

Customizing Vim to Easily Add Python Breakpoints

I added a few lines to my .vimrc today in my ongoing effort to be more productive and type fewer key strokes.

First I changed the <leader> variable from a backslash to a comma which is easier to type.  The leader variable is useful for creating custom commands.

"Easier mapleader than the default "\"
let mapleader = ","


Instead of manually typing "import ipdb; ipdb.set_trace()", the following vim configuration will insert a python breakpoint in the next line by typing ,p in normal mode.  As the comment explains, ctrl v and then escape must be typed in order to create the characters ...

Continue reading

Python Argparse - Parsing Command Line Scipt Arguments

The python argparse module is quite nifty.  In the past I have used code like this to parse arguments to command line scripts:

import sys

prog_name        = sys.argv[0]

def printUsage():
  print 'Usage: ' + prog_name + ' USEFUL_ARGUMENT'
  print 'This script does something useful with an argument.\n'
  print 'Examples:'
  print '  '+ prog_name + ' USEFUL_ARGUMENT\n'
  exit()


sys.argv.remove(prog_name)
if '-h' in sys.argv or '--help' in sys.argv or len(sys.argv) != 1:
  printUsage()

useful_arg = sys.argv[0]

The argparse module helps to eliminate boilerplate code, provides nice formatting for free, and provides useful features. Here is the same code using the ...

Continue reading

Aerohive How To: Create a Firewalled and NATed Separate Network

Suppose you want to create a separate wireless network for guests or so that employees may access the Internet with their personal devices. Devices on this separate network should only be able to access the Internet and not be able to access any internal resources. I have not seen this documented anywhere, so I am going to share. There are several steps, but the process is relatively painless.

Start by creating a New VLAN under Configuration > Advanced > Network Objects > VLANs. Choose a VLAN numeral that is not being used. I chose 42.

Now let’s create a New DHCP server ...

Continue reading