Job-cache Management of Saltstack

Source: Internet
Author: User
Tags saltstack

Prior to Saltstack 2014.7, the execution results of the Minion end were to be stored in an external system, and by using returners, we could store the returned results in our designated storage system, but the Returners feature was directly connected to the corresponding store by the Minion side. , the use of specific returners may also require the installation of related software packages in Minion, which may not fully meet our requirements in a large-scale distributed environment due to network constraints.

Salt provides a mechanism that can be stored directly on the master side to be returned. There are master_job_cache options in the master configuration file, which is MySQL by default. We can open the job's return results directly into MySQL.

Specific to see the official website introduction: http://docs.saltstack.com/en/latest/topics/jobs/external_cache.html

The default return result is saved to Cachedir, which is maintained for 24 hours. can use

In addition to the Default Job Cache, Salt provides and additionalmechanisms to send job results to other systems (Databas ES, local syslog,and others):

    • External Job Cache

    • Master Job Cache

The major difference between these twomechanism is from where results be returned (from the Salt Master or saltminion).

The operation is as follows:

First, install MySQL on the master side and create the database and table

For details, refer to the official website documentation:

Http://docs.saltstack.com/en/latest/ref/returners/all/salt.returners.mysql.html#module-salt.returners.mysql


Second, the return data storage configuration There are two ways:

1, in the Minion End set:

1) Install the Mysql-python package

2) Modify the Minion configuration file

Mysql.host: ' 192.168.100.120 '
Mysql.user: ' Salt '
Mysql.pass: ' Salt '
Mysql.db: ' Salt '
mysql.port:3306
Mysql.ssl_ca:/etc/salt/pki/minion/minion.pem
Mysql.ssl_cert:/etc/salt/pki/minion/minion.pem
Mysql.ssl_key:/etc/salt/pki/minion/minion.pub

3) Execute command on Master side add--return mysql

Example: Salt ' * ' Cmd.run "free-m"--return MySQL

or open ext_job_cache:mysql on the master side, no need to add--return MySQL can also be inserted into the table

4) Master side does not need to be configured.

Note: You can insert the return data into the table Salt_returns. No data for the other two tables.

2, on the master side settings:

1) Install the Mysql-python package

If the Python module inserted into MySQL is not installed, the following error will be reported

2015-07-19 19:47:52,089 [Salt.master][critical][6631] The specified returner used for th e external job cache "MySQL" does not has a save_load function!

2) adding in the master configuration file

Mysql.host: ' 127.0.0.1 '
Mysql.user: ' Salt '
Mysql.pass: ' Salt '
Mysql.db: ' Salt '
mysql.port:3306

Master_job_cache:mysql

3) execute command on master side

Example: Salt ' * ' Cmd.run "free-m" to insert Jid and return data into Jids and Salt_returns tables.

Note: Open the Master profile parameter Event_return:mysql, you can insert the event data into the table salt_events, but the amount of data is large, is not recommended to open.


This article is from the "Autumn Fairy tale" blog, please be sure to keep this source http://wushank.blog.51cto.com/3489095/1676139

Job-cache Management of Saltstack

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.