Environment Description:
Twemproxy |
192.168.0.112:22122 |
centos6.5 |
Redis |
192.168.0.113:6379 |
centos6.5 |
Redis |
192.168.0.113:6380 |
centos6.5 |
Twemproxy Installation:
[Email protected] src]# TAR-ZXF nutcracker-0.4.0.tar.gz [[email protected] src]# CD Nutcracker-0.4.0[[email protected] n utcracker-0.4.0]#./configure--prefix=/usr/local/nutcracker/[[email protected] nutcracker-0.4.0]# make && Make Install[[email protected] nutcracker-0.4.0]# cp-r conf scripts/usr/local/nutcracker/
To configure environment variables:
[Email protected] nutcracker-0.4.0]# cd/etc/profile.d/[[email protected] profile.d]# vim twemproxy.sh #!/bin/sh#set Rutcracker environmentexport rutcracker_home=/opt/phpdba/nutcracker-0.2.4export PATH= $RUTCRACKER _home/bin:$ Pathsource twemporxy.sh
To modify the Nutcracker configuration file:
[Email protected] nutcracker-0.4.0]# cd/usr/local/nutcracker/[[email protected] nutcracker]# vim conf/ nutcracker.ymlalpha:listen:0.0.0.0:22121 hash:fnv1a_64 Distribution:ketama auto_eject_hosts:true # will fail re Dis removes redis:true server_retry_timeout:2000 server_failure_limit:1 servers from the cluster: -192.168.0.112:6379:1 server1-192.168.0.113:6379:1 server2-192.168.0.113:6380:1 Server3
Configuration file Description
Check the configuration file syntax
[[email protected] nutcracker]# nutcracker-c conf/nutcracker.yml-tnutcracker:configuration file '/opt/phpdba/ Nutcracker-0.2.4/conf/nutcracker.yml ' syntax is OK
Start:
[Email protected] nutcracker]# nutcracker-d-c/opt/phpdba/nutcracker-0.2.4/conf/nutcracker.yml
Redis installation See the installation section in the master-slave configuration
Performance Testing
redis redis-benchmark :
1. Test:
A. through the twemproxy test:
[[Email protected] nutcracker]# redis-benchmark -h 127.0.0.1 -q -t set ,get,incr,lpush,lpop,sadd,spop,lpush,lrange -c 100 -p 22121 set: 62972.29 requests per secondget: 87336.24 requests per secondincr: 85034.02 requests per secondlpush: 81699.35 requests per secondlpop: 82987.55 requests per secondsadd: 85034.02 requests per secondspop: 87412.59 requests per secondlpush (Needed to benchmark lrange): 80840.74 requests per secondlrange_100 (first 100 elements): 28384.90 requests per secondlrange_300 (first 300 elements): 9022.01 requests per secondlrange_500 (first 450 elements): 4810.00 requests per secondlrange_ 600 (first 600 elements): 3363.04 requests per second
B. through to the back-end redis view :
[Email protected] nutcracker]# redis-cli 127.0.0.1:6379> KEYS) "counter:__rand_int__" 127.0.0.1:6379> [[email Protected] nutcracker]# redis-cli 127.0.0.1:6379> KEYS *) "MyList" 2) "key:__rand_int__"
found our test data fragmented to two Redis instance.
2 . View Key-value distributions (see Redis instances on the backend of the cluster, respectively)
[Email protected] nutcracker]# redis-cli info|grep db0db0:keys=1,expires=0,avg_ttl=0[[email protected] nutcracker]# REDIS-CLI info|grep db0db0:keys=1,expires=0,avg_ttl=0[[email protected] nutcracker]# redis-cli info|grep db0db0:keys= 2,expires=0,avg_ttl=0
Test Results:With a basic command.Twemproxyperformance has decreased;throughTwemproxydistribution basic average. The test data is subject to business testing.
Building a Redis Shard storage cluster