获取拨号TCP:从容器内的服务访问Internet时I / O超时

我正在使用PubNub(GO SDK)发布/订阅服务来接收消息,但是即使在以下情况下,我也没有收到任何消息 我能够从容器内部ping google.com </ code>。</ p>

在Pubnub日志中,每次我的程序尝试连接到源(Pubnub服务器)时, ,我收到“拨号TCP:I / O超时”错误。 我想这是由于主机或容器上的Internet连接速度慢所致。</ p>

该如何解决该错误?</ p>
</ div>

展开原文

原文

I am using PubNub (GO SDK) publish/subscribe service to receive messages but I am not receiving any messages even when I am able to ping google.com from inside the container.

In the Pubnub logs, every time my program tries to connect to the origin (Pubnub server), I am getting "dial tcp: i/o timeout" error. I guess this is due to the slow internet connection either on the host or in the container.

What should I do to get around this error?

1个回答



我想通过在计算机的名称服务器中包含Google DNS(8.8.8.8)来解决此错误。 我认为此错误是由于域解析过程缓慢导致的,因为我的机器正在从DHCP获取DNS。</ p>

我按照以下步骤操作:</ p>


  1. /etc/resolvconf/resolv.conf.d/base </ code>文件中设置静态DNS:</ p>

    名称服务器8.8.8.8
    \ nnameserver 8.8.4.4 </ p> </ li>

  2. 配置您的PC,使其使用用户提供的DNS,而不是从DHCP获取它。 为此,请打开此文件 /etc/dhcp/dhclient.conf </ code>并添加以下行:</ p>

    取代域名服务器8.8.8.8,8.8.4.4 ; </ p> </ li>

  3. 使用以下方式重新启动网络管理器:</ p>

    sudo服务网络管理器重新启动</ p> </ li>
    < / ol>
    </ div>

展开原文

原文

I was to solve this error by including Google DNS (8.8.8.8) in my machine's nameservers. I think this error was due to the slow domain resolution process as my machine was getting DNS from DHCP.

I followed these steps:

  1. Set static DNS in /etc/resolvconf/resolv.conf.d/basefile:

    nameserver 8.8.8.8
    nameserver 8.8.4.4

  2. Configure your PC so that it uses user-provided DNS, instead of obtaining it from DHCP. For that, open this file /etc/dhcp/dhclient.conf and add this line:

    supersede domain-name-servers 8.8.8.8, 8.8.4.4;

  3. Restart network manager using:

    sudo service network-manager restart

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