Chi
December 15, 2016, 6:16am
1
Hello guys,
I am using Couchbase server 4.1.1. I tried to execute the following command through command line : -
Step 1 :- bin>./cbq -engine="http://my_url@spnpass@127.0.0.1:8093"
Step 2 :- cbq> create primary index on 'my_url';
Response I am getting :-
{ "requestID" : "some random char", "signature" : null, "results" : [ ], "errors" : [ { "code" : 10000, "msg" : "Authorization Failed" } ], "status" : "stopped", "metrics" : { "some key":"value pairs data" } }
FYI :- The credential for Couchbase bucket is absolutely correct.
Update 1 :-
I donât know what strike to me but I remove the password from the bucket and execute the following command and it works.
Step 1 :- bin>./cbq -engine="http://127.0.0.1:8093"
Step 2 :- cbq> create primary index on 'my_url';
Response I am getting :-
{ "requestID" : "some random char", "signature" : null, "results" : [ ], "status" : "success", "metrics" : { "some key":"value pairs data" } }
Now all I have to do is to supply password again. But itâs not a solution itâs a JUGAAD.
This is fixed in 4.5. For 4,1, can you invoke cbq twice. Once for the CREATE INDEX, and the second time credentials for your queries. @isha .
Chi
December 15, 2016, 4:25pm
3
Hello @geraldss , this was working fine with 4.1.0 but in 4.1.1 itâs not working.
Yes, that doesnât surprise me. Some unintended consequence. My apologies.
isha
December 15, 2016, 4:58pm
5
Hi @Chi
If you refer to the documentation
http://developer.couchbase.com/documentation/server/current/tools/cbq-shell.html#topic_bzd_zwr_w5
See the the --user, --password and --credentials options.
from your above query, it looks like the credentials are bucket credentials. You can use the following for the same
./cbq --credentials=my_url:spnpass http://127.0.0.1:8093
Or, once you are within a cbq session you can set it using the \SET command as follows
cbq > \SET -creds my_url:spnpass;
cbq > create primary âŚ
Thanks
Isha
isha
December 15, 2016, 10:49pm
7
With 4.1 it might be better to pass in administrator credentials instead of explicit bucket credentials. This way you should be able to access all buckets without authorization.
./cbq -engine=âhttp://Administrator@password @127.0.0.1 :8093â
Otherwise you can have 2 separate cbq sessions for the create index and query.
Ideally itâll be good to upgrade to 4.5.1 since it is easier to handle different scenarios with the new shell.
Thanks
Isha
Chi
December 16, 2016, 5:50am
8
This didnât work for me. It seems it is unable to validate userâs bucket credentials when executing through command line.
It needs an upgrade.
Thanks,
Chi
isha
December 21, 2016, 4:51pm
9
@Chi
I suggest you download 4.5 and use the new shell instead of the old one. It is much more convenient to use.
Downloading the new version
About the new shell :
Thanks
Isha
isha
December 21, 2016, 4:51pm
10
There seems to be a type here
It should be
./cbq -engine=âhttp://Administrator:password@127.0.0.1:8093 â
Sorry about that
Thanks
Isha
Youâre using the wrong QUOTE around my_url.
You donât need any quotes.
If you do want to delimit, use BACK-QUOTES. Example: my_url
Chi
December 22, 2016, 7:29am
12
In my code I used BACK-QUOTES. Here I canât do so inside Preformatted text
. So itâs a substitute to represent what I have done. Anyway itâs bug in 4.1.1 which canât validate bucket credential when executing through command line. See above for more details.
Chi
December 23, 2016, 1:51pm
13
This works for meâŚThank you thank you tank you very muchâŚ
1 Like