In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. The execution result of salt is returned to Master1 and job cache by default
Storage location
# Directory to store job and cache data:# This directory may contain sensitive data and should be protected accordingly.##cachedir: / var/cache/salt/master# Set the number of hours to keep old job information in the job cache:#keep_jobs: 2 storage The number of seconds to wait when the client is requesting information# about running jobs.#gather_job_timeout: 102.Store cache in database (1) install database connection module install module connected to mysql MySQL-pythonyum install-y MySQL-python (2) configure database connection
Configure connections on master
Directly append the content vim / etc/salt/mastermaster_job_cache: mysqlmysql.host: '192.168.56.11'mysql.user:' salt'mysql.pass: '123456'mysql.db:' salt'mysql.port: 3306 (3) restart salt-mastersystemctl restart master (4) verify whether to write to the database and execute the following command [root@linux-node1 / srv/salt/prod/bbs] # salt' * 'cmd. Run 'whoami'linux-node2.example.com: rootlinux-node1.example.com: root login database mysql-h 192.168.56.11-usalt-p123456MariaDB [(none)] > use salt Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-root * 9. Row * * fun: cmd.run jid: 201611090910973295 return: "root" id: linux-node2.example.com success: 1 full_ Ret: {"fun_args": ["whoami"] "jid": "201611090910973295", "return": "root", "retcode": 0, "success": true, "cmd": "_ return", "_ stamp": "2016-11-09T01:10:11.064745", "fun": "cmd.run" "id": "linux-node2.example.com"} alter_time: 2016-11-0909: 10. Row * * fun: cmd.run jid: 20161109091010973295 return: "root" id: linux-node1.example. Com success: 1 full_ret: {"fun_args": ["whoami"] "jid": "201611090910973295", "return": "root", "retcode": 0, "success": true, "cmd": "_ return", "_ stamp": "2016-11-09T01:10:11.146238", "fun": "cmd.run", "id": "linux-node1.example.com"} alter_time: 1110 rows in set (0.00 sec) 3, job View
Execute a command first, such as
Salt'* 'cmd.run' ping www.baidu.com'
Executing the job View command
[root@linux-node1 ~] # salt'* 'saltutil.runninglinux-node2.example.com: _-arg:-ping www.baidu.com fun: cmd.run jid: 20161109091517283293 pid: 6049 ret: tgt: * tgt_type: glob user : rootlinux-node1.example.com: | _-arg:-ping www.baidu.com fun: cmd.run jid: 20161109091517283293 pid: 6269 ret: tgt: * tgt_type: glob user: root
To stop job, you can use the following methods
[root@linux-node1 ~] # salt'* 'saltutil.kill_job 20161109091517283293linux-node2.example.com: Signal 9 sent to job 20161109091517283293 at pid 6049linux-node1.example.com: Signal 9 sent to job 20161109091517283293 at pid 6269 [root@linux-node1 ~] # salt' * 'saltutil.runninglinux-node2.example.com:linux-node1.example.com:4, masterside cache
Storage location
[root@linux-node1 / var/cache/salt/master] # lsfile_lists jobs minions proc queues roots syndics tokens [root@linux-node1 / var/cache/salt/master] # pwd/var/cache/salt/master [root@linux-node1 / var/cache/salt/master] # tree. ├── file_lists │ └── roots │ ├── base.p │ └── prod.p ├── │ ├── 6c │ │ └── 9f646ec75df0bd0ec29760ef0dee7a │ │ ├── jid │ │ └── linux-node1.example.com │ │ └── return.p │ ├── 90 │ │ └── d3646e58dd82e103973eb889af96d1 │ │ └── jid │ d4 74a5b7f1ebf41c84c714d2ad8fda85 jid Linux-node1.example.com │ │ └── return.p │ └── e3 │ └── d2ffbc8e72a923205126c07c9e1e55 │ ├── jid │ └── linux-node1.example.com │ └── return.p II. Jobs Management component
A convenient system for managing jobs: runners.jobs
List the job [root@linux-node1 / var/cache/salt/master] # salt-run jobs.list_ Jobss [warning] / usr/lib/python2.7/site-packages/salt/grains/core.py:1493: DeprecationWarning: The "osmajorrelease" will be a type of an integer.20161109090923312794:-Arguments:-whoami Function: cmd.run StartTime: 2016 in job cache Nov 09 09 Target-type Target-type: glob User: root
View the return of a job
[root@linux-node1] # salt-run jobs.lookup_jid 20161109093137760714linux-node1.example.com: PING www.a.shifen.com (119.75.218.70) 56 (84) bytes of data. 64 bytes from 119.75.218.70: icmp_seq=1 ttl=128 time=9.78 ms 64 bytes from 119.75.218.70: icmp_seq=2 ttl=128 time=4.65 ms 64 bytes from 119.75.218.70: icmp_seq=3 ttl=128 time=8.26 ms-www.a.shifen.com ping statistics-3 packets transmitted, 3 received, 0% packet loss, time 2010ms rtt min/avg/max/mdev = 4.657 www.a.shifen.com ping statistics 7.569 packet loss 9.786 ms
You can use salt-run to view the minion of the current up and down
[root@linux-node1 ~] # salt-run manage.statusdown:up:-linux-node1.example.com-linux-node2.example.com
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.