saltstack操作远程执行命令报错:“is running as PID 113257 and was started at”的解决

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了saltstack操作远程执行命令报错:“is running as PID 113257 and was started at”的解决相关的知识,希望对你有一定的参考价值。

  执行命令没有成功:

[[email protected] base]# salt ‘*‘ state.sls web.apache
linux-node2.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 13:10:00.987726
    Duration: 5236.443 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: True
     Comment: The service httpd is already running
     Started: 13:10:06.247097
    Duration: 1438.912 ms
     Changes:   

Summary for linux-node2.example.com
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:   6.675 s
linux-node1.example.com:
    Minion did not return. [No response]

  怀疑是虚拟机里的连接有点问题。

#测试和minion的连接,发现没有问题

[[email protected] base]# salt ‘*‘ test.ping
linux-node2.example.com:
    True
linux-node1.example.com:
    True

#再次操作远程执行命令

[[email protected] base]# salt ‘*‘ state.sls web.apache
linux-node1.example.com:
    Data failed to compile:
----------
    The function "state.sls" is running as PID 113257 and was started at 2017, Sep 09 13:38:17.636816 with jid 20170909133817636816
linux-node2.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 13:15:57.492704
    Duration: 1505.709 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: True
     Comment: The service httpd is already running
     Started: 13:15:59.002177
    Duration: 186.313 ms
     Changes:   

Summary for linux-node2.example.com
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:   1.692 s
ERROR: Minions returned with non-zero exit code

  在百度上搜索报错信息:“is running as PID 113257 and was started at”,找到一篇文档:http://blog.csdn.net/baidu_25506889/article/details/48050619——The function "state.highstate" is running as PID 4417的解决方法

  根据文章的内容,停掉node1的salt服务:

[[email protected] base]# systemctl stop salt-master
[[email protected] base]# systemctl stop salt-minion
[[email protected] base]# ps -ef|grep salt
root     114208 110544  0 00:03 pts/1    00:00:00 grep --color=auto salt

  重新启动salt服务:

[[email protected] base]# systemctl start salt-master
[[email protected] base]# systemctl start salt-minion

  报错信息变了:

[[email protected] base]# salt ‘*‘ state.sls web.apache
linux-node2.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 00:04:57.512520
    Duration: 861.558 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: True
     Comment: The service httpd is already running
     Started: 00:04:58.375123
    Duration: 46.543 ms
     Changes:   

Summary for linux-node2.example.com
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time: 908.101 ms
linux-node1.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 00:04:33.162908
    Duration: 844.754 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: False
     Comment: Running scope as unit run-115498.scope.
              Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
     Started: 00:04:34.008627
    Duration: 147.766 ms
     Changes:   

Summary for linux-node1.example.com
------------
Succeeded: 1
Failed:    1
------------
Total states run:     2
Total run time: 992.520 ms
ERROR: Minions returned with non-zero exit code

  突然领悟到可能是“linux-node1”已经运行有80端口。检查后发现,果然如此。

[[email protected] base]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      2786/nginx: master  
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2786/nginx: master  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      939/sshd            
tcp        0      0 0.0.0.0:4505            0.0.0.0:*               LISTEN      114225/python       
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1751/master         
tcp        0      0 0.0.0.0:4506            0.0.0.0:*               LISTEN      114231/python       
tcp        0      0 0.0.0.0:49152           0.0.0.0:*               LISTEN      11064/glusterfsd    
tcp        0      0 0.0.0.0:49153           0.0.0.0:*               LISTEN      11193/glusterfsd    
tcp        0      0 0.0.0.0:49154           0.0.0.0:*               LISTEN      11212/glusterfsd    
tcp        0      0 0.0.0.0:49155           0.0.0.0:*               LISTEN      11338/glusterfsd    
tcp        0      0 0.0.0.0:49156           0.0.0.0:*               LISTEN      11357/glusterfsd    
tcp        0      0 0.0.0.0:24007           0.0.0.0:*               LISTEN      11039/glusterd      
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::80                   :::*                    LISTEN      2786/nginx: master  
tcp6       0      0 :::22                   :::*                    LISTEN      939/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1751/master         
udp        0      0 0.0.0.0:612             0.0.0.0:*                           11037/rpcbind       
udp        0      0 0.0.0.0:111             0.0.0.0:*                           11037/rpcbind       
udp6       0      0 :::612                  :::*                                11037/rpcbind       
udp6       0      0 :::111                  :::*                                11037/rpcbind

  停掉之前运行的nginx服务:

[[email protected] base]# systemctl stop nginx

  这次就成功了:

[[email protected] base]# salt ‘*‘ state.sls web.apache
linux-node2.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 00:05:43.237868
    Duration: 920.891 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: True
     Comment: The service httpd is already running
     Started: 00:05:44.159808
    Duration: 57.373 ms
     Changes:   

Summary for linux-node2.example.com
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time: 978.264 ms
linux-node1.example.com:
----------
          ID: apache-install
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed
     Started: 00:05:16.506796
    Duration: 1640.554 ms
     Changes:   
----------
          ID: apache-service
    Function: service.running
        Name: httpd
      Result: True
     Comment: Service httpd has been enabled, and is running
     Started: 00:05:18.148225
    Duration: 372.124 ms
     Changes:   
              ----------
              httpd:
                  True

Summary for linux-node1.example.com
------------
Succeeded: 2 (changed=1)
Failed:    0
------------
Total states run:     2
Total run time:   2.013 s


本文出自 “dark-matter” 博客,请务必保留此出处http://gagarin.blog.51cto.com/1056957/1975447

以上是关于saltstack操作远程执行命令报错:“is running as PID 113257 and was started at”的解决的主要内容,如果未能解决你的问题,请参考以下文章

Saltstack系列2:Saltstack远程执行命令

请马上修复!SaltStack远程命令执行漏洞

漏洞安全公告|SaltStack 远程命令执行漏洞(CVE-2020-11651/CVE-2020-11652)

漏洞通告SaltStack远程命令执行漏洞

漏洞预警SaltStack远程命令执行漏洞

安全风险通告SaltStack漏洞搭配可远程命令执行,SaltStack多个高危漏洞安全风险通告