Say in front
- Toss this for a while, now do the next record
Installation dependency (operation only on Master side)
yum install mysql-python or pip install mysql-python
Create the corresponding table structure in the master side local database
CREATE DATABASE ' salt ' default CHARACTER SET UTF8 default COLLATE utf8_general_ci; Use ' salt '; ----table structure for table ' Jids '--DROP table IF EXISTS ' jids '; CREATE TABLE ' jids ' (' jid ' varchar (255) NOT NULL, ' load ' mediumtext not NULL, UNIQUE KEY ' Jid ' (' Jid ')) Engine=innodb DEFAULT Charset=utf8; CREATE INDEX Jid on Jids (Jid) USING BTREE; ----table structure for table ' Salt_returns '--DROP table IF EXISTS ' salt_returns '; CREATE TABLE ' salt_returns ' (' fun ' varchar (#) NOT null, ' jid ' varchar (255) is not NULL, ' return ' mediumtext not NULL, ' ID ' varchar (255) NOT NULL, ' success ' varchar (TEN) NOT null, ' Full_ret ' mediumtext not null, ' Alter_time ' TIMESTAMP Defau LT Current_timestamp, key ' id ' (' id '), key ' Jid ' (' Jid '), key ' fun ' (' fun ')) Engine=innodb DEFAULT Charset=utf8; ----Table structure for table ' salt_events '--DROP table IF EXISTS ' salt_events '; CREATE TABLE ' salt_events ' (' id ' BIGINT NOT NULL auto_increment, ' tag ' varchar (255) NOT NULL, ' data ' mediumtExt not NULL, ' alter_time ' TIMESTAMP the DEFAULT current_timestamp, ' master_id ' varchar (255) Not null,primary KEY (' id '), K EY ' tag ' (' tag ')) Engine=innodb DEFAULT Charset=utf8;
Update the master configuration file for the salt
[[email protected]_75_82_centos private]# egrep -v ‘^$|^#‘ /etc/salt/masterdefault_include: master.d/*.confauto_accept: Trueinterface: 0.0.0.0mysql.host: ‘10.105.75.81‘ mysql.user: ‘root‘mysql.pass: ‘123456#‘mysql.db: ‘salt‘mysql.port: 3306file_roots: base: - /srv/salt/pillar_roots: base: - /srv/pillarreturn: mysqlmaster_job_cache: mysql #使用此选项后,就不需要minion端配置
Test returns
[[email protected]_75_82_centos private]# salt ‘*‘ cmd.run ‘ls‘ node82: anaconda-ks.cfg[[email protected]_75_82_centos private]# salt ‘*‘ cmd.run ‘uptime‘ node82: 20:15:20 up 1 day, 8:06, 2 users, load average: 0.07, 0.13, 0.13
See the database already has data
SALT-API return MySQL Returns the use of logging operations log