Skip to content

Commit

Permalink
Change order of commands to create db (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonels-msft committed Nov 18, 2020
1 parent 8e866f3 commit 0fd7cfd
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions admin_guide/cluster_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,32 +740,26 @@ Creating a New Database

Each PostgreSQL server can hold `multiple databases <https://www.postgresql.org/docs/current/static/manage-ag-overview.html>`_. However new databases do not inherit the extensions of any others; all desired extensions must be added afresh. To run Citus on a new database, you'll need to create the database on the coordinator and workers, create the Citus extension within that database, and register the workers in the coordinator database.

On an existing database on the coordinator run:
Connect to each of the worker nodes and run:

.. code-block:: psql
-- create the new db on coordinator and workers
-- on every worker node
CREATE DATABASE newbie;
SELECT run_command_on_workers('CREATE DATABASE newbie;');
\c newbie
CREATE EXTENSION citus;
-- review the worker nodes registered in current db
SELECT * FROM master_get_active_worker_nodes();
Then, on the coordinator:

-- switch to new db on coordinator
\c newbie
.. code-block:: psql
-- create citus extension in new db
CREATE DATABASE newbie;
\c newbie
CREATE EXTENSION citus;
-- register workers in new db
SELECT * from master_add_node('node-name', 5432);
SELECT * from master_add_node('node-name2', 5432);
-- ... for each of them
In the new db on every worker, manually run:

.. code-block:: postgresql
CREATE EXTENSION citus;
-- ... for all of them
Now the new database will be operating as another Citus cluster.

0 comments on commit 0fd7cfd

Please sign in to comment.