systemd_redis.j2 1012 B

12345678910111213141516171819202122
  1. #####################################################################
  2. # {{ ansible_managed }}
  3. # {{ item['port'] }}
  4. #####################################################################
  5. [Unit]
  6. Description=Redis Server Port {{ item['port'] }}
  7. After=network.target
  8. [Service]
  9. WorkingDirectory=/opt/cpredis
  10. Type=simple
  11. LimitNOFILE=65535
  12. User=redis
  13. ExecStart=/usr/local/bin/redis-server --port {{ item['port'] }} --protected-mode no --dbfilename {{ item['port'] }}-redis.rdb --loadmodule /usr/local/share/redisraft/redisraft.so addr={{ ansible_default_ipv4.address }}:{{ item['port'] }} raft-log-fsync=no follower-proxy=no raftize-all-commands=yes cluster-start-hslot={{ item['start-hslot'] }} cluster-end-hslot={{ item['end-hslot'] }} raft-log-filename={{ item['port'] }}-raftlog.db cluster-mode=yes
  14. StandardOutput=file:/var/log/cpredis/redis-{{ item['port'] }}.log
  15. StandardError=file:/var/log/cpredis/redis-{{ item['port'] }}-error.log
  16. [Install]
  17. WantedBy=multi-user.target
  18. Alias=redis-{{ item['port'] }}.service