Github

Build Greengage DB from the source code

Andrey Aksenov

This topic describes how to build Greengage DB (based on Greenplum Database) on Linux operating systems and run a demo cluster. The source code for Greengage DB is available in the greengage repository. This repository also includes scripts to help you install the dependencies required to build Greengage DB on the required platform.

Prerequisites

To follow the steps described in this document, you need one of the following operating systems:

  • Ubuntu 22.04.

  • CentOS 7.9.

For both operating systems, make sure you have git installed.

Configure an operating system

First, you need to customize some of the operating system parameters to ensure a demo Greengage DB cluster can operate correctly.

Deactivate SELinux (CentOS)

  1. Open the /etc/selinux/config file for editing:

    $ sudo vi /etc/selinux/config
  2. Set the SELINUX parameter to disabled to turn SELinux off:

    SELINUX=disabled
  3. Save and close the file.

  4. Reboot the system to apply the changes.

Edit sysctl.conf

  1. Open the /etc/sysctl.conf file for editing:

    $ sudo vi /etc/sysctl.conf
  2. Specify the following parameters:

    vm.overcommit_memory = 2
    vm.overcommit_ratio = 95
    net.ipv4.ip_local_port_range = 10000 65535
    kernel.sem = 250 2048000 200 8192
  3. Save and close the file.

  4. To apply the changes, run the sysctl command:

    $ sudo sysctl --system

Edit limits.conf

  1. Open the /etc/security/limits.conf file:

    $ sudo vi /etc/security/limits.conf
  2. Specify the following options for the gpadmin user:

    gpadmin soft nofile 524288
    gpadmin hard nofile 524288
    gpadmin soft nproc 150000
    gpadmin hard nproc 150000

    gpadmin is created in the next section.

  3. Save and close the file.

Create the Greengage DB administrative user

You need to create a system user account used to run and administer Greengage DB and generate an SSH key pair for this account. To do this, follow the steps in Create the Greengage DB administrative user. Then, you need to enable passwordless SSH for this user, as described below.

Enable passwordless SSH

  1. Add the content of the generated public key to the authorized_keys file:

    $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  2. Change the permissions of the authorized_keys file as follows:

    $ chmod 600 ~/.ssh/authorized_keys
NOTE

Use the ssh <hostname> command to verify the ability to connect to the host using SSH without a password.

Clone the Greengage DB repository

  1. Ensure you are logged in as gpadmin and in the home directory.

  2. Clone the greengage repository:

    $ git clone --recurse-submodules https://github.com/GreengageDB/greengage.git
  3. Change the current directory to greengage:

    $ cd greengage

Install the dependencies

This section describes installing the dependencies required to build Greengage DB on different operating systems.

  1. Execute the README.ubuntu.bash script to install the dependencies:

    $ sudo ./README.ubuntu.bash
  2. Create a symbolic link from python2 to /usr/bin/python:

    $ sudo ln -s python2 /usr/bin/python
  3. Install the locale settings for the English (United States) language with UTF-8 encoding:

    $ sudo locale-gen "en_US.UTF-8"
  1. Execute the README.CentOS.bash script to install the dependencies:

    $ sudo ./README.CentOS.bash
  2. Open the /etc/ld.so.conf file for editing:

    $ sudo vi /etc/ld.so.conf
  3. Add the following lines to the file to ensure that the dynamic linker can find shared libraries:

    /usr/local/lib
    /usr/local/lib64
  4. Save and close the file.

  5. Update the system’s cache of shared libraries using ldconfig:

    $ sudo ldconfig

Install psutil

  1. Install the pip package manager:

    $ sudo apt install python-pip
  2. Install the psutil package:

    $ pip2 install psutil

No additional actions are required. The pip package manager and the psutil package are installed using the README.CentOS.bash script.

Build and install Greengage DB

  1. Change the current directory to greengage:

    $ cd ~/greengage
  2. Configure the build environment as follows to build Greengage DB:

    $ ./configure \
      --with-perl \
      --with-python \
      --with-libxml \
      --with-gssapi \
      --prefix=/usr/local/gpdb
    NOTE

    To see all the available build options, run ./configure --help.

  3. Compile Greengage DB using make:

    $ make -j$(nproc)

    If the compilation is finished successfully, the output should contain this information:

    ...
    All of Greengage Database successfully made. Ready to install.
  4. Install Greengage DB using make install:

    $ sudo make -j$(nproc) install

    If the installation is successful, the output should contain this information:

    ...
    Greengage Database installation complete.
  5. Change the owner and group of the installed files to gpadmin:

    $ sudo chown -R gpadmin:gpadmin /usr/local/gpdb*
    $ sudo chgrp -R gpadmin /usr/local/gpdb*
  6. Set the Greengage DB path and environment variables as follows:

    $ source /usr/local/gpdb/greengage_path.sh
    NOTE

    Add the above source command to the gpadmin user’s shell startup file (for example, .bashrc). This sets the Greengage DB path and environment variables each time you log in as gpadmin.

Create a demo cluster

This section shows how to run a demo cluster.

Start a demo cluster

  1. Start a demo cluster by executing the command below:

    $ make create-demo-cluster
  2. After the cluster is initialized and started, source the gpAux/gpdemo/gpdemo-env.sh file to set values of the PGPORT and MASTER_DATA_DIRECTORY environment variables:

    $ source gpAux/gpdemo/gpdemo-env.sh
  3. Check the cluster state to make sure all the instances are up and running:

    $ gpstate

Verify the cluster

  1. List all cluster databases:

    $ psql -l

    The result can look like this:

                                   List of databases
       Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges
    -----------+---------+----------+------------+------------+---------------------
     postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |
     template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
               |         |          |            |            | gpadmin=CTc/gpadmin
     template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
               |         |          |            |            | gpadmin=CTc/gpadmin
    (3 rows)
  2. Connect to the default postgres database:

    $ psql postgres

    The output should look like this:

    psql (9.4.26)
    Type "help" for help.
  3. Get the version information about the installed Greengage DB:

    SELECT version();

    The output might look like this:

PostgreSQL 9.4.26 (Greengage Database 6.28.0 build dev) on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit compiled on Jan 27 2025 09:11:47
PostgreSQL 9.4.26 (Greengage Database 6.28.0 build dev) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit compiled on Jan 28 2025 14:25:05