Issues with cluster and index creation

So I set up a cluster to play with. Still in test environment - but now I have tried to migrate all my production data (from another database platform) into CB.

I’m using CB Community Edition 5.1.1. Running on CentOS 7.5. First I thought this issue was related to the Java SDK I’m using (as that is where I get the error) - but I found out I could reproduce the issue using the admin console…

The cluster consists of two nodes: and If both servers are running then all is good. However, one of the reasons for having a cluster is that it can run even though one of the servers is “gone”. So I stopped the couchbase server on db2 - and then problems started. My migration code checks for indexes - and create them if they don’t exist. However, creating the index fails when one of the cluster nodes is down.

And I can even proof this by just running the query:

CREATE INDEX `def_type` ON `data`(`type`)

in the admin console of the cluster server that is running. The query takes forever - or rather: errors | elapsed: 600032.00ms | execution: 600032.00ms | count: | size: 0 - and the response is:

  "status": "Gateway Timeout",
  "status_detail": "The query workbench only supports queries running for 600 seconds. This value can be changed in the preferences dialog. You can also use cbq from the command-line for longer running queries. Certain DML queries, such as index creation, will continue in the background despite the user interface timeout."

This is similar to the stacktraces I get from the SDK. I put them in here for your information (but without the code) - just in case they may provide some other relevant info:

Caused by: javax.faces.FacesException: Can't instantiate class: 'dk.dtu.aqua.catchlog.bean.MigrateBean'.. null
	at com.sun.faces.config.ManagedBeanFactory.newInstance(
	at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(
	... 58 more
Caused by: java.lang.ClassNotFoundException: class dk.dtu.aqua.catchlog.bean.MigrateBean : java.lang.RuntimeException: java.util.concurrent.TimeoutException: {"b":"data","r":"","s":"n1ql","c":"0B0184A12A9528A0/FFFFFFFF89DFEC8B","t":75000000,"i":"d653fae1-2c64-4b4d-a10e-786c93b81bda","l":""}
	at com.sun.faces.config.ManagedBeanFactory.newInstance(
	... 59 more
Caused by: java.lang.ClassNotFoundException: class dk.dtu.aqua.catchlog.bean.MigrateBean : java.lang.RuntimeException: java.util.concurrent.TimeoutException: {"b":"data","r":"","s":"n1ql","c":"0B0184A12A9528A0/FFFFFFFF89DFEC8B","t":75000000,"i":"d653fae1-2c64-4b4d-a10e-786c93b81bda","l":""}
	at java.beans.Beans.instantiate(
	at java.beans.Beans.instantiate(
	at com.sun.faces.config.ManagedBeanFactory$
	... 60 more
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException: {"b":"data","r":"","s":"n1ql","c":"0B0184A12A9528A0/FFFFFFFF89DFEC8B","t":75000000,"i":"d653fae1-2c64-4b4d-a10e-786c93b81bda","l":""}
	at rx.exceptions.Exceptions.propagate(
	at rx.observables.BlockingObservable.blockForSingle(
	at rx.observables.BlockingObservable.single(
	at dk.dtu.aqua.catchlog.base.BaseCouchbaseDAO.rawQuery(
	at dk.dtu.aqua.catchlog.bean.MigrateBean.createIndex(
	at dk.dtu.aqua.catchlog.bean.MigrateBean.initIndexes(
	at dk.dtu.aqua.catchlog.bean.MigrateBean.(
	at java.lang.J9VMInternals.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(
	at java.beans.Beans.instantiate(
	... 63 more
Caused by: java.util.concurrent.TimeoutException: {"b":"data","r":"","s":"n1ql","c":"0B0184A12A9528A0/FFFFFFFF89DFEC8B","t":75000000,"i":"d653fae1-2c64-4b4d-a10e-786c93b81bda","l":""}
	at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(
	at rx.internal.operators.OnSubscribeTimeoutTimedWithFallback$TimeoutMainSubscriber.onTimeout(
	at rx.internal.operators.OnSubscribeTimeoutTimedWithFallback$TimeoutMainSubscriber$
	at java.util.concurrent.Executors$
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
	at java.util.concurrent.ScheduledThreadPoolExecutor$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

So my questions are:

  1. Could there be anything in the configuration/setup that causes this?
  2. Should I not expect to be able to run a cluster with Community Edition???
  3. How else can I resolve this issue?

Ok, it seems I have to confirm the failover to the db1 node - and then it started working.

Then I started the db2 server again - and I now see the option to “Rebalance”. Once clicking that and confirming it - db2 node disappeared. I guess it is re-sync’ing the cluster - but the server itself is not busy at all…

Well, it seems to be “working as designed” - just me not having read that bit :wink:

Not sure why, but I ended up having to add the server to the cluster again…

Will let it have some time to see if it gets back up and running. Right now it has state:

New node | Not taking traffic | ADD pending rebalance

I guess that is Ok. We’ll see… :wink:

Ok, got tired of waiting - and pressed the [Rebalance] button. It seems to kick off some work… :wink:
… so I guess that is also a manual task?