Command Line Tools

Command Line Tools

The command-line interface provides commands to start and stop Analytics, and running the cbq.
Note: The command line tools for Analytics are volatile in the Developer Preview. They may change significantly in the future.

Starting and Stopping Analytics

You can start and stop the sample cluster by running the following commands:
  • On Linux and Mac OS X systems:
    cd cbas
    ./samples/local/bin/start-sample-cluster.sh
    ./samples/local/bin/stop-sample-cluster.sh
  • On Windows systems:
    cd cbas
    .\samples\local\bin\start-sample.cluster.bat
    .\samples\local\bin\stop-sample-cluster.bat

Running the cbq

The cbq is the command line shell for executing queries against Couchbase Server. Analytics contains a special version of cbq that works with the analytics service and can execute multi-line statements. Make sure you use the version of cbq located in your Analytics install folder.

If you’re running Analytics on Docker, execute cbq using the following command:

docker exec -it analytics cbq

The cbq tool enables you to run N1QL queries from the command line.

The base syntax is:

cbq> create primary index on 'beer-sample';
cbq> select * from 'beer-sample' limit 1;