MySql教程

salt-master 执行结果返回到mysql上存储

本文主要是介绍salt-master 执行结果返回到mysql上存储,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

salt-master 执行结果返回到mysql上存储

  • mysql上创建库和授权
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 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';
flush privileges;
  • 安装mysql-python模块和配置master
#pip3 install --target=/usr/lib/python3.6/site-packages/ mysqlclient
# vim /etc/salt/master
master_job_cache: mysql
mysql.host: '192.168.5.157'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306
# systemctl restart salt-master
这篇关于salt-master 执行结果返回到mysql上存储的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!