-
-
Save vishaltelangre/b5aba6a9d4731db58d521e01904068ef to your computer and use it in GitHub Desktop.
Revisions
-
marchelbling revised this gist
Aug 26, 2018 . 5 changed files with 49 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ -- user: CREATE ROLE citus WITH NOSUPERUSER LOGIN IN ROLE pg_monitor; -- database: ALTER DATABASE citus SET citus.shard_replication_factor = 1; ALTER DATABASE citus OWNER TO citus; -- extensions: CREATE EXTENSION IF NOT EXISTS "hll"; CREATE EXTENSION IF NOT EXISTS "topn"; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ FROM citusdata/citus:7.5.0 COPY 100-local-citus.sql /docker-entrypoint-initdb.d/ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ # Why this gist? This gist propose a clean way to run a local Citus cluster. A custom database called `citus` is created when containers are created and `/docker-entrypoint-initdb.d/` hooks allow to create a custom role, change `citus` database ownership and install any needed extension. View [Running Citus in Docker](http://marc.helbling.fr/running-citus-locally/) for details and another [gist](https://gist.github.com/marchelbling/8a0b47e82d0993c8a5a4726611d5ccfd) for a worse approach! ## Build `docker build -t local-citus:latest .` ## Run `docker-compose -p citus up --scale worker=2 -d` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ version: '2.1' services: master: container_name: "${COMPOSE_PROJECT_NAME:-citus}_master" image: 'local-citus:latest' ports: ["${MASTER_EXTERNAL_PORT:-5432}:5432"] labels: ['com.citusdata.role=Master'] environment: - POSTGRES_DB=citus worker: image: 'local-citus:latest' labels: ['com.citusdata.role=Worker'] depends_on: { manager: { condition: service_healthy } } environment: - POSTGRES_DB=citus manager: container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager" image: 'citusdata/membership-manager:0.2.0' volumes: ['/var/run/docker.sock:/var/run/docker.sock'] depends_on: { master: { condition: service_healthy } } environment: - POSTGRES_DB=citus -
marchelbling created this gist
Aug 26, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ -- user: CREATE ROLE citus WITH NOSUPERUSER LOGIN IN ROLE pg_monitor; -- database: ALTER DATABASE citus OWNER TO citus; -- extensions: CREATE EXTENSION IF NOT EXISTS "hll"; CREATE EXTENSION IF NOT EXISTS "topn"; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ FROM citusdata/citus:7.5.0 COPY 100-local-citus.sql /docker-entrypoint-initdb.d/