Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Couchbase bucket configuration in .NET

I have 2 buckets in Couchbase one is Couchbase type and the other is Memcachced type: when I run my test I get an error: The element servers may only appear once in this section. Below is my config:

  <couchbase>
    <servers bucket="RepositoryCache" bucketPassword="">
      <add uri="http://127.0.0.1:8091/pools/default"/>
    </servers>

    <servers bucket="default" bucketPassword="">
      <add uri="http://127.0.0.1:8091/pools/default"/>
    </servers>
  </couchbase>

 How to configure multiple buckets and resolve the issue? I hv read the manual and I could not find much help.
like image 310
user1096099 Avatar asked May 15 '12 12:05

user1096099


1 Answers

From the documentation, it looks like you can do it like this:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="couchbase">
      <section name="bucket-a" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
      <section name="bucket-b" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
    </sectionGroup>
  </configSections>

  <couchbase>
    <bucket-a>
      <servers bucket="default">
        <add uri="http://127.0.0.1:8091/pools" />
      </servers>
    </bucket-a>
    <bucket-b>
      <servers bucket="beernique" bucketPassword="b33rs">
        <add uri="http://127.0.0.1:8091/pools" />
      </servers>
    </bucket-b>
  </couchbase>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
like image 165
NeilD Avatar answered Dec 01 '22 00:12

NeilD