错误:无法加载或初始化所请求的服务提供程序。 - 插座(2)

发布于 2024-08-07 11:25:14 字数 810 浏览 2 评论 0原文

我正在运行一个使用 Ruby/MySQL 和 net/ftp 的 ruby​​ 脚本。该脚本在 Windows Vista 机器上运行,并尝试创建到同一远程 Solaris 服务器的数据库和 ftp 连接。

以下是代码的要点:

require 'mysql'
require 'net/ftp'

dbh = Mysql.real_connect(db["host"], db["user"], db["pass"], db["name"])
ftp = Net::FTP.new(ftp["host"])

现在,如果我从 Vista 框中运行脚本,它驻留在一切工作正常。但是,当通过 NRPE 从另一台服务器调用该脚本时,就会发生错误。

如果我将 db["host"]/ftp["host"] 设置为等于远程服务器的完全限定域名,这是我收到的错误:

getaddrinfo: no address associated with hostname.

收到该错误后,我尝试从脚本 ping 服务器,果然它尝试 ping 主机名时失败,但是,当我 ping IP 地址时它成功了。

但是如果我将 db["host"]/ftp["host"] 设置为远程服务器的 IP 地址,我会收到此错误:

The requested service provider could not be loaded or initialized. - socket(2)

我很难找到有关如何调试此问题的任何信息,所以如果有人有任何想法他们将不胜感激。

提前致谢。

I am running a ruby script that uses Ruby/MySQL and net/ftp. The script is running on a Windows Vista box and is trying to create a database and ftp connection to the same remote Solaris server.

Here is the gist of the code:

require 'mysql'
require 'net/ftp'

dbh = Mysql.real_connect(db["host"], db["user"], db["pass"], db["name"])
ftp = Net::FTP.new(ftp["host"])

Now, if I run the script from the Vista box that it resides on everything works as it should. However, the script is being called from yet another server via NRPE and that's when the error occurs.

If I set db["host"]/ftp["host"] equal to the fully qualified domain name of the remote server here is the error I receive:

getaddrinfo: no address associated with hostname.

After receiving that error I tried pinging the server from the script and sure enough it failed when trying to ping the hostname, however, it worked when I pinged the IP address.

But then if I set db["host"]/ftp["host"] to the IP address of the remote server I get this error:

The requested service provider could not be loaded or initialized. - socket(2)

I'm having a hard time finding any info on how to debug this, so if anyone has any ideas they will be greatly appreciated.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半窗疏影 2024-08-14 11:25:14

事实证明,该脚本是从与本地运行时不同的用户远程运行的。我不太确定环境的变化导致了这个问题,但是一旦我们将远程实例设置为以与本地相同的用户身份运行,一切就正常了。

Turns out the script was being run remotely from a different user than when it was run locally. I'm not exactly sure what about the environment changed that caused the issue, but once we set up the remote instance to run as the same user as the local everything worked fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文