Ansible-playbook roles安装redis实例(学习笔记二十九)

1、相关redis参数:

Ansible-playbook roles安装redis实例(学习笔记二十九)_第1张图片

2、/templates/redis.conf配置相关参数:

daemonize yes

pidfile /var/run/redis_{{ redis_port }}.pid

port {{ redis_port }}

bind {{ ansible_default_ipv4.address }}

timeout 0

tcp-keepalive 0

loglevel notice

logfile {{ redis_log_dir }}/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 redis_{{ redis_port }}.rdb

dir {{ redis_db_dir }}

{% if redis_master_ip is defined %}

slaveof {{ redis_master_ip }} {{ redis_master_port }}

{% endif %}

slave-serve-stale-data yes

repl-disable-tcp-nodelay no

slave-priority 100

appendonly no

appendfsync everysec

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

aof-rewrite-incremental-fsync yes

3、tasks任务执行:复制压缩包到目标主机,创建根目录,解压到根目录,复制模板文件,做软链接,启动服务。

Ansible-playbook roles安装redis实例(学习笔记二十九)_第2张图片
copy.yml
Ansible-playbook roles安装redis实例(学习笔记二十九)_第3张图片
install.yml

4、roles完整执行步骤:

下载roles: https://pan.baidu.com/s/1B5ec6CExoRj_pjvzVtlrhw

执行:ansible-playbook /你的路径/redis_install.yml --extra-vars "host=你的主机群组 user=root"

你可能感兴趣的:(Ansible-playbook roles安装redis实例(学习笔记二十九))