In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly discusses the use of Saltstack automatic operation and maintenance tools. There is a certain reference value, friends in need can refer to, follow the editor to see how to use it.
1.1 githup address
Https://github.com/ansible/ansible
Https://github.com/saltstack/salt
1.2. Execution logging to mysql
Https://docs.saltstack.com/en/latest/ref/returners/all/
one。 Comparison of automatic operation and maintenance tools Saltstack and Ansible
1.ansible introduction
1.1 No Agent decentralization, managed by native SSH protocol (need to get through SSH key-free login in advance)
1.2 in fact, ansible also supports agent, the so-called "pull" mode, which is to pull the task to be performed through a client.
1.3 on open source community activity Github, ansbile has 42.2k statistics source address: https://github.com/ansible/ansible
1.4 main functions
1.4.1 Ansible is based entirely on Python, which facilitates the secondary development of Ansible.
1.4.2 rich built-in modules with low learning barriers
1.4.3 the Playbook script simplifies environment deployment.
1.5 Ansible just provides a framework.
It mainly includes:
1.5.1 connection plug-in connection plugins: responsible for communicating with the monitored end
1.5.2 host inventory: the host for the specified operation, which is the host for monitoring defined in the configuration file
1.5.3 various modules core modules, command modules, custom modules
1.5.4 complete functions such as logging messages with the help of plug-ins
1.5.5 playbook: when the script performs multiple tasks, let the node run multiple tasks at once.
1.6 implement the principle process
2. Saltstack introduction
2.1 Agent to connect the controlled machine needs to be installed, master address needs to be configured on the agent side, and the open communication port for establishing trust relationship defaults to: 4506max 4505
2.2 the ability of large-scale concurrency: differences in implementation mechanisms also lead to saltstack being dominant in this respect. If there are more than a thousand machines operated at a time, it is more efficient to use saltstack.
2.3Open source community activity Saltstack 10.7k on Github source address: https://github.com/saltstack/salt
2.4 main functions:
2.4.1 Master-slave centralized management
2.4.2 simple configuration, powerful function and strong expansibility
2.4.3 master and minion are based on certificate authentication and are safe and reliable
2.4.4 support for API and custom modules, which can be easily extended through Python
2.5 saltstack internal working schematic diagram
2.4.1 Minion is a client installation component that needs to be managed by SaltStack. It will actively connect to the Master side, get resource status information from the Master side, and synchronize resource management information.
2.4.2 Master runs on the host server as a control center and is responsible for the operation of Salt commands and the management of resource status.
2.4.3 ZeroMQ is an open source message queuing software used to build a system communication bridge between Minion and Master.
2.4.4 Daemon is a daemon running in each member, which undertakes the function of issuing messages and listening on communication ports.
2.6 execution process
II. Satstack deployment practice
1. System environment list
System version kernel version system python version saltstack-master version saltstack-minion version CentOS 7.2.15113.10.0-862.6.3.el7.x86_64Python 2.7.5salt 2015.5.10salt-minion 2015.5.10
two。 Deployment planning
Deployment recommendations:
1. Cluster deployment is adopted when the operation volume of the production environment is large and resources permit. Put an end to single point failure
3. Simplified deployment
3.1The deployment description of the environment in this article: mysql, one saltstack-matser, one saltstack-monion, 3.2obtaining software packages, root@salt-master ~] # yum-y install epel-release & & yum-y install salt-maste 3.3.Configuring salt-master configuration file Root@salt-master ~] # grep-v "^ #" / etc/salt/master | grep-v "^ $" interface: 192.168.54.12 # ip address of the executive management side publish_port: 4505 # # Executive management side service listening port user: ops # # Executive management side user address max_open_files: 100000 # maximum number of file openings worker_threads: 16 # # it is recommended that the number of worker threads on cpu should not be greater than the number of cores of the system ret_port: 4506 # data acquisition and reporting port pidfile: / var/run/salt-master.pid # # allow pidtimeout: 5 # # data collection timeout base:-/ etc/salt # saltstack configuration file to write the root directory pillar_roots stored in yaml: # pillar directory base:-/ etc/pillarsyndic_master_port: 4506 # synchronization information port log_file: / var/log/salt/chj-salt-master # # Log file path log_level: warning log_level_logfile: warning # Log level client_acl: ops: # # Authorization Executable salt command user -'* 'return: mysql # executes the command to return result statistics for security audit and command audit. Master_job_cache: mysql # database authorization information Mysql.host: '192.168.54.23' # connection address supports other database types. See: https://docs.saltstack.com/en/latest/ref/returners/all/mysql.user: 'salt' # connection user mysql.pass:' saltstack' # connection password mysql.db: 'salt' # connection database mysql.port: 3306 # database port
3.4 install the salt-minion side
3.4.1 to save installation time, use ansible to batch
3.5 install the salt-monion client
1. Perform remote installation of salt-minion side [ops@devops-manager-dev tools] $ansible-I ip.txt all-m shell-a "yum-y install epel-release & & yum-y install salt-minion"-b-f 3 2. Distribute the script to modify the configuration file; 2.1. Script content: # / bin/bashminid=$ (echo $RANDOM | md5sum | cut-c 1-6) sed-I '1imaster: 192.168.54.12' / etc/salt/minionsed-I '2ilog_file: / var/log/salt/chj-minion.log' / etc/salt/minionsed-I' 3iuser: root' / etc/salt/minionsed-I "4iid: chj_salt_$minid" / etc/salt/minionmkdir / var/log/salt/touch / var/log/ Salt/chj-minion.logchown ops:ops / var/log/salt-R3 begins distribution Ansible-I ip.txt all-m copy-a "src=./salt_minon.sh dest=/tmp/salt_minon.sh"-b-f 34. Execute the modification file script ansible-I ip.txt all-m shell-a "/ bin/bash / tmp/salt_minon.sh"-b-f 35. Start the salt-minion service [ops@salt-master devops] $ansible-I ip.txt all-m shell-a "systemctl start salt-minion"-b-f 3Thursday 12 March 2020 21:33:02 + 0800 (0V 0015 00.090) 0V 00V 00.090 * 192.168.46.21 | CHANGED | rc=0 > > 192.168.46.18 | CHANGED | rc=0 > 192.168.46.20 | CHANGED | rc=0 > 192.168.46.224 | CHANGED | Rc=0 > > 192.168.46.158 | CHANGED | rc=0 > >
3.6.salt test.ping test
Comparison of execution time between 3.7.ansible and saltstack
3.8 the verification execution result is returned to the mysql database
Check to see if any data is returned in the mysql table (timestamp problem because the test environment mysql did not modify the time zone gap of 8 hours using docker)
On the use of Saltstack automated operation and maintenance tools to share here, to solve the problem and not only in the article and everyone's analysis of the method, but the accuracy of this analysis is indisputable. If you like this article, you might as well share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.