How do I set CBAUTH_REVRPC_URL?

Working with 4.0.
I ran “./cbq-engine -datastore=http://localhost:8091”.
First message in the log is:
"level=ERROR _msg= Unable to initialize cbauth. Error Unable to initialize cbauth’s revrpc: cbauth environment variable CBAUTH_REVRPC_URL is not set ".
And indeed when I try to run CREATE PRIMARY INDEX I get an error “Indexer not implemented GSI may not be enabled”

Hi Micheal,

Try exporting the following variable before running cbq-engine

export CBAUTH_REVRPC_URL=“http://Administrator:@localhost:8091/query”

That error should disappear. Also do you have GSi enabled on the couchbase 4.0 node ? If not then you will be not be able to use GSi. but you will be able to create indexes using views.

CREATE PRIMARY INDEX idx_name USING VIEWS; (it’s either VIEW or VIEWS, please try both )

Cheers,
Manik

I had to add my password and then it worked -
export CBAUTH_REVRPC_URL=“http://Administrator:myPassword@localhost:8091/query

Thanks,
Michael

Now however I get the following error:
“msg”: "GSI CreatePrimaryIndex() - cause: Fails to create index. There is no available index service that can process this request at this time. Index Service can be in bootstrap, recovery, or non-reachable. Please retry the operation at a later time."
when trying to run CREATE PRIMARY INDEX

Hi Micheal,

Like I said before. Your couchbase server node may not have Secondary indexes enabled and therefore you are getting that error. Please try running the following query to create a primary index using views.

CREATE PRIMARY INDEX idx_name USING VIEWS; (it’s either VIEW or VIEWS, please try both )

cheers,
Manik

Hi Michael,

Why are you running cbq-engine manually, instead of just running Couchbase 4.0, which will take care of all these configuration issue for you?

I did try - got the message: (with VIEW/VIEWS)
“syntax error - at USING”

Hi geraldss,

How else can I query the bucket from the cli?
I tried:

  1. run Couchbase Server.app
    2.run "./cbq-engine -datastore=http://localhost:8091"
    the log:
    _time=2015-10-13T14:33:56+03:00 _level=INFO _msg= Initialization of cbauth succeeded
    _time=2015-10-13T14:33:56+03:00 _level=INFO _msg=New site created with url http://localhost:8091
    _time=2015-10-13T14:33:56+03:00 _level=INFO _msg=cbq-engine started pipeline-cap=512 timeout=0 datastore=http://localhost:8091 loglevel=INFO servicers=16 plus-servicers=64 request-size-cap=67108864 version=1.0.0 max-concurrency=4 pipeline-batch=16 request-cap=1024
    _time=2015-10-13T14:33:56+03:00 _level=INFO _msg=HttpEndpoint: Listen Address=[::]:8093
    _time=2015-10-13T14:34:03+03:00 _level=INFO _msg=Created New Bucket contacts
  2. activate the cli using:
    "./cbq -engine=http://127.0.0.1:8093
  3. in the cli run: CREATE PRIMARY KEY on contacts;
    the log outputs:
    2015-10-13T14:42:09.95Z+03:00 [Info] Refreshing indexer list due to cluster changes or auto-refresh.
    2015-10-13T14:42:09.95Z+03:00 [Info] Refreshed Indexer List: []
    2015-10-13T14:42:09.95Z+03:00 [Info] servicesChangeNotifier: Creating new notifier instance for http://%40query-cbauth:84ce593b13df03d299de712cdaa214b3@localhost:8091, default
    2015/10/13 14:42:09 Trying with http://127.0.0.1:8091/pools/default/bucketsStreaming/contacts
    2015/10/13 14:42:09 Got new configuration for bucket contacts
    2015-10-13T14:42:09.954Z+03:00 [Info] serviceChangeNotifier: received ServiceChangeNotification
    2015-10-13T14:42:09.956Z+03:00 [Info] serviceChangeNotifier: received PoolChangeNotification
    2015-10-13T14:42:09.964Z+03:00 [Info] Refreshing indexer list due to cluster changes or auto-refresh.
    2015-10-13T14:42:09.964Z+03:00 [Info] Refreshed Indexer List: []
    2015-10-13T14:42:09.973Z+03:00 [Info] Refreshing indexer list due to cluster changes or auto-refresh.
    2015-10-13T14:42:09.973Z+03:00 [Info] Refreshed Indexer List: []
    2015-10-13T14:42:20.001Z+03:00 [Info] CreateIndex 0 contacts/#primary using:forestdb exprType:N1QL partnExpr: whereExpr: secExprs:[] isPrimary:true with:[] - elapsed(10.050550769s) err(Fails to create index. There is no available index service that can process this request at this time. Index Service can be in bootstrap, recovery, or non-reachable. Please retry the operation at a later time.)

