Commit 998472eb by feilong

init

parent 28bf2fb0
- name: Hello World Sample
hosts: all
tasks:
- name: shell
shell: sleep 5
\ No newline at end of file
---
- hosts: all
remote_user: root
roles:
- redis_cluster
---
- name: install gcc
yum: name={{ item }} state=installed
with_items:
- gcc
- gcc-c++
- name: copy redis package
copy: src=redis-{{ redis_version }}.tar.gz dest=/data/software/
- name: tar redis package
unarchive:
src: /data/software/redis-{{ redis_version }}.tar.gz
dest: /data/software
remote_src: yes
- name: make install redis
shell: cd /data/software/redis-{{ redis_version }} && make && make PREFIX=/usr/local/redis-{{ redis_version }} install && mkdir -p /data/redisdb/redis_{{ cluster_port }}
- name: add variable
shell: echo "export PATH=/usr/local/redis-{{ redis_version }}/bin:$PATH" >> /etc/profile && source /etc/profile
- name: create redis config dir
file: path=/data/redisdb/conf state=directory mode=755 owner=root group=root
- name: copy redis config file
template: src=redis_cluster.conf.j2 dest=/data/redisdb/conf/redis_{{ cluster_port }}.conf
- name: start redis service
shell: /usr/local/redis-{{ redis_version }}/bin/redis-server /data/redisdb/conf/redis_{{ cluster_port }}.conf
- name: create redis cluster
shell: yes 'yes' | /usr/local/redis-{{ redis_version }}/bin/redis-cli --cluster create {{ ip1 }}:{{ cluster_port }} {{ ip2 }}:{{ cluster_port }} {{ ip3 }}:{{ cluster_port }} {{ ip4 }}:{{ cluster_port }} {{ ip5 }}:{{ cluster_port }} {{ ip6 }}:{{ cluster_port }} --cluster-replicas 1
when: ansible_default_ipv4.address == "{{ ip1 }}"
daemonize yes
pidfile "/var/run/redis_{{ redis_port }}.pid"
port {{ redis_port }}
protected-mode no
timeout 0
tcp-keepalive 0
loglevel notice
logfile "redis_{{ redis_port }}.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 "/data/redisdb/redis_{{ redis_port }}"
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
#appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
#requirepass redis123
maxmemory 2gb
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
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
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 0 0 0
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
#slaveof
aof-rewrite-incremental-fsync yes
##rename-command CONFIG "sc_config"
rename-command FLUSHALL "sc_flushall"
rename-command FLUSHDB "sc_flushdb"
rename-command KEYS "sc_keys"
maxmemory-policy allkeys-lru
repl-backlog-size 256m
daemonize yes
pidfile /var/run/redis_7015.pid
port 7015
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
cluster-require-full-coverage no
tcp-backlog 511
maxmemory 2gb
timeout 0
tcp-keepalive 0
loglevel notice
logfile "redis_7015.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 /data/redisdb/redis_7015/
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly yes
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 20000
slowlog-max-len 1000
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 0 0 0
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
protected-mode no
rename-command CONFIG "sc_config"
rename-command FLUSHALL "sc_flushall"
rename-command FLUSHDB "sc_flushdb"
rename-command KEYS "sc_keys"
repl-backlog-size 256m
cluster-node-timeout 15000
maxmemory-policy allkeys-lru
redis_port: 6379
cluster_port: 7015
redis_version: 5.0.8
ip1: 172.17.108.147
ip2: 172.17.108.238
ip3: 172.17.108.251
ip4: 172.17.108.237
ip5: 172.17.108.223
ip6: 172.17.109.9
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment