#wget #tar xvfz autoconf-2.69.tar.gz# cd autoconf-2.69 #./configure & & make && make install# #twemproxy Installation and configuration (2 Twemproxy are configured) #wget #mv v0.4.0 twemproxy.tar.gz #tar xvfz twemproxy.tar.gz#cd twemproxy-0.4.0/# ~/ autoconf-2.69/bin/autoreconf -fvi#./configure --prefix=/usr/local/twemproxy#make && make install#cp -rp conf /usr/local/twemproxy/#cd /usr/local/twemproxy#vim session.yml#redissession: listen: 127.0.0.1:6401 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.10.20.179:6309:1 redis_session_01 # Redis master ip port - 110.10.20.179:6310:1 redis_session_02 #redis master ip port Configuration Example two #more session.yml edissession: listen: 127.0.0.1:6401 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.10.20.128:6301:1 redis_session_01 - 110.10.20.127:6301:1 redis_session_02 - 110.10.11.150:6301:1 redis_session_03 - 110.10.11.119:6301:1 redis_session_04 - 110.10.20.128:6302:1 redis_session_05 - 110.10.20.127:6302:1 redis_session_06 - 110.10.11.150:6302:1 redis_session_07 - 110.10.11.119:6302:1 redis_session_08 - 110.10.20.128:6303:1 redis_session_09 - 110.10.20.127:6303:1 redis_ session_10 - 110.10.11.150:6303:1 redis_session_11 - 110.10.11.119:6303:1 redis_session_12rediscache: listen: 127.0.0.1:6402 Hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.0.20.128:6304:1 redis_cache_01 - 110.0.20.127:6304:1 redis_cache_02 - 110.0.11.150:6304:1 redis_cache_03 - 110.0.11.119:6304:1 redis_cache_04 - 110.0.20.128:6305:1 redis_cache_05 - 110.0.20.127:6305:1 redis_cache_06 - 110.0.11.150:6305:1 redis_cache_07 - 110.0.11.119:6305:1 redis_ cache_08 - 110.0.20.128:6306:1 redis_cache_09 - 110.0.20.127:6306:1 redis_cache_10 - 110.0.11.150:6306:1 redis_cache_11 - 110.0.11.119:6306:1 redis_cache_12 - 110.0.20.128:6307:1 redis_cache_13 - 110.0.20.127:6307:1 redis_cache_14 - 110.0.11.150:6307:1 redis_cache_15 - 110.0.11.119:6307:1 redis_cache_16 - 110.0.12.161:6301:1 redis_cache_17 - 110.0.12.161:6302:1 redis_cache_18 - 110.0.12.161:6303:1 redis_cache_19 - 110.0.12.161:6304:1 redis_cache_20 - 110.0.12.162:6301:1 redis_cache_21 - 110.0.12.162:6302:1 redis_cache_22 - 110.0.12.162:6303:1 redis_cache_23 - 110.0.12.162:6304:1 redis_cache_24 - 110.0.12.102:6301:1 redis_cache_33 - 11.0.12.102:6302:1 redis_cache_34 - 110.0.12.102:6303:1 redis_cache_35 - 110.0.12.102:6304:1 redis_cache_36 - 110.0.12.103:6301:1 redis_cache_37 - 110.0.12.103:6302:1 redis_cache_38 - 110.0.12.103:6303:1 redis_cache_39 - 110.0.12.103:6304:1 redis_cache_40 - 110.0.12.82:6301:1 redis_cache_41 - 110.0.12.82:6302:1 redis_cache_42 - 110.0.12.82:6303:1 redis_cache_43 - 110.0.12.82:6304:1 redis_cache_44 - 110.0.12.83:6301:1 redis_cache_45 - 110.0.12.83:6302:1 redis_cache_46 - 110.0.12.83:6303:1 redis_cache_47 - 110.0.12.83:6304:1 redis_cache_48 #more db.yml dbmaster: listen: 127.0.0.1:6403 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.0.20.127:6308:1 redis_db_1 - 110.0.11.150:6308:1 redis_db_2 - 110.0.20.127:6309:1 redis_db_3 - 110.0.11.150:6309:1 redis_db_4 - 110.0.20.127:6310:1 redis_db_5 - 110.0.11.150:6310:1 redis_db_6dbbackup: listen: 127.0.0.1:6404 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_ connections: 1 auto_eject_hosts: true servers: - 110.0.20.128:6308:1 redis_db_1b - 110.0.11.119:6308:1 redis_db_2b - 110.0.20.128:6309:1 redis_db_3b - 110.0.11.119:6309:1 redis_db_4b - 110.0.20.128:6310:1 redis_db_5b - 110.0.11.119:6310:1 redis_db_6b more twemproxy.ymlbbs: listen: 127.0.0.1:22121 hash: fnv1a_64 distribution: ketama auto_eject_hosts: true redis: true server_retry_timeout: 2000 server_failure_limit: 1 Servers: - 127.0.0.1:6379:1www: 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:6380:1 server1 - 127.0.0.1:6381:1 server2 - 127.0.0.1:6382:1 seRver3 - 127.0.0.1:6383:1 server4games: listen: 127.0.0.1:22123 hash: fnv1a_64 distribution: ketama timeout: 400 Backlog: 1024 preconnect: true auto_eject_hosts: true server_ retry_timeout: 2000 server_failure_limit: 3 servers: - 127.0.0.1:11212:1 - 127.0.0.1:11213:1site: listen: 127.0.0.1:22124 hash: fnv1a_64 distribution: ketama timeout: 100 auto_ Eject_hosts: true server_retry_timeout: 2000 server_failure_limit: 1 servers: - 127.0.0.1:11214:1 - 127.0.0.1:11215:1 - 127.0.0.1:11216:1 - 127.0.0.1:11217:1 - 127.0.0.1:11218:1 - 127.0.0.1:11219:1 - 127.0.0.1:11220:1 - 127.0.0.1:11221:1 - 127.0.0.1:11222:1 - 127.0.0.1:11223:1oser: listen: /tmp/gamma hash: hsieh distribution: ketama auto_eject_hosts: false servers: - 127.0.0.1:11214:100000 - 127.0.0.1:11215:1 Configuration Example Three redissession: listen: 127.0.0.1:6401 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: True redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.0.20.128:6301:1 redis_session_01 - 110.0.20.127:6301:1 redis_session_02 - 110.0.11.150:6301:1 redis_session_03 - 110.0.11.119:6301:1 redis_session_04 - 110.0.20.128:6302:1 redis_ session_05 - 110.0.20.127:6302:1 redis_session_06 - 110.0.11.150:6302:1 redis_session_07 - 110.0.11.119:6302:1 redis_ session_08 - 110.0.20.128:6303:1 redis_session_09 - 110.0.20.127:6303:1 redis_session_10 - 110.0.11.150:6303:1 redis_ session_11 - 110.0.11.119:6303:1 redis_session_12rediscache: listen: 127.0.0.1:6402 hash: fnv1a_64 distribution: modula Timeout: 1000 preconnect: true redis: true server_connections: 1 auto_ejEct_hosts: true servers: - 110.0.20.128:6304:1 redis_cache_01 - 110.0.20.127:6304:1 redis_cache_02 - 110.0.11.150:6304:1 redis_cache_03 - 110.0.11.119:6304:1 redis_cache_04 - 110.0.20.128:6305:1 redis_cache_05 - 110.0.20.127:6305:1 redis_cache_06 - 110.0.11.150:6305:1 redis_cache_07 - 110.0.11.119:6305:1 redis_cache_08 - 110.0.20.128:6306:1 redis_cache_09 - 110.0.20.127:6306:1 redis_cache_10 - 110.0.11.150:6306:1 redis_cache_11 - 110.0.11.119:6306:1 redis_cache_12 - 110.0.20.128:6307:1 redis_cache_13 - 110.0.20.127:6307:1 redis_cache_14 - 110.0.11.150:6307:1 redis_cache_15 - 110.0.11.119:6307:1 redis_cache_16 - 110.0.12.161:6301:1 redis_cache_17 - 110.0.12.161:6302:1 redis_cache_18 - 110.0.12.161:6303:1 redis_cache_19 - 110.0.12.161:6304:1 redis_ cache_20 - 110.0.12.162:6301:1 redis_cache_21 - 110.0.12.162:6302:1 redis_cache_22 - 110.0.12.162:6303:1 redis_cache_23 - 110.0.12.162:6304:1 redis_cache_24 - 110.0.12.142:6301:1 redis_cache_25 - 110.0.12.142:6302:1 redis_cache_26 - 110.0.12.142:6303:1 redis_cache_27 - 110.0.12.142:6304:1 redis_cache_28 - 110.0.12.143:6301:1 redis_cache_29 - 110.0.12.143:6302:1 redis_cache_30 - 110.0.12.143:6303:1 redis_cache_31 - 110.0.12.143:6304:1 redis_cache_32 - 110.0.12.102:6301:1 redis_cache_33 - 110.0.12.102:6302:1 redis_cache_34 - 110.0.12.102:6303:1 redis_cache_35 - 110.0.12.102:6304:1 redis_cache_36 - 110.0.12.103:6301:1 redis_cache_37 - 110.0.12.103:6302:1 redis_cache_38 - 110.0.12.103:6303:1 redis_cache_39 - 110.0.12.103:6304:1 redis_cache_40 - 110.0.12.82:6301:1 redis_cache_41 - 110.0.12.82:6302:1 redis_cache_42 &nbsP;- 110.0.12.82:6303:1 redis_cache_43 - 110.0.12.82:6304:1 redis_ cache_44 - 110.0.12.83:6301:1 redis_cache_45 - 110.0.12.83:6302:1 redis_cache_46 - 110.0.12.83:6303:1 redis_cache_47 - 110.0.12.83:6304:1 redis_cache_48redisdb1: listen: 127.0.0.1:6403 hash: fnv1a_64 distribution: modula timeout: 1000 preconnect: true redis: true server_connections: 1 auto_eject_hosts: true servers: - 110.0.20.127:6308:1 redis_db_1 - 110.0.11.150:6308:1 redis_db_2 - 110.0.20.127:6309:1 redis_db_3 - 110.0.11.150:6309:1 redis_db_4 - 110.0.20.127:6310:1 redis_db_5 - 110.0.11.150:6310:1 redis_db_6 110.0.20.127 redis config more redis_6308. confdaemonize yespidfile "/var/run/redis_6308.pid" port 6308tcp-backlog 10240bind 0.0.0.0timeout 0tcp-keepalive 0loglevel noticelogfile "/var/log/redis_6308.log" databases 16#save 900 1#save 300 10#save 60 10000save "" stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename "Dump.rdb" dir "/var/lib/redis/6308" slave-serve-stale-data yesslave-read-only yesslave-priority 100maxmemory 2500mbmaxmemory-policy allkeys-lruappendonly noappendfsync nono-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mblua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60# generated by config rewriteslaveof 110.0.20.128 6308more 110.0.20.128 redis_6308daemonize yespidfile "/var/run/redis_6308.pid" Port 6308tcp-backlog 10240bind 0.0.0.0timeout 0tcp-keepalive 0loglevel noticelogfile "/var/log/redis_6308.log" databases 16save 900 1save 300 10save 60 10000stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename "Dump.rdb" dir "/var/lib/redis/6308" Slave-serve-stale-data yesslave-read-only noslave-priority 100slaveof 10.0.20.127 6308maxmemory 2500mbmaxmemory-policy allkeys-lruappendonly noappendfsync nono-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mblua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60 more 110.0.20.143 redisdaemonize yespidfile /var/run/redis_6303.pidport 6303tcp-backlog 10240bind 0.0.0.0timeout 0tcp-keepalive 0loglevel noticelogfile /var/ Log/redis_6303.logdatabases 16stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename dump.rdbdir /var/lib/redis/6303/slave-priority 100maxmemory 2500mbmaxmemory-policy allkeys-lruappendonly noappendfilename "Appendonly.aof" appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated yeslua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128latency-monitor-threshold 0notify-keyspace-events "" hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10
Twemproxy Redis Configuration (session and DB)