I still face the same issue while using docker to host 3 containers for each node.
Case Study:
- Use docker Couchbase containers instances to create 3 nodes in one cluster on local machine.
docker run -d --name db3 -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase
docker run -d --name db1 couchbase
docker run -d --name db2 couchbase - Configure all 3 nodes and rebalanced
- Created a bucket
- Access the cache content
Error:
BucketNotFoundException: Bucket with name Cache-Sample does not exist or cannot be reached.
Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(string name)
Question:
I want to know if I should be adding all 3 node IP adddresses as fetched from Docker container ?
What configuration am I missing?
The startup code is as below:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddLogging();
services.AddCouchbase(options =>
options
WithConnectionString(“couchbase://172.17.0.2”) //Node 1 instance
.WithConnectionString(“couchbase://117.17.0.3”) //Node 2 instance
.WithConnectionString(“couchbase://117.17.0.4”) //Node 3 instance
.WithCredentials(“Administrator”, “********”));
.WithBuckets(“Cache-Sample”)) ;
services.AddDistributedCouchbaseCache(“Cache-Sample”, opt => { });
}
And in CacheController, I try to access the distributed cache as below:
var data = await _cache.GetStringAsync(cacheKey);