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


目录
相关文章
|
7月前
|
JavaScript 前端开发 Java
制造业ERP源码,工厂ERP管理系统,前端框架:Vue,后端框架:SpringBoot
这是一套基于SpringBoot+Vue技术栈开发的ERP企业管理系统,采用Java语言与vscode工具。系统涵盖采购/销售、出入库、生产、品质管理等功能,整合客户与供应商数据,支持在线协同和业务全流程管控。同时提供主数据管理、权限控制、工作流审批、报表自定义及打印、在线报表开发和自定义表单功能,助力企业实现高效自动化管理,并通过UniAPP实现移动端支持,满足多场景应用需求。
687 1
|
3月前
|
存储 前端开发 安全
实现“永久登录”:针对蜻蜓Q系统的用户体验优化方案(前端uni-app+后端Laravel详解)-优雅草卓伊凡
实现“永久登录”:针对蜻蜓Q系统的用户体验优化方案(前端uni-app+后端Laravel详解)-优雅草卓伊凡
215 5
|
5月前
|
小程序 安全 关系型数据库
专业打造一款圈子源码软件系统 / 后端 PHP 搭建部署一样实现利益化
本教程详解基于PHP后端与Uni-app的小程序开发全流程,涵盖技术选型、环境搭建、源码导入、接口对接及功能实现。采用Laravel/Symfony框架,结合MySQL/PostgreSQL数据库,使用WebSocket实现实时通信,并集成IM SDK实现音视频聊天。前端使用Uni-app开发,支持跨平台运行。教程包含完整部署流程与安全优化方案,助力快速搭建高性能、安全稳定的小程序系统。
424 5
|
7月前
|
存储 消息中间件 前端开发
PHP后端与uni-app前端协同的校园圈子系统:校园社交场景的跨端开发实践
校园圈子系统校园论坛小程序采用uni-app前端框架,支持多端运行,结合PHP后端(如ThinkPHP/Laravel),实现用户认证、社交关系管理、动态发布与实时聊天功能。前端通过组件化开发和uni.request与后端交互,后端提供RESTful API处理业务逻辑并存储数据于MySQL。同时引入Redis缓存热点数据,RabbitMQ处理异步任务,优化系统性能。核心功能包括JWT身份验证、好友系统、WebSocket实时聊天及活动管理,确保高效稳定的用户体验。
462 4
PHP后端与uni-app前端协同的校园圈子系统:校园社交场景的跨端开发实践
|
SQL API 容器
开箱即用的 GoWind Admin|风行,企业级前后端一体中后台框架:后端项目结构说明
GoWind Admin|风行是一款企业级前后端一体中后台框架,后端采用Go语言,基于Protobuf定义API,支持Buf代码生成与Docker部署。项目结构清晰,含API定义、服务实现、数据库ORM、配置管理及自动化脚本,开箱即用,助力高效开发。
273 0
|
6月前
|
JSON Cloud Native Go
开箱即用的 GoWind Admin|风行,企业级前后端一体中后台框架:后端权限控制
GoWind Admin「风行」是企业级中后台框架,集成Casbin与OPA实现API权限控制。支持RBAC、ABAC等模型,开箱即用,助力高效构建安全的前后端一体化系统。
500 1
|
6月前
|
自然语言处理 JavaScript 前端开发
一夜获千星!已获 1.7k+,Art Design Pro:Vue3 + Vite + TypeScript 打造的高颜值管理系统模板,这个让后端小哥直呼救命的后台系统
Art Design Pro 是一款基于 Vue 3、Vite 和 TypeScript 的高颜值后台管理系统模板,已获 1.7k+ 星标。项目专注于用户体验与视觉设计,支持主题切换、多语言、权限管理及图表展示等功能,内置常用业务组件,便于快速搭建现代化管理界面。其技术栈先进,开发体验流畅,适配多设备,满足企业级应用需求。项目地址:[GitHub](https://github.com/Daymychen/art-design-pro)。
1105 11
|
7月前
|
开发框架 Java 关系型数据库
在Linux系统中安装JDK、Tomcat、MySQL以及部署J2EE后端接口
校验时,浏览器输入:http://[your_server_IP]:8080/myapp。如果你看到你的应用的欢迎页面,恭喜你,一切都已就绪。
537 17
|
10月前
|
SQL JavaScript 安全
【04】Java+若依+vue.js技术栈实现钱包积分管理系统项目-若依框架二次开发准备工作-以及建立初步后端目录菜单列-优雅草卓伊凡商业项目实战
【04】Java+若依+vue.js技术栈实现钱包积分管理系统项目-若依框架二次开发准备工作-以及建立初步后端目录菜单列-优雅草卓伊凡商业项目实战
453 11
【04】Java+若依+vue.js技术栈实现钱包积分管理系统项目-若依框架二次开发准备工作-以及建立初步后端目录菜单列-优雅草卓伊凡商业项目实战
|
10月前
|
监控 前端开发 Java
构建高效Java后端与前端交互的定时任务调度系统
通过以上步骤,我们构建了一个高效的Java后端与前端交互的定时任务调度系统。该系统使用Spring Boot作为后端框架,Quartz作为任务调度器,并通过前端界面实现用户交互。此系统可以应用于各种需要定时任务调度的业务场景,如数据同步、报告生成和系统监控等。
411 9

热门文章

最新文章

推荐镜像

更多