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.
|Before you begin, review the container requirements section for prerequisites and resource requirements for the containers.|
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:
docker logs db
If the container is started, it should return the following output:
Starting Couchbase Server -- Web UI available at http://<ip>:8091
If Couchbase Server is running locally on the machine without containers, the port mappings specified using the
-poption 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
beer-samplebuckets 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.
Open the Web Console at http://localhost:8091 and switch to the Query tab. Run the following N1QL query:
SELECT name FROM `beer-sample` WHERE brewery_id ="mishawaka_brewing";
To run a query from command line query tool:
Run the interactive shell on the container:
bash -c "clear && docker exec -it db sh"
Navigate to the bin directory:
# cd /opt/couchbase/bin
cbqcommand line tool:
Execute a N1QL query on the
cbq> SELECT name FROM `beer-sample` WHERE brewery_id ="mishawaka_brewing";
For more query samples, see Running Your First N1QL Query.
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 more information about deploying a sample application, java-sdk::sample-application.adoc.