说在前面
- 折腾这个搞了半天,现做下记录
安装依赖(操作只在master端)
yum install mysql-python or pip install mysql-python
master端本地数据库中创建对应的表结构
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(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;
--
-- 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 DEFAULT CURRENT_TIMESTAMP,
`master_id` varchar(255) NOT NULL,PRIMARY KEY (`id`),
KEY `tag` (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
更新salt的master配置文件
[[email protected]_75_82_centos private]# egrep -v ‘^$|^#‘ /etc/salt/master
default_include: master.d/*.conf
auto_accept: True
interface: 0.0.0.0
mysql.host: ‘10.105.75.81‘
mysql.user: ‘root‘
mysql.pass: ‘123456#‘
mysql.db: ‘salt‘
mysql.port: 3306
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
return: mysql
master_job_cache: mysql #使用此选项后,就不需要minion端配置
测试返回
[[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
查看数据库已经有数据了
原文地址:https://www.cnblogs.com/guigujun/p/8543788.html
时间: 2024-10-01 02:57:23