saltstack (4) 用mysql儲存 salt 傳回值

來源:互聯網
上載者:User

標籤:salt 傳回值 returner

Salt返回接收器(returner)允許把minion的響應儲存在各種資料存放區或不同的位置,甚至把響應內容顯示在命令列。Returner可以用來擴充Salt,和新的、定製的介面和支援新的資料庫進行通訊。本例用mysql儲存salt傳回值 

操作如下:

[[email protected] ~]# yum -y install mysql-connector-python

[[email protected] ~]# yum -y install MySQL-python27

[[email protected] ~]# yum -y install mysql-server

[[email protected] ~]# /etc/init.d/mysqld start

[[email protected] ~]# mysql

CREATE DATABASE  `salt`

  DEFAULT CHARACTER SET utf8

  DEFAULT COLLATE utf8_general_ci;


USE `salt`;


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;


DROP TABLE IF EXISTS `salt_returns`;


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;


DROP TABLE IF EXISTS `salt_events`;

CREATE TABLE `salt_events` (

`id` BIGINT NOT NULL AUTO_INCREMENT,

`tag` varchar(255) NOT NULL,

`data` varchar(1024) NOT NULL,

`alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

PRIMARY KEY (`id`),

KEY `tag` (`tag`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

grant all on salt.* to [email protected]‘172.31.%‘ identified by ‘salt‘;

flush privileges ;

exit

[[email protected] ~]# vim /etc/salt/master 

#return: mysql

master_job_cache: mysql

mysql.host: ‘172.31.24.139‘

mysql.user: ‘salt‘

mysql.pass: ‘salt‘

mysql.db: ‘salt‘

mysql.port: 3306

[[email protected] ~]# /etc/init.d/salt-master restart

[[email protected] ~]# salt ‘*‘ saltutil.refresh_pillar

[[email protected] ~]# salt ‘*‘ test.ping

[[email protected] ~]# mysql

use salt;

select * from salt_returns;

exit

[[email protected] ~]# 

本文出自 “11462293” 部落格,請務必保留此出處http://11472293.blog.51cto.com/11462293/1884477

saltstack (4) 用mysql儲存 salt 傳回值

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.