Connecting N1QL to a remote couchbase server


#1

Hello experts.
I’m trying to connect a remote couchbase server to N1QL and run interactive queries on it.
What are the steps I need to follow in order to start running queries?
What should I install and run on the server and what should I install and run on my local machine?
Also, should I create any view / index in order to start running queries?

The remote server couchbase server 3.0.1, on AWS ubuntu machine.
The local machines I’m using are OSX and windows.

Thanks


#2

Could you try the instructions given here - should be fairly straightforward I’d hope.
http://docs.couchbase.com/developer/n1ql-dp3/n1ql-intro.html

To get started, navigate to the downloads page and download N1QL.

N1QL Binaries

To run N1QL on your local system:

Step 1: Expand the package archive.
Step 2: On the command line, navigate to your local N1QL directory.
Step 3: Run ./start_tutorial.sh (Unix)
./start_tutorial.bat (Windows)
Step 4: Open http://localhost:8093/tutorial in your browser
to use the tutorial on your local server.

     To connect N1QL with your Couchbase Server:
         ./cbq-engine -couchbase http://[server_name]:8091/

     To use the command-line interactive query tool:
         ./cbq-engine=http://[couchbase-query-engine-server-name]:8093/

Step 5: Before issuing queries against a Couchbase bucket,
run the following command from the query command line:

CREATE PRIMARY INDEX ON [bucket-name]


#3

N1QL is a great technology to ease the creation of indexes and do more advanced searches than just single key lookups.
Just be aware that its indexing is buggy - in a 2 server setup the indexes are only used 50% of the time… making percieved speed a bit random.


#4

Thanks @ilam.
Your reference helped. Some how I didn’t find this reference when looking for one.
I do think there is a mistake there. it is written:

I think it should be

(There should be a space between “cbq” and “-engine”)

Thanks


#5

Thanks @Lennartos.
I will keep that in mind.
For now, our need for N1QL is for our QA team that knows SQL but will find trouble in writing code or try to write views to do the tests.
For the programmer side that writes code, I don’t see the added value of N1QL upon the basic operations of views in couchbase.
I hope Couchbase team will consider the need to have a proper interactive query tool and invest in that direction :smile:


#6

Hi gluz, have you been using cbq? Please let us know the things you need in an interactive tool.

http://blog.couchbase.com/n1ql-dp4-is-here

Thanks.


#7

I’ve abandoned it as it didn’t work properly.
I will try the new version.

Thanks.


#8

hi @geraldss
sorry for opening again this thread, I am running into issues running N1QL
Please check issue here;


#9

Hi @couchbwiss,

You need to do the following:

On your Couchbase 4.0 node, make sure Couchbase Server is not running.

The run the following command in one terminal:

$CBPATH/cbq-engine -datastore http://158.7.21.101:8091

And in a separate terminal, run:

$CBPATH/cbq

where $CBPATH is the path to the binaries for your Couchbase 4.0 installation.


#10

@geraldss Thanks for your help.

At the end I uninstalled the 3 nodes cluster of Couchbase server 3.0.3 version and installed the version 4.0 and now I am able to use N1QL from the query nodes.
cheers