Couchbase client- Could not locate Node

I am new to couchbase server and installed the server in one system and trying to cache the data by ,net client in another server.

Server:

  • installed and setup “username1”/“password1”
  • created bucket … used “travel-sample”

Created app.config as below,

<servers bucket=“travel-sample” bucketPassword="" username=“username1” password =“password1”>
<add uri=“http://**...:8091/pools”/>
</servers>

C# code: Fetch the hashtable data and trying to cache in couchbase as like below

private CouchbaseClient _instance;
public cacheHandler()
{
    _instance = new CouchbaseClient();
}
public long updateCache(ref Hashtable dataList)
{
    Stopwatch st = new Stopwatch();
    st.Start();
    foreach (string key in dataList.Keys)
    {
        IStoreOperationResult res = _instance.ExecuteStore(StoreMode.Set, key, dataList[key]);
        if (res.Success)
        {
            success += 1;
        }
        else
        {
            failed += 1;
            if (failed == 1)
            {
                failedErr = res.Message;
            }
        }
    }

    return st.ElapsedMilliseconds;
}
}

I am getting “Could not locate Node” error while ExecuteStore() …

PLease guide me if I am missing something… help me how to cache the data in my case

Hi @ashokpp83,

What version of Couchbase Server are you using? Are you using the official Couchbase .NET SDK?

I am using 5.10. downloaded yesterday from couchbase.

and using enyim.caching.dll (v 1.2.9.0) library for client

Current stable version is 2.5.2, could you upgrade and retry?
https://developer.couchbase.com/server/other-products/release-notes-archives/dotnet-sdk

Hi @ashokpp83

I don’t think you’re using the official .NET SDK, it’s called CouchbaseNetClient on nuget here, with the latest version being 2.5.2.

Once you’ve updated the client, you can setup your config like this:

<configSections>
  <section name="couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
<configSections>
<couchbase>
  <username>username1</username>
  <password>password1</password>
  <servers>
    <add uri="couchbase://localhost" />
  </servers>
  <buckets>
    <add name="mybucket" />
  </buckets>
</couchbase>

And then get a reference to a Couchbase bucket like this:

var cluster = new Cluster();
var bucket = cluster.OpenBucket("myBucket");
bucket.Upsert("key", myobject);
bucket.Get<MyClass>("key");

You can see more details in the Documentation here.

1 Like