Docker Hub carries Docker images for PostgreSQL, based on Debian Stretch or Alpine Linux. These are not official PostgreSQL Development Group (PGDG) images from postgresql.org, they're maintained in the Docker Library on Github. But as Docker adoption grows these are going to become more and more people's first exposure to PostgreSQL. Jump to Install Postgres and psql on macOS - If you're running macOS, you can use Homebrew's brew command to install Postgres.
This section describes setting up a Citus cluster on a single machine using docker-compose.
Note
The Docker image is intended for development/testing purposes only, andhas not been prepared for production use. The images use default connectionsettings, which are very permissive, and not suitable for any kind ofproduction setup. These should be updated before using the image forproduction use. The PostgreSQL manual explains how tomake them more restrictive.
1. Install Docker Community Edition and Docker Compose
On Mac:
On Linux:
The above version of Docker Compose is sufficient for running Citus, or you can install the latest version.
2. Start the Citus Cluster
Citus uses Docker Compose to run and connect containers holding the database coordinator node, workers, and a persistent data volume. To create a local cluster download our Docker Compose configuration file and run it
The first time you start the cluster it builds its containers. Subsequent startups take a matter of seconds.
Note
If you already have PostgreSQL running on your machine you may encounter this error when starting the Docker containers:
This is because the “master” (coordinator) service attempts to bind to the standard PostgreSQL port 5432. Simply choose a different port for coordinator service with the MASTER_EXTERNAL_PORT
environment variable. For example:
3. Verify that installation has succeeded
To verify that the installation has succeeded we check that the coordinator node has picked up the desired worker configuration. First start the psql shell on the coordinator (master) node:
Then run this query:
You should see a row for each worker node including the node name and port.
Once you have the cluster up and running, you can visit our tutorials on multi-tenant applications or real-time analytics to get started with Citus in minutes.
4. Shut down the cluster when ready
When you wish to stop the docker containers, use Docker Compose:
This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more.
After installing Docker, follow three steps:
Step 1:
Run: docker network create mynet
Step 2:
Run: docker run --name sonar-postgres -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -d -p 5432:5432 --net mynet postgres
Step 3:
Run: docker run --name sonarqube -p 9000:9000 -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-postgres:5432/sonar -d --net mynet sonarqube:5.6
Step 4:
Access http://localhost:9000/
First install Docker on your system, it is available for Windows, Mac and Linux.Click here to download Docker
After installing run: docker version
In order to stablish a communication between Sonar and Postgres containers, we need to create a Docker Network.The following command will create a network called mynet.docker network create mynet
Sonar Qube depends on a database to works correctly, in this example we choose PostgreSQL. The command below creates and runs an instance of PostgreSQL in background with username sonar, password sonar, bounding host port 5432 with container port 5432 inside mynet Docker network.docker run --name sonar-postgres -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -d -p 5432:5432 --net mynet postgres
Creates and runs an instance of Sonar Qube 5.6 with database user, pass and JDBC connection by parameter. Bounding the host port 9000 to container port 9000 inside mynet Docker Network.docker run --name sonarqube -p 9000:9000 -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-postgres:5432/sonar -d --net mynet sonarqube:5.6
Tremblay mais osez ebookers.
At this point you should have Sonar working fine, access http://localhost:9000/ and see if everything works as expected.
Find the CONTAINER ID using the command:docker ps --all
Start a container with the specified CONTAINER ID.docker start YOUR_CONTAINER_ID
Find the CONTAINER ID using the command:docker ps --all
Stop a container with the specified CONTAINER IDdocker stop YOUR_CONTAINER_ID
Following are commands in case you messed up and want to start again.
Stops all containers that are running, if you run this command more than once in a row it will return a message about parameters, this is normal since the second part of the command won't anything after the first time.docker stop $(docker ps -a -q)
Removes all containers, make sure you stopped all containers before run this command, otherwise it won't complete correctly.docker rm $(docker ps -a -q)
Removes all images downloaded, just take care with it since you will need to download all the dependencies again.docker rmi $(docker images -q)