Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Job Management and Runner of SaltStack

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Configuration file / etc/salt/master

Cachedir: / var/cache/salt/master # cache path

Keep_jobs: 24 # job save time

Salt executive module official document https://docs.saltstack.com/en/latest/ref/modules/all/index.html

How to add the return of master to the mysql database?

1) for the creation of database table structure, please refer to section 3 "return Program" of http://www.cnblogs.com/shhnwangjian/p/5986964.html.

2) yum install-y MySQL-python creates the mysql module of python

3) modify master configuration file

Vi / etc/salt/mastermaster_job_cache: mysqlmysql.host: '192.168.137.11'mysql.user:' salt'mysql.pass: 'salt@pw'mysql.db:' salt'mysql.port: 3306

Restart systemctl restart salt-master.service

Test:

Salt'* 'test.ping

Query select * from salt_returns in data

How to kill salt the tasks that are being performed?

Document https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.saltutil.html#module-salt.modules.saltutil

Salt'* 'saltutil.running # look at running tasks and find jid

Salt'* 'saltutil.kill_job jid # Kill the mission according to jid

Salt'* 'saltutil.clear_cache # clears the minion cache

Note:

1) for the salt task being executed, the job id will be stored in the / var/cache/salt/minion/proc directory on the minion side.

2) the salt task being executed, according to the configuration of master cache above, under the path / var/cache/salt/master/jobs directory of Job

Salt runners

Official document https://docs.saltstack.com/en/latest/ref/runners/index.html

Command: salt-run

For example:

12salt-run jobs.list_jobs # lists the historical execution tasks currently saved in job cache salt-run jobs.lookup_jid jid # View the results of historical jid execution

Note: when we execute at the beginning of the salt command, all the commands are distributed to the minion side and executed by the minion side. If a module exists in the master but does not exist on the minion side, the execution will fail. To solve this problem, a salt runners module is provided, which executes all commands on the master side.

Salt-run manage.status # View the status of minion

12salt-run manage.downsalt-run manage.up

Salt-run manage.versions # View the version of minion

This article is from http://www.cnblogs.com/shhnwangjian/p/6048891.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report