saltstack 从minion传送文件到master及minion文件后端minionfs系统

简介: 演示如下: vagrant@saltminion1:/tmp$ touch talen.txt vagrant@saltminion1:/tmp$ echo This is a test .
演示如下:

  1. vagrant@saltminion1:/tmp$ touch talen.txt
  2. vagrant@saltminion1:/tmp$ echo This is a test . > talen.txt


  1. vagrant@saltmaster:/var/cache/salt/master$ sudo salt '*' test.ping
  2. minion2:
  3.     True
  4. minion1:
  5.     True
  6. vagrant@saltmaster:/var/cache/salt/master$ sudo salt '*' cp.push /tmp/talen.txt
  7. minion2:
  8.     False
  9. minion1:
  10.     True
  11. vagrant@saltmaster:/var/cache/salt/master$ cd /var/cache/salt/master/minions/minion
  12. minion1/ minion2/
  13. vagrant@saltmaster:/var/cache/salt/master/minions$ tree
  14. .
  15. ├── minion1
  16. │   ├── files
  17. │   │   └── tmp
  18. │   │   └── talen.txt
  19. │   └── mine.p
  20. └── minion2
  21.     └── mine.p

  22. 4 directories, 3 files

有时,我们需要传送在minion上产生的文件.
salt已经有从minion上传送文件到master的特性.默认因为安全性问题,没有启用.
修改master启用这个特性.
file_recv: True

点击(此处)折叠或打开

  1. vagrant@saltmaster:~ $ vim /etc/salt/master

  2. # Allow minions to push files to the master. This is disabled by default, for
  3. # security purposes.
  4. #file_recv: False
  5. file_recv: True

salt-cp cp模块是minion端的,其它函数功能参考
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.cp.html#salt.modules.cp.push


# File Server Backend
#文件服务后端
#
# Salt supports a modular fileserver backend system, this system allows
# the salt master to link directly to third party systems to gather and
# manage the files available to minions. Multiple backends can be
# configured and will be searched for the requested file in the order in which
# they are defined here. The default setting only enables the standard backend
# "roots" which uses the "file_roots" option.
#salt支持一个模块化的文件服务后端系统,这个系统允许master直接链接到第三方平台系统收集和管理minions上的文件.请求文件将按定义的多个后端的顺序查询.默认使用file_roots选项只启用了最基本的roots.
#fileserver_backend:
#  - roots
#
# To use multiple backends list them in the order they are searched:
#fileserver_backend:
#  - git
#  - roots
#按顺序列出要查询的后端列表.
#
#如果你想让file_server允许追踪软链接文件系统树,取消下面的注释.默认是开启的,当前默认只应用于默认的文件服务后端.
# Uncomment the line below if you do not want the file_server to follow
# symlinks when walking the filesystem tree. This is set to True
# by default. Currently this only applies to the default roots
# fileserver_backend.
#fileserver_followsymlinks: False
#
# Uncomment the line below if you do not want symlinks to be
# treated as the files they are pointing to. By default this is set to
# False. By uncommenting the line below, any detected symlink while listing
# files on the Master will not be returned to the Minion.
#fileserver_ignoresymlinks: True
#
# By default, the Salt fileserver recurses fully into all defined environments
# to attempt to find files. To limit this behavior so that the fileserver only
# traverses directories with SLS files and special Salt directories like _modules,
# enable the option below. This might be useful for installations where a file root
# has a very large number of files and performance is impacted. Default is False.
# fileserver_limit_traversal: False
#
# The fileserver can fire events off every time the fileserver is updated,
# these are disabled by default, but can be easily turned on by setting this
# flag to True
#fileserver_events: False




如果想使用minion上的文件系统,简单启用两个参数
fileserver_backend:
  - roots
  - minion

file_recv: True
从下面的执行可以看到,当我们从minion1服务器上传文件到master后,minion1的上传目录/tmp已经可以在其它minions上看到了.
其它minions可以从minion1上共享的目录下载文件.

点击(此处)折叠或打开

  1. vagrant@saltmaster:~$ sudo salt '*' cp.list_master_dirs
  2. minion2:
  3.     - .
  4.     - common
  5.     - minion1/tmp
  6. minion1:
  7.     - .
  8.     - common
  9.     - minion1/tmp
  10. vagrant@saltmaster:~$ sudo salt 'minion2' cp.get_file salt://minion1/tmp/talen.txt /tmp/talen.2.txt
  11. minion2:
  12.     /tmp/talen.2.txt
  13. vagrant@saltminion2:~$ ll /tmp/talen.2.txt
  14. -rw-r--r-- 1 root root 17 Apr 27 03:47 /tmp/talen.2.txt


