Connecting N1QL to a remote couchbase server

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.


Could you try the instructions given here - should be fairly straightforward I’d hope.

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 ./ (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:

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


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.

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 @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:

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


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


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

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

And in a separate terminal, run:


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

1 Like

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