Saltstack

https://github.com/pingcap/tidb

TiDB 简介:
参考tidb使用手册
    https://pingcap.com/docs-cn
TiDB Binary 部署指导:
    https://pingcap.com/doc-binary-deployment-zh
集群:
    时间必须同步|主机名解析

110云告警官方参考文档

http://wiki.110monitor.com/integration/zabbix-manual.html

Zabbix AIP接口调用:

https://www.zabbix.com/documentation/3.2/manual/api 

zabbix API二次开发使用与介绍:

http://www.ttlsa.com/zabbix/zabbix-dev-api/

Zabbix系统数据采集方法总结:

http://blog.chinaunix.net/uid-20104120-id-4120426.html

Saltstack

三大功能:
        远程执行
        配置管理(状态)
        云管理
    其它产品:
        Puppet(ruby):不支持远程执行|puppet+func
        Ansible(Python)

    4种运行方式:
        local

1.4中工作模式(master/minion/syndic/ssh(串行的))

实验环境:
    两台虚拟机
    书写语法:-两边必须有空格
    书写顺序就是资源启动顺序

部署saltstack

配置yum源

[root@salt1 ~]# cat /etc/yum.repos.d/rhel-source.repo 
[Server]
name=Server
baseurl=http://172.25.30.250/rhel6.5
gpgcheck=0


[rhel6]
name=rhel6
baseurl=http://172.25.30.250/rhel6  #此时rhel6需要有访问权限
gpgcheck=0
[root@salt1 ~]# yum list salt*
[root@salt1 ~]# yum install salt-master -y
[root@salt1 ~]# /etc/init.d/salt-master start
Starting salt-master daemon:                               [  OK  ]
[root@salt1 ~]#


[root@salt2 ~]# yum install salit-minion -y
[root@salt2 ~]# vim /etc/hosts
[root@salt2 ~]# vim /etc/salt/minion
....
 16 master: salt1   #此时需要爱有主机名解析
[root@salt2 ~]# ping salt1
[root@salt2 ~]# /etc/init.d/salt-minion start
Starting salt-minion:root:salt2 daemon: OK
[root@salt2 ~]# 





[root@salt1 ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt2
Rejected Keys:
[root@salt1 ~]# salt-key -A    #接受key-->salt2
The following keys are going to be accepted:
Unaccepted Keys:
salt2
Proceed? [n/Y] y
Key for minion salt2 accepted.
[root@salt1 ~]# salt-key -L
Accepted Keys:
salt2
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt1 ~]# salt salt2 test.ping   #在salt2上运行ping命令
salt2:
    True
[root@salt1 ~]# salt salt2 cmd.run hostname        #在salt2上运行hostnam命令
salt2:
    salt2
[root@salt1 ~]# salt salt2 cmd.run uptime
salt2:
     17:33:08 up  1:02,  2 users,  load average: 0.04, 0.05, 0.01
[root@salt1 ~]# 





[root@salt1 ~]# vim /etc/salt/master
.....
 534 file_roots:
 535   base:
 536     - /srv/salt
.....
[root@salt1 ~]# mkdir /srv/salt/
[root@salt1 ~]# cd /srv/salt/
[root@salt1 salt]# ls
[root@salt1 salt]# mkdir httpd
[root@salt1 salt]# cd httpd/
[root@salt1 httpd]# ls
[root@salt1 httpd]# vim install.sls
apache-install:
  pkg.installed:
    - pkgs:
      - httpd
      - php
&&注意书写格式:用空格不要用tab
[root@salt1 httpd]# salt salt2 state.sls httpd.install  #若没有出error则运行成功

***测试:
[root@salt2 ~]# rpm -qa | grep php #自动安装成功
php-common-5.3.3-26.el6.x86_64
php-5.3.3-26.el6.x86_64
php-cli-5.3.3-26.el6.x86_64
[root@salt2 ~]# rpm -qa | grep httpd
httpd-tools-2.2.15-29.el6_4.x86_64
httpd-2.2.15-29.el6_4.x86_64
[root@salt2 ~]# /etc/init.d/httpd status
httpd is stopped    #此时服务并没有开启
[root@salt2 ~]# 






[root@saltstack1 httpd]# vim install.sls 
apache-install:     #安装服务:定义顺序则是服务的安装和启动顺序
  pkg.installed:
    - pkgs:
      - httpd
      - php

  service.running:
    - name: httpd
    - anable: true
[root@salt1 httpd]# salt salt2 state.sls httpd.install  #在salt2上实现自动部署

[root@salt2 ~]# /etc/init.d/httpd status
httpd (pid  2350) is running...  #已start成功




自动化部署lnmp:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值