Deploying a Single Node Cluster with Docker
To run a single node cluster, you need to deploy a single Couchbase Server container representing the single node.
For deployments with Couchbase Server containers, use the Couchbase Docker images available on Docker Hub.
- Start the Couchbase Server container, db, using the following command:
docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase
This command downloads and runs the container tagged "latest" from the Couchbase repo on Docker Hub.Check the Docker logs to verify that the container has started:
If the container is started, it should return the following output:
docker logs db
Starting Couchbase Server -- Web UI available at http://<ip>:8091Note: If Couchbase Server is running locally on the machine without containers, the port mappings specified using the -p option may fail. Ensure that you stop your local instance of Couchbase Server before running the above command.
- From the browser, access the Web Console using http://localhost:8091. If the container is up and running, you should see the Couchbase Server Setup Screen.
- Set up Couchbase Server. Walk through the Setup wizard and accept default values.
You may need to lower the RAM allocated to various services to fit within the bounds of the resource for the containers. Enable the `travel-sample` and `beer-sample` buckets to load some sample data.
This is all that is needed for a single node deployment of Couchbase Server. If you want to add nodes to your cluster, see Deploying a Multi-node Cluster with Docker.
Running a N1QL Query
SELECT name FROM `beer-sample` WHERE brewery_id ="mishawaka_brewing";
- Run the interactive shell on the container:
bash -c "clear && docker exec -it db sh"
- Navigate to the bin directory:
# cd /opt/couchbase/bin
- Run the cbq command line tool:
- Execute a N1QL query on the `beer-sample` bucket:
cbq> SELECT name FROM `beer-sample` WHERE brewery_id ="mishawaka_brewing";
For more query samples, see Running Your First N1QL Query.
Connect via SDK
Simply run your application through the Couchbase Server SDKs on the host and point it to http://localhost:8091/pools to connect to the container.
For information on deploying a sample application to a container, see Sample Application.