尝试连接到 AppHarbor 上的 Memcached 服务器时出现超时异常

发布于 2024-12-28 10:25:43 字数 2489 浏览 3 评论 0原文

我一直在使用 Enyim Memcached Client for .Net,尝试连接到在 AppHarbor。我的配置文件的相关部分如下所示:

  <enyim.com>
    <log factory="Enyim.Caching.DiagnosticsLogFactory, Enyim.Caching" />
    <memcached protocol="Binary">
      <servers>
        <add address="8d593f28-37d7-4c4f-a702-aa7687a85ea1.memcacher.com" port="11211" />
      </servers>
      <authentication
          type="Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching"
          userName="changed to post on stack overflow"
          password="changed to post on stack overflow"
          zone="AUTHZ"
              />
      </memcached>
    </enyim.com>

我的连接不断超时。有什么想法吗?以下是来自 Enyim 客户端的日志:

2012-01-21 18:56:08 [错误] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 无法初始化池。 - System.TimeoutException:无法连接到 50.19.210.46:11211 在Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(套接字套接字,IPEndPoint端点,Int32超时) 在 Enyim.Caching.Memcached.PooledSocket..ctor(IPEndPoint 端点、TimeSpan 连接超时、TimeSpan receiveTimeout) 在 Enyim.Caching.Memcached.MemcachedNode.CreateSocket() 在 Enyim.Caching.Memcached.Protocol.Binary.BinaryNode.CreateSocket() 在 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.CreateSocket() 在 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.InitPool() 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 请求将 50.19.210.46:11211 标记为死亡 2012-01-21 18:56:08 [调试] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - FailurePolicy.ShouldFail():True 2012-01-21 18:56:08 [警告] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 将节点 50.19.210.46:11211 标记为死亡 2012-01-21 18:56:08 [调试] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死亡。 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。 2012-01-21 18:56:08 [调试] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器启动。 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。 50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死亡或已处置,返回 null。 50.19.210.46:11211

更新:

原来我无法连接到 memcached 服务器的原因是因为它只能从 appharbor 的环境访问。因此,对于遇到此问题的其他人来说,您在本地开发时需要使用本地 memcached 服务,然后在部署时只需更改凭据(apphaorbor 实际上会自动为您执行此操作)。问题解决了。

I've been using the Enyim Memcached Client for .Net, trying to connect to a server running on AppHarbor. The relevant parts of my configuration file look like this:

  <enyim.com>
    <log factory="Enyim.Caching.DiagnosticsLogFactory, Enyim.Caching" />
    <memcached protocol="Binary">
      <servers>
        <add address="8d593f28-37d7-4c4f-a702-aa7687a85ea1.memcacher.com" port="11211" />
      </servers>
      <authentication
          type="Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching"
          userName="changed to post on stack overflow"
          password="changed to post on stack overflow"
          zone="AUTHZ"
              />
      </memcached>
    </enyim.com>

My connection keeps timing out. Any ideas whats going on here? Here are the logs from Enyim client:

2012-01-21 18:56:08 [ERROR] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Could not init pool. - System.TimeoutException: Could not connect to 50.19.210.46:11211
at Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(Socket socket, IPEndPoint endpoint, Int32 timeout)
at Enyim.Caching.Memcached.PooledSocket..ctor(IPEndPoint endpoint, TimeSpan connectionTimeout, TimeSpan receiveTimeout)
at Enyim.Caching.Memcached.MemcachedNode.CreateSocket()
at Enyim.Caching.Memcached.Protocol.Binary.BinaryNode.CreateSocket()
at Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.CreateSocket()
at Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.InitPool()
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Mark as dead was requested for 50.19.210.46:11211
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - FailurePolicy.ShouldFail(): True
2012-01-21 18:56:08 [WARN] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Marking node 50.19.210.46:11211 as dead
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Node 50.19.210.46:11211 is dead.
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Starting the recovery timer.
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Timer started.
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Acquiring stream from pool. 50.19.210.46:11211
2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Pool is dead or disposed, returning null. 50.19.210.46:11211

UPDATE:

Turns out the reason I can't connect to the memcached server is because it's only accessible from appharbor's environment. So for anyone else that runs across this, you need to use a local memcached service when developing locally, then simply change the credentials when deploying (which apphaorbor actually does automatically for you). Problem resolved.

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

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

发布评论

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

评论(1

离去的眼神 2025-01-04 10:25:43

AppHarbor Memcacher 存储桶只能从 AppHarbor 应用程序服务器访问。 文档已进行修改,以清楚地反映这一点。

您应该使用本地安装的 memcached 服务器进行测试。

AppHarbor Memcacher buckets are only accessible from AppHarbor application servers. The documentation has been amended to clearly reflect this.

You should use a locally installed memcached server for testing.

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