您的位置:首页 > 其它

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

2017-10-24 09:36 666 查看
  执行命令没有成功:
[root@linux-node1 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的连接,发现没有问题
[root@linux-node1 base]# salt '*' test.ping
linux-node2.example.com:
True
linux-node1.example.com:
True
#再次操作远程执行命令
[root@linux-node1 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服务:
[root@linux-node1 base]# systemctl stop salt-master
[root@linux-node1 base]# systemctl stop salt-minion
[root@linux-node1 base]# ps -ef|grep salt
root     114208 110544  0 00:03 pts/1    00:00:00 grep --color=auto salt
  重新启动salt服务:
[root@linux-node1 base]# systemctl start salt-master
[root@linux-node1 base]# systemctl start salt-minion
  报错信息变了:
[root@linux-node1 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端口。检查后发现,果然如此。
[root@linux-node1 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服务:
[root@linux-node1 base]# systemctl stop nginx
  这次就成功了:
[root@linux-node1 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  报错 was saltstack
相关文章推荐