Giter Club home page Giter Club logo

moonshine_twemproxy's Introduction

moonshine_twemproxy

A moonshine plugin that installs and manages twemproxy, a lightweight proxy for memcached and/or redis.

Configuration

We use moonshine_twemproxy along with moonshine_multi_server and moonshine_iptables.

We highly recommend locking down access to just the servers that need it and limiting access just to the internal IP.

Here's an example configuration block for twemproxy:

:twemproxy:
  :version: 0.3.0
  :listen: 0.0.0.0:6379
  :redis: true
  :hash: fnv1a_64
  :distribution: ketama
  :auto_eject_hosts: true
  :server_retry_timeout: 30000
  :server_failure_limit: 3
  :timeout: 400
  :servers:
  - 10.0.10.10:6379:1
  - 10.0.10.11:6379:1

iptables

If you use moonshine_multi_server, you probably have a configuration builder for most things. Here's the configuration builder we use to set up the iptables rules for twemproxy:

def build_twemproxy_iptables_rules
  rules = build_base_iptables_rules
  
  (servers_with_rails_env + redis_servers + twemproxy_servers).each do |server|
    rules << "-A INPUT -s #{server[:internal_ip]} -p tcp -m tcp --dport 6379 -j ACCEPT"
  end

  {:rules => rules}
end

Right now, moonshine_twemproxy doesn't support multiple frontends - we only create one - but we'll add that if there's interest.

Monitoring

The plugin sets up an xinetd service that returns the response from twemproxy's stat service. It runs on localhost:1025. This makes it really easy to add twemproxy stats to Scout using the Generic JSON Plugin!


Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC

moonshine_twemproxy's People

Contributors

kplawver avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.