利器:大规模集群管理工具——saltstack
主机准备
虚拟机两台
[root@saltmaster ~]# hostname -I
192.168.60.120
[root@saltminion ~]# hostname -I
192.168.60.121
软件安装
服务端安装salt-master和salt-minion
客户端只安装salt-minion,不安装salt-master
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y epel-release
yum install -y salt-master salt-minion
服务配置
服务端
#配置自动接收认证
sed -i 's/#auto_accept: False/auto_accept: True/g' /etc/salt/master
#指定master
sed -i 's/#master: salt/master: 192.168.60.120/g' /etc/salt/minion
客户端
#指定master
sed -i 's/#master: salt/master: 192.168.60.120/g' /etc/salt/minion
启动
服务端
systemctl restart salt-master.service
systemctl status salt-master.service
systemctl enable salt-master.service
客户端
systemctl restart salt-minion
systemctl enable salt-minion
systemctl status salt-minion
验证
[root@saltmaster ~]# salt '*' test.ping
saltminion:
True
saltmaster:
True
[root@saltmaster ~]# salt '*' cmd.run 'df -h'
saltmaster:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 48G 1.9G 46G 4% /
devtmpfs 225M 0 225M 0% /dev
tmpfs 236M 16K 236M 1% /dev/shm
tmpfs 236M 4.6M 232M 2% /run
tmpfs 236M 0 236M 0% /sys/fs/cgroup
/dev/sda1 497M 155M 343M 32% /boot
tmpfs 48M 0 48M 0% /run/user/0
saltminion:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 48G 2.0G 46G 5% /
devtmpfs 225M 0 225M 0% /dev
tmpfs 236M 12K 236M 1% /dev/shm
tmpfs 236M 4.6M 232M 2% /run
tmpfs 236M 0 236M 0% /sys/fs/cgroup
/dev/sda1 497M 155M 343M 32% /boot
tmpfs 48M 0 48M 0% /run/user/0
转自:Saltstack 快速入门教程
感谢博主无私分享!
本文对只安装配置过程做了精简,详细介绍参考原文。
================# 水平有限 欢迎指正 #=================