Plurk Open Source - open source projects by Plurk Inc.

LightCloud manager can manage your Redis nodes, so you don't have to do it manually.

Getting the LightCloud manager

Simply check out the LightCloud manager in a directory:

$ svn co http://opensource.plurk.com/svn/opensource/redis_manager ~/redis_manager
$ cd  ~/redis_manager

Create a config file

Create a config file config.py. A sample config file is included ~/lightcloud_manager/config.sample.py:

from os import path

DATA_DIR = path.join(path.realpath(path.curdir), "data")

USE_MASTER = True
DEBUG = False

NODES = { 
    #Lookup nodes
    'lookup1_AM': { 'id': 2, 'host': '127.0.0.1:10000', 'master': None },
    'lookup1_AS': { 'id': 1, 'host': '127.0.0.1:11000', 'master': '127.0.0.1:10000' },

    #Storage nodes
    'storage1_BM': { 'id': 6, 'host': '127.0.0.1:12000', 'master': None },
    'storage1_AS': { 'id': 5, 'host': '127.0.0.1:13000', 'master': '127.0.0.1:12000' },
}

The options of the manager

$ python -m manager -c config.py
Script that is used to handle Redis nodes.

Starting nodes:
   python manager.py -c config.py all start
   python manager.py -c config.py lookup1 start

Stopping nodes:
   python manager.py -c config.py all stop
   python manager.py -c config.py lookup1 stop

Status:
   python manager.py -c config.py all status 
   python manager.py -c config.py lookup1 status

Misc:
   python manager.py -c config.py delete_data

View a sample config file in config.sample.py.

Starting the nodes:

$ python -m manager all start

Checking out status:

$ python manager.py all status
lookup1_AM (127.0.0.1:10000):
    node running - node items: 18311
storage1_BM (127.0.0.1:12000):
    node running - node items: 18311
lookup1_AS (127.0.0.1:11000):
    node running - node items: 18311
    master 127.0.0.1:10000 running - master items: 18311
storage1_AS (127.0.0.1:13000):
    node running - node items: 18311
    master 127.0.0.1:12000 running - master items: 18311

How to debug

If you run into problems, try to start a redis-server manually. python manager.py all start prints out the commands.

Powered by Skeletonz