目录
相关文章
|
1月前
|
设计模式 物联网 Android开发
移动应用与系统:探索未来技术的融合之路后端开发中的设计模式探索
【8月更文挑战第21天】随着科技的飞速发展,移动应用和操作系统已经成为我们日常生活中不可或缺的一部分。本文将深入探讨移动应用开发和移动操作系统的相关话题,包括它们的历史、现状以及未来的发展趋势。我们将从移动应用的开发环境、编程语言和工具等方面进行详细的分析,同时也会讨论移动操作系统的特点、优势以及面临的挑战。最后,我们将展望移动应用与系统在未来技术融合中的可能方向和机遇。
123 58
|
2天前
|
缓存 NoSQL 安全
构建高效后端系统的关键步骤
本文将探讨如何设计和实现一个高效的后端系统。我们将从系统架构、数据库设计、缓存策略、安全性以及性能优化等多个方面进行详细讲解。通过遵循这些指导原则,你可以构建出一个既灵活又高性能的后端系统,满足现代应用程序的需求。
|
3天前
|
JavaScript 前端开发 数据库
优化后端性能:如何使用异步编程提升系统响应速度
异步编程已成为现代后端系统性能优化的重要策略。通过避免阻塞操作,异步编程可以显著提高系统的响应速度和并发处理能力。本文章深入探讨了异步编程的基本概念,比较了常见的异步编程模型,并通过实际案例演示如何在Node.js和Python中实现异步操作,以提升系统性能。
|
3天前
|
存储 前端开发 API
探索后端技术:构建高效系统的关键路径
在数字化时代,后端技术作为软件架构的核心支柱,承载着处理数据逻辑、服务前端应用和确保系统稳定运行的重要职责。本文将深入浅出地介绍后端技术的基础知识、关键组件以及在实际项目中的应用实践,旨在为开发者提供一条清晰的学习路径,助力其构建高效、可扩展的后端系统。通过案例分析和最佳实践的分享,我们将揭示如何运用现代后端技术解决复杂业务问题,提升用户体验,并推动企业的数字化转型进程。
|
2天前
|
存储 缓存 安全
构建高效后端系统的关键要素
本文将探讨后端开发中的一些关键概念和技术,包括系统架构设计、性能优化以及安全性保障。通过实例分析,帮助读者理解如何构建一个高效且可靠的后端系统。无论是新手还是经验丰富的开发者,都能从中获得启发和实用建议。
9 0
|
27天前
|
存储 API 持续交付
探索微服务架构:构建灵活、可扩展的后端系统
【8月更文挑战第25天】 本文将引导您理解微服务架构的核心概念,探讨其对现代后端系统设计的影响。我们将从基础讲起,逐步深入到微服务的高级应用,旨在启发读者思考如何利用微服务原则优化后端开发实践。
39 4
|
1月前
|
存储 安全 数据管理
构建高效后端系统的关键要素
【8月更文挑战第20天】在数字化时代,后端系统是支撑应用程序运行的骨干。本文将深入探讨如何构建一个高效、可扩展且安全的后端系统,涵盖架构设计、性能优化、数据管理及安全性考量等方面。通过分析当前技术趋势与挑战,文章旨在为开发者提供一套实用的指导原则和最佳实践,以应对不断变化的技术环境和应用需求。
|
1月前
|
存储 缓存 安全
构建高效后端系统的关键要素
【8月更文挑战第20天】在数字化时代,后端系统是支撑企业业务的核心。本文将探讨构成高效后端系统的五大关键要素,包括架构设计、性能优化、数据管理、安全策略和可扩展性。这些要素共同确保了后端系统的稳定性、可靠性和效率,是现代软件开发中不可或缺的组成部分。通过深入分析每个要素的作用和实现方式,本文旨在为读者提供一套全面的指导原则,帮助他们构建和维护高性能的后端系统。
27 1
|
24天前
|
消息中间件 缓存 Java
如何优化大型Java后端系统的性能:从代码到架构
当面对大型Java后端系统时,性能优化不仅仅是简单地提高代码效率或硬件资源的投入,而是涉及到多层次的技术策略。本篇文章将从代码层面的优化到系统架构的调整,详细探讨如何通过多种方式来提升Java后端系统的性能。通过对常见问题的深入分析和实际案例的分享,我们将探索有效的性能优化策略,帮助开发者构建更高效、更可靠的后端系统。
|
26天前
|
存储 API 数据库
Django后端架构开发:构建在线云媒资系统思路解析
Django后端架构开发:构建在线云媒资系统思路解析
32 0