快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

saltstack执行结果返回到mysql

系统:ubuntu 17.04

10年的永平网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销的优势是能够根据用户设备显示端的尺寸不同,自动调整永平建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“永平网站设计”,“永平网站推广”以来,每个客户项目都认真落实执行。

官方文档https://docs.saltstack.com/en/latest/ref/returners/all/salt.returners.MySQL.html

master
(salt-master , mysql,python2.7-mysql)

syndic
(salt-master,mysql-client,salt-syndic,python2.7-mysql)

minion
(salt-minion,mysql-client,python2.7-mysql)

master

#cat /etc/salt/master|grep -v "#" |grep -v "^ *$"
ipv6: False
interface: 192.168.90.177
auto_accept: True
state_top: top.sls
order_masters: True
return: mysql

################################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;

mysql> use salt
mysql> show tables;
+----------------+
| Tables_in_salt |
+----------------+
| jids |
| salt_events |
| salt_returns |
+----------------+

grant all on salt.* to salt@'%' identified by 'salt';

(此为ubuntu上的mysql)
root@jy-KVM1:~# cat /etc/mysql/mysql.conf.d/mysqld.cnf |grep bind
#bind-address = 127.0.0.1 #注释掉,允许其他机器访问

#########################################################################

syndic

#cat /etc/salt/master|grep -v "#" |grep -v "^ *$"
ipv6: False
auto_accept: True
file_roots:
base:

  • /etc/salt/base
    prod:
  • /etc/salt/prod
    syndic_master: 192.168.90.177

minion

#cat /etc/salt/minion|grep -v "#" |grep -v "^ *$"
master: 192.168.90.178
id: 192.168.90.179
mysql.host: '192.168.90.177'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306

在master上执行

#salt '*' test.ping

查看数据库

6. row
fun: test.ping
jid: 20171204130021772990
return: true
id: 192.168.90.179
success: 1
full_ret: {"fun_args": [], "jid": "20171204130021772990", "return": true, "retcode": 0, "success": true, "fun": "test.ping", "id": "192.168.90.179"}
alter_time: 2017-12-04 13:00:23
6 rows in set (0.01 sec)

ERROR:
No query specified

mysql>


网站名称:saltstack执行结果返回到mysql
转载来于:http://6mz.cn/article/ihojji.html

其他资讯