Hi Michael,

You should install Couchbase 4.0 and run it directly. After that, you can run cbq (not cbq-engine) as above.

You should not run cbq-engine manually.

Gerald

Please try what Gerald has suggested. Also there is was a mistake in the create index query that I gave you earlier, The correct form of that query using views is as follows :

create primary index on default using view;

replace default with the name of your bucket.

Cheers,
Manik

I have CB server 4 only and I also get error if I don’t run cbq-engine explicitly.

this works, But alone cbq is not working if I don’t have cbq-engine running as well as Gerald suggested.

So the document (http://developer.couchbase.com/documentation/server/4.0/getting-started/first-n1ql-query.html) which says we should create primary index using GSI is invalid ? And also I said above, cbq-engine also needs to be running to execute query from cbq

No it’s not invalid. The recommended way to create an index is using GSI. You will need to have started both cbq-engine (Query) and GSI (Secondary index) in order to create indexes and run N1QL queries.

got similar error ,
did below steps to resolve this issue .
[root@crdl-db-b2bbss-crdl-03 /]# export CBAUTH_REVRPC_URL="http://[240b:c0e0:104:5450:9727:2:7:b07]:8091 -u Administrator -p Password "
[root@crdl-db-b2bbss-crdl-03 /]#
[root@crdl-db-b2bbss-crdl-03 /]#
[root@crdl-db-b2bbss-crdl-03 /]# /opt/couchbase/bin/indexer -adminPort=9100 -scanPort=9101 -httpPort=9102 -streamInitPort=9103 -streamCatchupPort=9104 -streamMaintPort=9105 --httpsPort=19102 --certFile=/opt/couchbase/var/lib/couchbase/config/memcached-cert.pem --keyFile=/opt/couchbase/var/lib/couchbase/config/memcached-key.pem -vbuckets=1024 -cluster=[::1]:8091 -storageDir=/data/Dataspace/couchbase/@2i -diagDir=/opt/couchbase/var/lib/couchbase/crash -nodeUUID=c2225dfdbfd1ce86ca006f9d775d0ed4 -ipv6=true -isEnterprise=true

2022-11-22T16:18:27.685+09:00 [Info] Indexer started with command line: [/opt/couchbase/bin/indexer -adminPort=9100 -scanPort=9101 -httpPort=9102 -streamInitPort=9103 -streamCatchupPort=9104 -streamMaintPort=9105 --httpsPort=19102 --certFile=/opt/couchbase/var/lib/couchbase/config/memcached-cert.pem --keyFile=/opt/couchbase/var/lib/couchbase/config/memcached-key.pem -vbuckets=1024 -cluster=[::1]:8091 -storageDir=/data/Dataspace/couchbase/@2i -diagDir=/opt/couchbase/var/lib/couchbase/crash -nodeUUID=c2225dfdbfd1ce86ca006f9d775d0ed4 -ipv6=true -isEnterprise=true]
2022-11-22T16:18:27.722+09:00 [Info] Indexer::NewIndexer Status Warmup
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9ca3ce]

