Twemproxy is a fast and single threaded proxy. It supports multiple server pool simultaneously and maintain persistent connections. It is lightweight and easy to configure.
Installation and Configuration
First I am going to install and configure two redis instances with port 6111 and 6112 then will setup them in Twemproxy.
* Download the redis under /opt
wget http://redis.googlecode.com/files/redis-2.6.10.tar.gz
tar -xvzf redis-2.6.10.tar.gz
cd redis-2.6.10
make
make test
* Now copy the config file into two files and change port to 6111 and 6112 in that
cp redis.conf redis_6111.conf
cp redis.conf redis_6112.conf
* Start the two instances
cd src/
./redis-server /opt/redis-2.6.10/redis_6111.conf
./redis-server /opt/redis-2.6.10/redis_6112.conf
You may need m4,automake,autoconf , download and install which is supported , You can get them from the following links -
wget http://files.directadmin.com/services/custombuild/m4-1.4.15.tar.gz
wget http://files.directadmin.com/services/custombuild/automake-1.13.1.tar.gz
wget http://files.directadmin.com/services/custombuild/autoconf-2.68.tar.gz
Now install the Twemproxy :
$ git clone https://github.com/twitter/twemproxy.git
$ cd twemproxy
$ autoreconf -fvi
$ ./configure --enable-debug=log
$ make
Now edit the config file located in conf/nutcracker.yml and add the redis instances :
beta:
listen: 127.0.0.1:22122
hash: fnv1a_64
hash_tag: "{}"
distribution: ketama
auto_eject_hosts: false
timeout: 400
redis: true
servers:
- 127.0.0.1:6111:1 server1
- 127.0.0.1:6112:1 server2
Start the Redis servers:
$ ./redis-server --port 6111
$ ./redis-server --port 6112
Start twemproxy:
$ ./nutcracker -c ../conf/nutcracker.yml -v 11
Now connect to twemproxy with the redis client
$ ./redis-cli -p 22122
redis 127.0.0.1:22122> set mykey value
OK
redis 127.0.0.1:22122> get mykey
"value"
So This is a quick start installation guide how we setup Twemproxy redis.
Looking forward your comments and suggestions , Thanks !
Installation and Configuration
First I am going to install and configure two redis instances with port 6111 and 6112 then will setup them in Twemproxy.
* Download the redis under /opt
wget http://redis.googlecode.com/
tar -xvzf redis-2.6.10.tar.gz
cd redis-2.6.10
make
make test
* Now copy the config file into two files and change port to 6111 and 6112 in that
cp redis.conf redis_6111.conf
cp redis.conf redis_6112.conf
* Start the two instances
cd src/
./redis-server /opt/redis-2.6.10/redis_6111.conf
./redis-server /opt/redis-2.6.10/redis_6112.conf
* Test the instances
./redis-cli -p 6111
./redis-cli -p 6112
./redis-cli -p 6112
You may need m4,automake,autoconf , download and install which is supported , You can get them from the following links -
wget http://files.directadmin.com/
wget http://files.directadmin.com/
wget http://files.directadmin.com/
Now install the Twemproxy :
$ git clone https://github.com/twitter/
$ cd twemproxy
$ autoreconf -fvi
$ ./configure --enable-debug=log
$ make
Now edit the config file located in conf/nutcracker.yml and add the redis instances :
beta:
listen: 127.0.0.1:22122
hash: fnv1a_64
hash_tag: "{}"
distribution: ketama
auto_eject_hosts: false
timeout: 400
redis: true
servers:
- 127.0.0.1:6111:1 server1
- 127.0.0.1:6112:1 server2
Start the Redis servers:
$ ./redis-server --port 6111
$ ./redis-server --port 6112
Start twemproxy:
$ ./nutcracker -c ../conf/nutcracker.yml -v 11
Now connect to twemproxy with the redis client
$ ./redis-cli -p 22122
redis 127.0.0.1:22122> set mykey value
OK
redis 127.0.0.1:22122> get mykey
"value"
So This is a quick start installation guide how we setup Twemproxy redis.
Looking forward your comments and suggestions , Thanks !
No comments:
Post a Comment