【问题标题】:Couchbase .Net driver issues "Unable to locate node"Couchbase .Net 驱动程序问题“无法定位节点”
【发布时间】:2014-04-23 20:14:12
【问题描述】:

我在 Amazon EC2 上安装了 Couchbase 服务器并尝试使用 VisualStudio C# 构建客户端。

Couchbase 可以通过网络界面从我的计算机访问。我可以添加和修改数据。 但从 C# 中它不起作用:出现“无法定位节点”错误。 与此同时,Fiddler 显示正在发生一些“握手”:我的测试程序在与 Couchbase 建立连接时正在获取一些元数据。但是任何读取或写入数据的尝试都会失败。

以下端口已打开:11211,8091,8092,22,11210,21100 - 21299,11209,4369 (但关闭防火墙似乎没有帮助)

以下是我的测试程序。非常感谢任何帮助。

App.config:

<configuration>
  <configSections>
    <section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
  </configSections> 
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <couchbase>
  <servers bucket="mybucket" username="Administrator" password="xxxxxxxxx">
    <add uri="http://XXX.XXX.XXX.XXX:8091/pools"/>
  </servers>
  </couchbase>
</configuration>

代码:

public static void Run()
{
    System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
    ICouchbaseClientConfiguration section = cfg.GetSection("couchbase") as ICouchbaseClientConfiguration;
    using (CouchbaseClient client = new CouchbaseClient(section))
    {
        MyData mydata= new MyData();
        mydata.MyName= "bla-bla";
        IStoreOperationResult res = client.ExecuteStore(StoreMode.Set, "1", mydata);
        System.Diagnostics.Debug.WriteLine("*************************************************************");
        if (!res.Success)
            System.Diagnostics.Debug.WriteLine(res.Message); // writes "Unable to locate node"
    }
}

【问题讨论】:

  • 您正在本地计算机上运行 sdk 以尝试在 ec2 上设置数据?当您查看网络管理员时,节点的主机名是什么,它与您在 配置中的 ip 不同吗?
  • 得益于驱动程序的高级日志记录功能,我刚刚获得了更多信息。
  • 所以实际的问题是EC2有一个公有IP和一个私有IP。在“握手”阶段,.net 驱动程序使用服务器的公共 IP,在尝试读取或写入数据时切换到私有 IP。所以这似乎是一个配置问题。
  • @scalabilitysolved 是的,主机名是私有 IP。可以改吗?

标签: .net couchbase


【解决方案1】:

您可能需要遵循此处描述在云中使用主机名而不是 IP 地址的文档,看看是否有帮助!

编辑:实际使用以下文章,具体如何使用公共 dns 设置 couchbase 节点名称! http://blog.couchbase.com/cross-data-center-replication-step-step-guide-amazon-aws

我将保留以下指向更高级别官方文档的链接。

云中的 Couchbase 概览:http://docs.couchbase.com/couchbase-manual-2.2/#handling-changes-in-ip-addresses

Couchbase 主机名配置:http://docs.couchbase.com/couchbase-manual-2.2/#couchbase-getting-started-hostnames

【讨论】:

    【解决方案2】:

    发现这个 - 它对我的影响完全一样。

    http://www.couchbase.com/communities/q-and-a/unable-locate-node-error-net-sdk

    编辑:上面的链接被破坏了。这就是现在的位置。 https://forums.couchbase.com/t/unable-to-locate-node-error-net-sdk/258

    【讨论】:

      【解决方案3】:

      另一个可能导致此错误的问题是在开发环境中被防火墙阻止。 您可以通过绕过 IE 中的 couchbase ip 服务器来解决此问题:工具/Internet 选项/连接/LAN 设置/高级/例外。

      问候。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-09-19
        • 2020-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多