goroutine 1 [running]:
panic(0xfa02c0, 0xc42001c100)
/home/couchbase/.cbdepscache/exploded/x86_64/go-1.7.6/go/src/runtime/panic.go:500 +0x1a1
github.com/couchbase/cbauth/metakv.doCallInner(0xc42001dc90, 0x1118c01, 0x3, 0x112eac3, 0x19, 0x0, 0x48, 0xc42016a140, 0x0)
godeps/src/github.com/couchbase/cbauth/metakv/metakv.go:94 +0x5e
github.com/couchbase/cbauth/metakv.doCall(0xc42001dc90, 0x1118c01, 0x3, 0x112eac3, 0x19, 0x0, 0x0, 0x0, 0x0, 0x0, …)
godeps/src/github.com/couchbase/cbauth/metakv/metakv.go:123 +0xc7
github.com/couchbase/cbauth/metakv.doJSONCall(0xc42001dc90, 0x1118c01, 0x3, 0x112eac3, 0x19, 0x0, 0xf0d620, 0xc42016a140, 0x112f3f1, 0x19)
godeps/src/github.com/couchbase/cbauth/metakv/metakv.go:134 +0x6a
github.com/couchbase/cbauth/metakv.(*store).get(0xc42001dc90, 0x112eac3, 0x19, 0xc4200613d0, 0x41815d, 0xc420170018, 0xc42016c270, 0x6060107, 0x3a, 0xffffffffffffffff)
godeps/src/github.com/couchbase/cbauth/metakv/metakv.go:175 +0xd1
github.com/couchbase/cbauth/metakv.Get(0x112eac3, 0x19, 0x18, 0xfef2a0, 0xc4200614a0, 0x41719a, 0x18, 0x18, 0xc42010ee80)
godeps/src/github.com/couchbase/cbauth/metakv/metakv.go:337 +0x45
github.com/couchbase/indexing/secondary/common.GetSettingsConfig.func1(0x0, 0x0, 0x0, 0xc420290c00, 0xfef2a0)
goproj/src/github.com/couchbase/indexing/secondary/common/settings.go:35 +0x70
github.com/couchbase/indexing/secondary/common.(*RetryHelper).Run(0xc4200614d8, 0xc420290c00, 0xc420061501)
goproj/src/github.com/couchbase/indexing/secondary/common/retry_helper.go:36 +0x52
github.com/couchbase/indexing/secondary/common.GetSettingsConfig(0xc420290c00, 0xc420086080, 0xc420061560, 0xc42002d590)
goproj/src/github.com/couchbase/indexing/secondary/common/settings.go:47 +0xfb
github.com/couchbase/indexing/secondary/indexer.NewSettingsManager(0xc4213944e0, 0xc42002ec00, 0xc420290c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, …)
goproj/src/github.com/couchbase/indexing/secondary/indexer/settings.go:60 +0x102
github.com/couchbase/indexing/secondary/indexer.NewIndexer(0xc420290c00, 0x26, 0xc4000001ed, 0x0, 0x0)
goproj/src/github.com/couchbase/indexing/secondary/indexer/indexer.go:264 +0xccb
main.main()
goproj/src/github.com/couchbase/indexing/secondary/cmd/indexer/main.go:167 +0x12ca
[root@crdl-db-b2bbss-crdl-03 /]# export CBAUTH_REVRPC_URL="http://[240b:c0e0:104:5450:9727:2:7:b07]:8091^Cu Administrator -p Password "
[root@crdl-db-b2bbss-crdl-03 /]# exit
command terminated with exit code 130
[naveen.karanam-a@uhn5klbjhmgmt-p ~]$ kubectl exec -it crdl-db-crdl-01 – bash
Defaulting container name to crdl-db-crdl-01.
Use ‘kubectl describe pod/crdl-db-crdl-01 -n t002-u000017’ to see all of the containers in this pod.
[root@crdl-db-crdl-01 /]#
[root@crdl-db-crdl-01 /]#