简体   繁体   English

bootstrap windows winrm因网络错误而失败

[英]bootstrap windows winrm fails with network error

I am trying to bootstrap a windows winrm using knife command. 我正在尝试使用knife命令引导Windows winrm。

I have enabled the tcp port 5985. But i still get the following error: 我已启用tcp端口5985.但我仍然收到以下错误:

ERROR: Network Error: Connection refused - connect(2) (http://:5985) 错误:网络错误:连接被拒绝 - 连接(2)(http://:5985)

I am able to remotely login to the machine as well by providing username and password 我也可以通过提供用户名和密码来远程登录机器

I could not resolve. 我无法解决。 Has anyone come across this problem and found a solution? 有没有人遇到过这个问题并找到了解决方案?

Check that you can telnet remote_host 5985 . 检查您是否可以telnet remote_host 5985 This should open a dumb session into which you can enter "quit". 这应该打开一个愚蠢的会话,您可以输入“退出”。 If not, look again at how you have enabled winrm and the firewall on the remote host. 如果没有,请再次查看如何在远程主机上启用winrm和防火墙。

I got winrm bootstrap working on Windows VMs which did not have firewall enabled like this: 我在没有启用防火墙的 Windows VM 运行winrm bootstrap 如下所示:

All the following on the remote Windows machine you want to bootstrap... 您要引导的远程Windows机器上的以下所有内容...

Enable winrm: 启用winrm:

winrm quickconfig -q

Enable and start the firewall service (so we can successfully config winrm): 启用并启动防火墙服务(这样我们就可以成功配置winrm):

sc config mpssvc start= demand
sc start mpssvc

Configure winrm per chef recommendations: 根据厨师的建议配置winrm:

winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
winrm set winrm/config @{MaxTimeoutms="1800000"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/service/auth @{Basic="true"}

Stop the firewall service again: 再次停止防火墙服务:

sc stop mpssvc

... or configure it to allow to winrm connections from the workstation. ...或将其配置为允许来自工作站的winrm连接。

Now, on your workstation, validate the set up: 现在,在您的工作站上验证设置:

Validate that remote host is listening on default winrm port 验证远程主机是否正在侦听默认的winrm端口

telnet remote_host 5985

(If connection is successful, a blank telnet session will open. You can enter "quit" to exit it.) (如果连接成功,将打开一个空白的telnet会话。您可以输入“quit”退出它。)

Optionally validate that knife winrm can connect to the remote host (eg to list the c:\\ directory) (可选)验证knife winrm是否可以连接到远程主机(例如,列出c:\\目录)

knife winrm -m remote_host -x remote_user -P remote_password 'dir c:\'

Bootstrap the node 引导节点

knife bootstrap windows winrm remote_host -x remote_user -P remote_password

Since you ask for an answer drawing from credible and/or official sources here are the references I found useful when figuring out how to get winrm bootstrap to work: 既然您要求从可信和/或官方来源获得答案,那么在确定如何让winrm bootstrap工作时,我发现这些参考资料是有用的:

I have faced the similar issue.One of the reasons for this might be you knife-windows gem is not installed in expected location. 我遇到了类似的问题。其中一个原因可能就是你没有在预期的位置安装刀 - 窗宝石。

knife-windows resolves target hostname.if its not properly installed winrm knife cant resolve targetname.So to overcome this install knife-windows as below 刀 - 窗解析目标主机名。如果没有正确安装winrm刀不能解决targetname.So克服此安装刀 - 如下所示

To install the knife windows plugin using RubyGems, run the following command: 要使用RubyGems安装knife windows插件,请运行以下命令:

  $ /opt/chef/embedded/bin/gem install knife-windows 

if properly installed you should be able to find knife-windows at /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ 如果安装正确,您应该能够在/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/找到刀窗

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM