SaltStack基础 - 01介绍


SaltStack基础 - 01介绍

一、介绍

THE 30 SECOND SUMMARY
Salt is:

A configuration management system. Salt is capable of maintaining remote nodes in defined states. For example, it can ensure that specific packages are installed and that specific services are running.

A distributed remote execution system used to execute commands and query data on remote nodes. Salt can query and execute commands either on individual nodes or by using an arbitrary selection criteria.

It was developed in order to bring the best solutions found in the world of remote execution together and make them better, faster, and more malleable. 
Salt accomplishes this through its ability to handle large loads of information, and not just dozens but hundreds and even thousands of individual servers quickly through a simple and manageable interface.

SaltStack是基于Python开发的一套C/S架构配置管理工具(功能不仅仅是配置管理,如使用salt-cloud配置AWS EC2实例)。

它的底层使用ZeroMQ消息队列pub/sub方式通信,使用SSL证书签发的方式进行认证管理。

号称世界上最快的消息队列ZeroMQ使得SaltStack能快速在成千上万台机器上进行各种操作。

而且采用RSA Key方式确认身份,传输采用AES加密,这使得它的安全性得到了保障。

SaltStack经常被描述为Func加强版+Puppet精简版。

SaltStack三大功能: 远程执行(执行远程命令)、 配置管理(状态管理)、 云管理

二、SaltStack特征

  • 1)部署简单、方便;
  • 2)支持大部分UNIX/Linux及Windows环境;
  • 3)主从集中化管理;
  • 4)配置简单、功能强大、扩展性强;
  • 5)主控端(master)和被控端(minion)基于证书认证,安全可靠;
  • 6)支持API及自定义模块,可通过Python轻松扩展。

三、SaltStack架构

在SaltsStack架构中,服务端叫作Master,客户端叫作Minion,都是以守护进程的模式运行,

一直监听配置文件中定义的ret_port端口(SaltStack客户端与服务端通信的端口,负责接收客户端发送过来的结果,默认4506端口),和publish_port(SaltStack的消息发布系统,默认4505端口)。

当Minion运行时会自动连接到配置文件中定义的Master地址的ret_port端口进行连接认证。

四、SaltStack组件 

  • Master:       控制中心,salt命令运行和资源状态管理
  • Minion:       需要管理的客户端机器,会主动去连接Mater端,并从Master端得到资源状态信息,同步资源管理信息
  • States:       配置管理的指令集
  • Modules:      在命令行中和配置文件中使用的指令模块,可以在命令行中运行
  • Grains:       minion端的变量,静态的
  • Pillar:       minion端的变量,动态的比较私密的变量,可以通过配置文件实现同步minions定义
  • highstate:    为minion端下发永久添加状态,从sls配置文件读取。即同步状态配置
  • salt_schedule:会自动保持客户端配置

 

五、SaltStack运行模式

  • Local:         本地,一台机器,不建议
  • Master/Minion: 通过server/agent的方式进行管理,效率很高(批量管理1000台机器,25秒搞定)
  • Salt SSH:      通过SSH方式进行管理,效率相对来说比较低(批量管理1000台机器,83秒搞定)

 

相关