salt把返回写入到mysql
官方文档:https://docs.saltstack.com/en/2016.3/ref/returners/all/salt.returners.MySQL.html#module-salt.returners.mysql
创新互联服务项目包括太和网站建设、太和网站制作、太和网页制作以及太和网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,太和网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到太和省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
mysql自己搭建
首先要在master机器上创建数据库
CREATE DATABASE `salt` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; USE `salt`; 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; CREATE TABLE `salt_returns` ( `fun` varchar(50) NOT NULL, `jid` varchar(255) NOT NULL, `return` mediumtext NOT NULL, `id` varchar(255) NOT NULL, `success` varchar(10) NOT NULL, `full_ret` mediumtext NOT NULL, `alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, KEY `id` (`id`), KEY `jid` (`jid`), KEY `fun` (`fun`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `salt_events` ( `id` BIGINT NOT NULL AUTO_INCREMENT, `tag` varchar(255) NOT NULL, `data` mediumtext NOT NULL, `alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `master_id` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `tag` (`tag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 授权: grant all on salt.* to salt@'%' identified by 'salt';
master和minion端:
vim /etc/salt/minion mysql.host: '192.168.141.250' #这里的ip写master的ip mysql.user: 'salt' mysql.pass: 'salt' mysql.db: 'salt' mysql.port: 3306 保存退出,并重启服务 /etc/init.d/salt-minion restart
我们执行一条命令:
salt '*' test.ping --return mysql
我们进入mysql命令行:
mysql show databases; use salt; show tables; select * from salt_returns\G; 结果如下: *************************** 1. row *************************** fun: test.ping jid: 20170321234131569065 return: true id: web12.limingyu.com success: 1 full_ret: {"fun_args": [], "jid": "20170321234131569065", "return": true, "retcode": 0, "success": true, "fun": "test.ping", "id": "web12.limingyu.com"} alter_time: 2017-03-21 23:41:32
分享标题:salt把返回写入到mysql
网站路径:http://pwwzsj.com/article/gpoees.html