Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The execution result of saltstack is returned to mysql

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

System: ubuntu 17.04

Official document 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'

(this is mysql on ubuntu)

Root@jy-KVM1:~# cat / etc/mysql/mysql.conf.d/mysqld.cnf | grep bind

# bind-address = 127.0.0.1 # comment out and allow other machines to access

#

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

Execute on master

# salt'* 'test.ping

View the database

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 >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report