How do I set CBAUTH_REVRPC_URL?

n1ql

#1

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”


#2

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


#3

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

Thanks,
Michael


#4

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


#5

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


#6

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?


#7

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


#8

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.)

#9

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


#10

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


#11

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


#12

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


#13

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


#14

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.