Quick Start

Quick Start

Using this section, get Analytics up and running quickly, and learn how to run analytic queries on rich, flexible JSON documents.

Try it out and let us know what do you think. As always, we like to hear from you.

Assumptions:

  • You are comfortable using Couchbase Server and know how to query it using N1QL.

  • You already have a running instance of Couchbase Server 4.5 on your platform or you're using Docker.
  • You know how to interact with it using the Couchbase Web Console.
  • You have the Couchbase beer-sample data bucket installed on your system.

You can either try Analytics using Docker or you can install it natively on your system.

Using Docker

  1. If you have Docker installed on your system and a fast internet connection, run the following command:
    docker run -d --name analytics -p 8095:8095 couchbasesamples/analytics-demo
    Alternatively, run the mini cluster on Docker with all necessary ports open to support the sample Analytics visualization:
    docker run -d --name analytics -p 8091-8095:8091-8095 -p 11210:11210 couchbasesamples/analytics-demo

    After the initial download completes, the services start up automatically so that you have a functioning mini-cluster running 1 x Couchbase Server node and 2 x Analytics nodes.



  2. Run your queries using the Analytics Workbench on http://<your-docker-ip>:8095, for example, http://192.168.99.100:8095/ is a common Docker default machine IP. To run queries using the Analytics Workbench, see Running Your First Analytics Query for details.

    If your Docker host is not running as localhost, you can find your Docker host IP address by running the following command:

    • On Linux and Mac OS X systems:
      echo $DOCKER_HOST

      Result:

      tcp://192.168.99.100:2376
    • On 64-bit Windows system, refer to the Docker documentation.
  3. Once you're all done experimenting, stop the docker image by running the following command:
    docker stop analytics

Using the Executable

Prerequisites
  • Couchbase Server 4.5

    For installation instructions, see Quick Installation and Setup.

  • Oracle JDK 1.8+
    Note: Make sure to install the Oracle JDK. Other alternatives, such as OpenJDK, may fail due to missing packages.
Installation
  1. Download the Analytics DP1 pre-built bundle from here.
  2. Unzip the bundle:
    • On Linux and Mac OS X systems, run the following command:
      unzip path_to_bundle/couchbase-analytics-1.0.0-SNAPSHOT-generic.zip
    • On Windows systems, right-click on the compressed file and select Extract All. Follow the installer instructions.
Starting and Stopping Analytics
  1. Start the sample local cluster by running the following commands:
    • On Linux and Mac OS X systems:
      cd cbas
      ./samples/local/bin/start-sample-cluster.sh
    • On Windows systems:
      cd cbas
      .\samples\local\bin\start-sample-cluster.bat
  2. Once the cluster is up and running, you're ready to run your first Analytics query. For details, see Running Your First Analytics Query.
  3. After you’re done using the system, stop the sample local cluster by running the following command:
    • On Linux and Mac OS X systems: ./samples/local/bin/stop-sample-cluster.sh
    • On Windows systems: .\samples\local\bin\stop-sample-cluster.bat

Running Your First Analytics Query

A custom standalone Analytics Workbench is available with the Developer Preview.

  1. Open a browser and go to http://localhost:8095 to access the Analytics Workbench. We recommend Google Chrome or Mozilla Firefox browsers.

    Note: For the Docker image, the URL may be different as explained in the Using Docker section.
  2. Verify the connectivity to Analytics by running the following simple query and then click Execute:
    SELECT "Hello, beer!" AS greeting;
    Note: You must press the Execute button in the Analytics Workbench; unlike Query Workbench, pressing Enter or Return will not immediately execute a statement because Analytics accepts multi-line statements.

Congratulations! You’ve just executed your first Analytics query on your Couchbase data.

The Tutorial uses the Analytics Workbench. If you prefer, you can run queries using the cbq or the REST API directly. For details, see Running Queries.