新聞中心
- Saltstack安裝文檔:https://repo.saltstack.com/#rhel
SaltStack的安裝與簡(jiǎn)單配置,應(yīng)用。

創(chuàng)新互聯(lián)建站是專業(yè)的屏山網(wǎng)站建設(shè)公司,屏山接單;提供網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行屏山網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
一.環(huán)境
Server:centos Linux release 7.2.1511 (Core)
Salt-master:172.18.12.201
Salt-minion:172.18.12.204
二.Saltstack安裝與配置
1. yum安裝
# Salt-master安裝: [root@localhost ~]# yum install https://repo.saltstack.com/yum/RedHat/salt-repo-latest-1.el7.noarch.rpm [root@localhost ~]# yum clean expire-cache [root@localhost ~]# yum install salt-master # Salt-minion安裝,最后一步安裝組件有區(qū)別: [root@localhost ~]# yum install salt-minion
2. 防火墻配置(salt-master)
# CentOS7.2默認(rèn)自帶firewall,無iptable; # 移除系統(tǒng)自帶firewall的開機(jī)啟動(dòng),安裝iptable,設(shè)置iptable開機(jī)啟動(dòng) [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# systemctl disable firewalld.service [root@localhost ~]# yum install iptables-services –y [root@localhost ~]# systemctl enable iptables.service [root@localhost ~]# systemctl restart iptables.service # tcp4506是salt-master發(fā)送命令信息的端口,tcp4506是salt-minion返回信息的端口; # Salt-minion可不做防火墻處理,默認(rèn)iptable規(guī)則即可 [root@localhost ~]# vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 4505 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 4506 -j ACCEPT
3. salt-master配置
#interface參數(shù)綁定master的通信ip,默認(rèn)可不變更,表示所有主機(jī)ip; [root@localhost ~]# sed -i 's/#interface: 0.0.0.0/interface: 172.18.12.201/g' /etc/salt/master # hash_type參數(shù)默認(rèn)可不變更,salt-master也可啟動(dòng),但啟動(dòng)后有告警如下: # [WARNING ] IMPORTANT: Do not use md5 hashing algorithm! Please set "hash_type" to sha256 in Salt Master config! [root@localhost ~]# sed -i 's/#hash_type: md5/hash_type: sha256/g' /etc/salt/master # auto_accept參數(shù)是自動(dòng)認(rèn)證開關(guān),默認(rèn)關(guān)閉,使用salt-key確認(rèn)證書信任 [root@localhost ~]# sed -i 's/#auto_accept: False/auto_accept: True/g' /etc/salt/master
4. salt-minion配置
# master參數(shù)指定master 的ip (或者主機(jī)名),必配參數(shù),如果minion啟動(dòng)時(shí)不能解析到master 主機(jī),啟動(dòng)會(huì)失??; [root@localhost ~]# sed -i 's/#master: salt/master: 172.18.12.201/g' /etc/salt/minion # hash_type參數(shù)同master; [root@localhost ~]# sed -i 's/#hash_type: sha256/hash_type: sha256/g' /etc/salt/master # id參數(shù)設(shè)置salt-minion名,默認(rèn)未設(shè)置,minio名取主機(jī)hostname中設(shè)定的主機(jī)名 [root@localhost ~]# sed -i 's/#id:/id: 172.18.12.204/g' /etc/salt/minion
5. 啟動(dòng)服務(wù)
啟動(dòng)salt-master
# 設(shè)置開機(jī)啟動(dòng),啟動(dòng)后查看狀態(tài); # 啟動(dòng)中有問題可通過"systemctl status salt-master.service"與"salt-mater -l debug"等命令定位故障,下面salt-minion相同 [root@localhost ~]# systemctl enable salt-master.service [root@localhost ~]# systemctl start salt-master.service [root@localhost ~]# systemctl status salt-master.service
啟動(dòng)salt-minion
#設(shè)置開機(jī)啟動(dòng),啟動(dòng)后查看狀態(tài) [root@localhost ~]# systemctl enable salt-minion.service [root@localhost ~]# systemctl start salt-minion.service [root@localhost ~]# systemctl status salt-mionion.service
6. 驗(yàn)證(salt-master)
查看minion表
[root@localhost ~]# salt-key -L
Salt-master已經(jīng)設(shè)置"auto_accept"參數(shù)為"True",minion主機(jī)"172.18.12.204"已在"Acceptd Keys"中(主機(jī)名為salt-minion設(shè)置的id或hostname)。
手動(dòng)認(rèn)證key("auto_accept"參數(shù)為"False"時(shí))
# -A指確認(rèn)"Unacceptd Keys"中的全部minion(unacceptd中的minion列表為紅色,確認(rèn)到accepted列表中后變?yōu)榫G色) [root@localhost ~]# salt-key -A # -a指"Unacceptd Keys"中特定的minion # 或[root@localhost ~]# salt-key -a 172.18.12.204
簡(jiǎn)單的命令測(cè)試
# "*"表示所有"Acceptd Keys"中的minion,也可以對(duì)特定的minion執(zhí)行命令; # 返回值為"True"表示master與minion連接成功 [root@localhost ~]# salt "*" test.ping
#使用"cmd.run"可以執(zhí)行具體的命令 [root@localhost ~]# salt "*" cmd.run "iptables -nL"
文章名稱:CentOS7.2安裝部署SaltStack
網(wǎng)頁(yè)URL:http://fisionsoft.com.cn/article/dhhsedj.html


咨詢
建站咨詢
