-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Support Linux SSH Task 支持 Linux SSH 任务
场景描述:当前项目中,工作流的任务的目标是执行不同服务器 Shell 脚本,Shell 脚本是保存在业务服务器的固定目录。当 Worker 调度执行时,需要通过固定用户登录这些服务器,然后执行 Shell 脚本并获取这些任务执行的状态,其中服务器地址、用户名、密码可配置。
For example, in my project, the workflow's tasks want to execute shell scripts where are in different server's different directory. When worker execute these shell scripts, it must use the same user to login these server. Also, the worker can get the executing state of these server. We can config these server 's host,user and password.
SSH Task is very useful for most user SSH 任务对大多数用户是非常有用的
分布式调度任务所执行的 Shell 脚本是处于不同的业务服务器,都有其固定的业务,这些业务服务器不是 Worker,只是需要 Worker 调度执行,我们只需要传递不同的参数,让服务器执行任务脚本即可。
In dolphinscheduler, the most executing tasks are in different servers who are not workers. These servers also have their different fixed services. We just have to pass different parameters to schedule these shell scripts to execute.
Python has a module to execute ssh script Python 有固定的工具包,可执行这些SSH Shell 脚本
Python 有一个可执行远程服务器SSH Shell脚本的模块,其名字为:paramiko。
Python has a module that can execute SSH Shell script. It's paramiko.
Others 其他内容
我发现之前的改进功能中也有关于这个的描述,不过相对简单。功能更新地址
I found this described in previous feature, but it was relatively simple.
Feature URL
另外,我通过 Shell Task 方式去执行远程任务会非常不便,下面是我的脚本,不知道是否有更好的方式。
In addition, it is very inconvenient for me to perform remote tasks through Shell Task. Here is my script. I don't know if there's a better way.
sshpass -p 'password' ssh user@host
echo 'ssh success'
echo 'Hello World' -> /home/dolphinscheduler/test/hello.txt
echo 'end'