SALTSTCK Building Web cluster-job management

Source: Internet
Author: User

In the Saltstack default mode of operation, the Minion will return data directly to the MySQL database, which does not require master involvement. By providing more flexible management, you can also save the execution result (job cache) on the master side, the default save address on the master side is:/var/cache/salt/master/jobs. Minion.

The job cache has the corresponding configuration parameters in the configuration file on the master side:

#cachedir:/var/cache/salt/master Saved Path

#keep_jobs: 24 Saved time 24 hours


Configure the job cache to write directly to the database

The cache on the master side can be written directly to the database via configuration.

The default table structure of the job cache is the same as the table structure of the salt database, but if you want to interact with the database, you need to install Mysql-python on the master side:

Yum Install Mysql-python-y

Modify the master configuration file, and at the end, add the MySQL configuration directly:

# Vim/etc/salt/master
Master_job_cache:mysqlmysql.host: ' 172.16.10.60 ' mysql.user: ' Salt ' mysql.pass: ' SALTPW ' mysql.db: ' Salt ' mysql.port: 3306

Restart Salt-master:

# systemctl Restart Salt-master

Execute on the master side:

# salt ' * ' test.ping

If there are no errors, the execution succeeds and you can see whether the data is written in MySQL:

MariaDB [salt]> Use Salt;select * from Salt_returns\g

Each time it is executed, two records (two minion) are generated.

This allows the job cache to be returned to the database each time it executes.


Salt Common management commands:

# Salt-run Jobs.list_jobs View the history of the Salt Job-cache task, from the directory to query, not from the database.

# Salt-run Jobs.lookup_jid 20161124144637116519 Viewing the execution results of a task


To view the status of the current minion:

# Salt-run Manage.status


To view the Minion in the down state:

# Salt-run Manage-down


To view the Minion in the UP state:

# Salt-run Manage-up


To view version information:

# Salt-run Manage.versions



This article is from the "Trying" blog, make sure to keep this source http://tryingstuff.blog.51cto.com/4603492/1876210

SALTSTCK Building Web cluster-job management

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.