Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Salt-stack install redis

Shulou Source: shulou.com Published: 2022-06-01 02:46:45 10月04日 Update

The content of install.sls is:

Redis-install:

File.managed:

-name: / usr/local/src/redis-3.2.0.tar.gz

-source: salt://redis/files/redis-3.2.0.tar.gz

-user: root

-group: root

-mode: 755

Cmd.run:

-name: cd / usr/local/src & & tar xf redis-3.2.0.tar.gz & & cd redis-3.2.0 & & make PREFIX=/usr/local/redis install

-unless: test-d / usr/local/redis

-require:

-file: redis-install

Redis-config:

Cmd.run:

-name: mkdir / etc/redis

File.managed:

-name: / etc/redis/6379.conf

-source: salt://redis/files/6379.conf

-user: root

-group: root

-mode: 644

Redis-service:

File.managed:

-name: / etc/init.d/redis

-source: salt://redis/files/redis.init

-user: root

-group: root

-mode: 644

Cmd.run:

-name: chkconfig-add redis & & chkconfig redis on

-unless: chkconfig-- list | grep redis

Service.running:

-name: redis

-enable: True

-watch:// must think carefully about this step in a production environment, because redis is an in-memory cache

-file: the function of redis-config//watch is to restart automatically when a file changes.

-require:

-cmd: redis-install

-cmd: redis-service

Tags: Clarity function memory content that is file environment cache change production monitoring Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Redmi OPPO Reno MySQL