Twemproxy redis構成(sessionとdb)
12277 ワード
#wget
#tar xvfz autoconf-2.69.tar.gz
# cd autoconf-2.69
#./configure && make && make install
#
#twemproxy (2 twemproxy )
#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
#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_12
rediscache:
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_6
dbbackup:
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.yml
bbs:
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:1
www:
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 server4
games:
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:1
site:
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:1
oser:
listen: /tmp/gamma
hash: hsieh
distribution: ketama
auto_eject_hosts: false
servers:
- 127.0.0.1:11214:100000
- 127.0.0.1:11215:1
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_12
rediscache:
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
- 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
redisdb1:
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.conf
daemonize yes
pidfile "/var/run/redis_6308.pid"
port 6308
tcp-backlog 10240
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/var/log/redis_6308.log"
databases 16
#save 900 1
#save 300 10
#save 60 10000
save ""
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/var/lib/redis/6308"
slave-serve-stale-data yes
slave-read-only yes
slave-priority 100
maxmemory 2500mb
maxmemory-policy allkeys-lru
appendonly no
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Generated by CONFIG REWRITE
slaveof 110.0.20.128 6308
more 110.0.20.128 redis_6308
daemonize yes
pidfile "/var/run/redis_6308.pid"
port 6308
tcp-backlog 10240
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/var/log/redis_6308.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/var/lib/redis/6308"
slave-serve-stale-data yes
slave-read-only no
slave-priority 100
slaveof 10.0.20.127 6308
maxmemory 2500mb
maxmemory-policy allkeys-lru
appendonly no
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
more 110.0.20.143 redis
daemonize yes
pidfile /var/run/redis_6303.pid
port 6303
tcp-backlog 10240
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis_6303.log
databases 16
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis/6303/
slave-priority 100
maxmemory 2500mb
maxmemory-policy allkeys-lru
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10