How to initialize Greenplum on multiple nodes

December 16, 2011

In the [previous article](https://www.2ndquadrant.com/en/2011/12/a-greenplum-41-handbook.html) we have seen how to install Greenplum on multiple nodes.
After installation steps, we must init the entire system.
Let’s see how.


## Actual situation
If tou have followed previous article, you have a Greenplum installed on multiple nodes.
Standar procedure when dealing with a Greenplum database, as well as Postgres, is composed by:
* Installation
* Initialization
* Database Start
In this article, we will see the second and third steps: initializating and starting the database.
## Database initialization
The script that do the job here is gpinitsystem.
gpinitsystem needs a special configuration file, who contains a list of segment host addresses *only*.
Let’s name it hostfile_gpinitsystem.
For example:

segment-hostname-1
segment-hostname-2
...

One more file is needed, its name is gpinitsystem_config. It contains a lot of parameters to configure your system.
An example configration file, to be used as a template, is in $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config.
You can copy that example file and modify it to suits your needs.
A detailed list of all parameter meanings is on Admin Guide at page 67.
The very important part of the file is:

ARRAY_NAME="EMC Greenplum DW"
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data1/primary /data1/primary
/data1/primary /data2/primary /data2/primary /data2/primary)
MASTER_HOSTNAME=master-hostname
MASTER_DIRECTORY=/data/master
MASTER_PORT=5432

Now you can run the gpinitsystem utility with those two files as parameters, this way:

$ gpinitsystem -c gpinitsystem_config -h hostfile_gpinitsystem

After a succesfully initialization you will see a kind message:

Greenplum Database instance successfully create+.

In case of failure, it is possible to get a partially installed system.
Because of that, after a failure in gpinitsystem Greenplum automatically creates a “rollback” script
that can be executed to cleanup things around.
An example cleanup script file would be named:

backout_gpinitsystem_gpadmin_20111216_121053

Is it possible to execute that using GNU bash:

$ sh backout_gpinitsystem_gpadmin_20111216_121053

All Greenplum files partially installed will be removed.
That’s all for now.
I hope that this article, together with the
[previous one](https://www.2ndquadrant.com/en/2011/12/a-greenplum-41-handbook.html), will show you
how easy Greenplum installation is.

Share this

More Blogs