Installation of saltstack-memcached

Source: Internet
Author: User
Tags memcached saltstack

{% Set memory = salt[' Pillar.get '] (' initialization:memory ', ' 128 ')%}

{% Set port = salt[' Pillar.get '] (' initialization:port ', ' 11211 ')%}

{% Set maxconnect = salt[' Pillar.get '] (' initialization:maxconnect ', ' 1024 ')%}


Groupadd:

Group.present:

-Name:memcached

-gid:1000


Useradd

User.present:

-Name:memcached

-Fullname:memcached

-Shell:/sbin/nologin

-uid:1000

-gid:1000


Memcached-datadir:

Cmd.run:

-Names:

-Mkdir-p/usr/local/memcached

-Unless:test-d/usr/local/memcached


Libevent-datadir:

Cmd.run:

-Names:

-Mkdir-p/usr/local/libevent

-Unless:test-d/usr/local/libevent


Libevent-source-install:

File.managed:

-Name:/usr/local/src/libevent-2.0.22-stable.tar.gz

-Source:salt://memcached/files/libevent-2.0.22-stable.tar.gz

-User:root

-Group:root

-mode:644

Cmd.run:

-Name:cd/usr/local/src && tar-zvxf libevent-2.0.22-stable.tar.gz && cd libevent-2.0.22-stable &&A MP;./configure--prefix=/usr/local/libevent && make && make install


Memcached-source-install:

File.managed:

-Name:/usr/local/src/memcached-1.4.34.tar.gz

-Source:salt://memcached/files/memcached-1.4.34.tar.gz

-User:root

-Group:root

-mode:644

Cmd.run:

-Name:cd/usr/local/src && tar-zvxf memcached-1.4.34.tar.gz && cd memcached-1.4.34 &&./configu Re--prefix=/usr/local/memcached--enable-64bit--with-libevent=/usr/local/libevent && make && make Install


Memcached-service:

Cmd.run:

-Name:/usr/local/memcached/bin/memcached-d-m {{memory}}-p {{Port}}-C {{maxconnect}}-U memcached

-UNLESS:NETSTAT-LNPT |grep {{port}}

-Require:

-Cmd:memcached-source-install

-User:memcached


Example of execution command: Salt ' 192.168.1.1 ' State.sls memcached.memcached-install saltenv= "yeronghai-memcached" Pillar= ' { initialization:{"Memory": "1024x768", "Port": "11200", "Maxconnect": "1024"}} '

Files executed by Memcached.memcached-install:sls
saltenv= "yeronghai-memcached": Branch name
Pillar= ' {initialization:{' memory ': ' 1024x768 ', ' Port ': ' 11200 ', ' maxconnect ': ' 1024 '} ': Custom

This article from the "9383764" blog, reproduced please contact the author!

Installation of saltstack-memcached

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.