本文共 2575 字,大约阅读时间需要 8 分钟。
redis
├── files│ ├── redis6379.conf│ ├── Redis-server-init│ └── redis-server.service├── handlers├── tasks│ └── main.yml└── vars- hosts: docker remote_user: root vars: epic: true redis_dir: /usr/local/redis datesoft: /data/sh roles: - redis
root@centos-mysql01:/data/sh/ansible_role# cat redis/tasks/main.yml
root@centos-mysql01:/data/sh/ansible_role# ls redis/files/
redis6379.conf Redis-server-init redis-server.serviceredis_install_dir="/usr/local/redis"
sed -i 's@pidfile.@pidfile /var/run/redis/redis.pid@' ${redis_install_dir}/etc/redis.confsed -i "s@logfile.@logfile ${redis_install_dir}/var/redis.log@" ${redis_install_dir}/etc/redis.confsed -i "s@^dir.*@dir ${redis_install_dir}/var@" ${redis_install_dir}/etc/redis.confsed -i 's@daemonize no@daemonize yes@' ${redis_install_dir}/etc/redis.confsed -i "s@^# bind 127.0.0.1@bind 127.0.0.1@" ${redis_install_dir}/etc/redis.confMem=free -m|awk -F: '{print $2}'|awk '{print $1}'|head -n2|tail -n 1
redis_maxmemory=expr $Mem / 8
000000sed -i "s@maxmemory <bytes>@maxmemory <bytes>\nmaxmemory expr $Mem / 8
000000@" ${redis_install_dir}/etc/redis.conf链接: https://pan.baidu.com/s/1Mvg1oaoLKojtBP6BjgBCvg 提取码: rf29
转载于:https://blog.51cto.com/9025736/2332051