Salt Data Synchronization Mode
Way One:
Minion automatically synchronizes data to master:
The default is 60 seconds to automatically synchronize data once
Automatic synchronization time interval is determined by parameter Loop_interval (minion side)
[[email protected] salt]# grep loop_interval/etc/salt/minion
# The Loop_interval sets how long in seconds the minion would wait between
#Loop_interval: 60
If we want Minion to never sync automatically, you can change the value of this parameter a bit.
loop_interval:3153600000 (set 100-year sync once)
Way two:
The master side performs data synchronization by executing commands:
The test configuration is correct and there is no real push data:
Salt ' * ' state.highstate-v test
Salt ' * ' state.highstate-v test=true
Salt ' * ' state.highstate-v test=true
Push all data to all minion:
Salt ' * ' state.highstate
To push all the data to a single minion:
Salt ' 192.168.186.129 ' state.highstate
Push all data to a group:
Salt-n ' Bjwebgroup ' state.highstate
Only push web data to this template directory for all minion
Salt ' * ' state.sls web
Note:
[email protected] salt]# cat Top.sls
Base
' Bjwebgroup ':
-Match:nodegroup
- Web
Push only the Httpd.sls file below the Web template to all minion:
Salt ' * ' State.sls web.httpd
Note:
[Email protected] web]# pwd
/srv/salt/web
[[email protected] web]# ls
Files Httpd.sls Init.sls
To all minion only push the Web template under the PHP directory below the Conf.sls file:
Salt ' * ' State.sls web.php.conf
Attention:
[Email protected] php]# pwd
/srv/salt/web/php
[[email protected] php]# ls
Conf.sls
Additional:
Salt Common commands:
Salt ' * ' Grains.ls View grains categories
Salt ' * ' grains.items view grains All information
Salt ' * ' grains.item OS view grains a message
Salt ' * ' Pillar.items view pillar all information
Salt ' * ' Pillar.item users view pillar a message
[[email protected] salt]# Salt ' * ' Grains.item OS
192.168.186.129:
----------
Os
Centos
[[email protected] salt]# Salt ' * ' grains.item FQDN
192.168.186.129:
----------
Fqdn:
Scj.51.com
[[email protected] salt]# Salt ' * ' Grains.item host
192.168.186.129:
----------
Host
Scj
Salt ' match regular ' state.highstate matching regular
[[email protected] salt]# Salt ' * ' state.highstate
Salt-n ' GroupName ' state.highstate specify a group
[[email protected] salt] #salt-n ' bjwebgroup ' state.highstate
Salt-l ' minion1,minion2,minion3 ' state.highstate specify multiple Minion
[Email protected] salt]# salt-l ' 192.168.186.129,192.168.186.128 ' State.sls web.php.conf
This article is from the "See" blog, please be sure to keep this source http://732233048.blog.51cto.com/9323668/1640990
Saltstack Management Six Data synchronization method