Monday, 25 March 2013

Railgun Cloudfare plugin Installation


Railgun is a single daemon that runs on a 64-bit system which uses alternative compression techniques to dramatically speed up WAN performance. It proxies traffic through a special protocol that would normally travel between CloudFlare and your origin server over HTTP. Typically, the markup of websites does not change that frequently from one request to the next. Instead of transferring the entire request between CloudFlare and your environment, Railgun will transfer only the changes in markup from one request to the next. This cuts down on bandwidth, transfer time, and overall page load times. Railgun caches these differences in memory to make page processing as fast as possible.

----------------------------------------------------------------
Railgun is available only for 64-bit systems.
---------------------------------------------------------------

Downloads
========
Ubuntu (Quantal 12.10) : https://www.cloudflare.com/static/misc/railgun/ubuntu/railgun-quantal.latest.deb
Centos/RHCEL (6): https://www.cloudflare.com/static/misc/railgun/centos/railgun-el6.latest.rpm
Centos/RHCEL (5) : https://www.cloudflare.com/static/misc/railgun/centos/railgun-el5.latest.rpm
Debian  :  https://www.cloudflare.com/static/misc/railgun/debian/railgun-squeeze.latest.deb
FreeBSD (9) : https://www.cloudflare.com/static/misc/railgun/freebsd/railgun-freebsd9.latest.tar.gz
FreeBSD(8) : https://www.cloudflare.com/static/misc/railgun/freebsd/railgun-freebsd8.latest.tar.gz


RPM-based :
execute with root privileges :

rpm -Uvh railgun-stable.X.X.x86_64.rpm

DEB-based
execute with root privileges :

dpkg -i railgun-stable.X.X.amd64.deb

FreeBSD
execute with root privileges :

tar -xzvpf railgun-stable.X.X.tar.gz
cd railgun-stable.X.X && gmake install

For getting activation token for Railgun :

curl -s https://www.cloudflare.com/api/v2/railgun/init -d "host_key=[host key]" | python -mjson.tool

Run this command for getting public IP for Railgun :

curl icanhazip.com

Next you need to install Memcache  :

yum install memcached.x86_64 php-pecl-memcache.x86_64

Configuration file :

vi /etc/sysconfig/memcached

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="

For busy servers you need to increase the values as follows:

MAXCONN : Use 1024 max simultaneous connections; the default is 1024. For busy server             increase this number as per requirements.
 
CACHESIZE : Use 64 MB memory max to use for object storage; the default is 64 megabytes. For busy server you can set it to 512MB or 1GB (1024).

OPTIONS :  You can set server IP address (listen on address) here so that apache/php/nginx based serer can connect to the server. By default it is set to INADDR_ANY. This is an important option to consider as there is no other way to secure the installation. Binding to an internal or firewalled network interface is suggested.
                
Here is my sample update file:


PORT="11211"
USER="memcached"
MAXCONN="4096"
CACHESIZE="512"
OPTIONS="-l 192.168.1.15"

Inorder to Start / Stop / Restart Memcached Server :

# /etc/init.d/memcached start
# /etc/init.d/memcached stop
# /etc/init.d/memcached restart
# /etc/init.d/memcached status

Inorder to verify that Memcached is Running and Working :

pgrep memcached
netstat -tulpn |grep :11211

sample outputs :

tcp        0      0 192.168.1.15:11211           0.0.0.0:*                   LISTEN      24964/memcached
udp        0      0 192.168.1.15:11211           0.0.0.0:*                               24964/memcached

You need add port 2048 in csf and restart it.

1 comment:

  1. Hey man! No idea if you are still monitoring this post or not, but I'll take my chances. I am trying to configure railgun for my network, and configuring the memcached OPTIONS parameter is giving me a headache. What's the IP address that should be applied there?

    Cheers! Great post btw :)

    ReplyDelete