Zoomdata Version

Configuring the Zoomdata Server Behind a Load Balancer

Load balancing helps you to scale Zoomdata to hundreds of users. You can use load balancing both on-premise and with Cloud deployments, meaning you can use load balancing for various environments. When the server is load balanced within your network environment, it includes native SSL support and can proxy websocket traffic.

Zoomdata has tested active-active load balancing configuration, which is the particular setup used in the steps below. In addition, the instructions provided below takes into account that Zoomdata uses its own dedicated PostgreSQL server as the metadata store (in other words, PostgreSQL was installed as part of the Zoomdata installation process).

At a high level, the steps to configure load balancing are as follows:

  1. Configure the PostgreSQL server
  2. Set up the Zoomdata instances
  3. Set up HAProxy

Configuring the PostgreSQL Server

  1. If you have already connected Zoomdata to an existing PostgreSQL server deployed within your network, then you can move on to setting up the Zoomdata instances.
  2. Be advised that you should only install one PostgreSQL instance to manage your metadata in a centralized location for all your Zoomdata instances.
  3. On your machine, install the PostgreSQL instance by running the following based your environment:
  4. For CentOS 6:
  5. sudo yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-2.noarch.rpm
    sudo yum install postgresql95-server
    sudo service postgresql-9.5 initdb
  6. For CentOS 7:
  7. sudo yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
    sudo yum install postgresql95-server
    sudo /usr/pgsql-9.5/bin/postgresql95-setup initdb
  8. After installing, stop the PosgreSQL service:
  9. sudo service postgresql-9.5 stop
  10. Navigate to and open the postgresql.conf file. If the file does not exist, the command also creates the file.
  11. vi /var/lib/pgsql/9.5/data/postgresql.conf
  12. In the file, remove the commenting tag from the listen_addresses= 'localhost' line and append the IP address of the Zoomdata server. The following example provides general guidelines:
  13. #CONNECTIONS AND AUTHENTICATION
    # - Connection Settings -
    # listen_addresses = ' localhost '
    # what IP address(es) to listen on;
    # comma-separated list of addresses;
    # defaults to 'localhost'; use '*' for all
    # (change requires restart)
    #port = 5432

    Using the * allows PostgreSQL to bind all available network interfaces via the localhost, as well as specific IP addresses. You can also use your specific IP addresses. Port 5432 is the default port for PostgreSQL. If you are using another port, make those changes in the PostgreSQL configurations to ensure you can access the custom port.

  14. Navigate to and edit the pg_hba.conf file:
  15. vi /var/lib/pgsql/9.5/data/pg_hba.conf
  16. Locate the following and add the permission for the connection type:
  17.  # TYPE   DATABASE   USER   ADDRESS             METHOD
    # IPv4 local connections
    host all all 0.0.0.0 /0 md5
  18. Save your changes, then restart the PostgreSQL service:
  19. sudo service postgresql-9.5 start
  20. Once PostgreSQL has restarted, grant an administrator access privileges to the PostgreSQL instance, replacing the db_username and db_password with your specific username and password:
  21. sudo -u postgres -H psql -c "CREATE USER <db_username> WITH PASSWORD '<db_password>'"
  22. With the admin user, create databases named zoomdata and zoomdata-scheduler:
  23. sudo -u postgres -H psql -c "CREATE DATABASE \"zoomdata\" WITH OWNER <db_username>"
    sudo -u postgres -H psql -c "CREATE DATABASE \"zoomdata-scheduler\" WITH OWNER <db_username>"
  24. Verify that the server is listening on the correct port by running the following command:
  25. ss -l -n | grep 5432

Setting up the Zoomdata Instances

  1. Install Zoomdata on each server.
  2. Stop the Zoomdata service:
  3. sudo service zoomdata stop 
  4. Navigate to and open the zoomdata.properties file. If the file does not exist, the following command also creates it:
  5. vi /etc/zoomdata/zoomdata.properties 
  6. Either edit (or enter if the file is new) the following information. This ensures that your Zoomdata nodes point to the same PostgreSQL instance. You need to provide the default PostgreSQL name, the username, and password.
  7. spring.datasource.url=jdbc:postgresql://<ip of host>:<port>/zoomdata
    spring.datasource.username=<db_username>
    spring.datasource.password=<db_password>
  8. In the same file, disable the default HTTP requests to redirect to HTTPS. This now allows HAProxy to communicate with Zoomdata via HTTP:
  9. #redirect from http to https
    https.redirect=false
  10. Save your changes and exit the file.
  11. Navigate to and open the scheduler.properties file. If the file does not exit, the following command also creates it:
  12. vi /etc/zoomdata/scheduler.properties 
  13. Either edit (or enter if the file is new) the following information. You again need to ensure your Zoomdata nodes point to the same PostgreSQL instance.
  14. spring.datasource.url=jdbc:postgresql://<ip of host>:<port>/zoomdata-scheduler
    spring.datasource.username=<db_username>
    spring.datasource.password=<db_password>
  15. Save your changes and exit the file.
  16. Restart the Zoomdata service:
  17. sudo service zoomdata restart
  18. Ensure that port 8080 is open on all of your backend servers. If not, run the following command:
  19. sudo iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
    sudo service iptables save

Setting up the HAProxy Server

  1. On your machine, run the following command to install HAProxy:
  2. sudo yum install haproxy
  3. Navigate to the HAProxy folder
  4. cd /etc/haproxy
  5. Create a certificate or copy an existing certificate to the /etc/haproxy folder. If you need to create a certificate, run the following:
  6. sudo openssl genrsa -out ca.key 1024
    sudo openssl req -new -key ca.key -out ca.csr
    sudo openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
    sudo vi cert.pem #Create and save an empty file
    sudo chmod a+w cert.pem
    sudo cat ca.key ca.crt > cert.pem
  7. In the same folder, replace the contents of the haproxy.cfg file with the contents of the Zoomdata haproxy configuration file. In the file, replace the <node1-ip> and <node2-ip> with the IP addresses of your servers. If you have more than two servers, add additional lines for each server.
  8. Save your changes and exit the file.
  9. Start the HAProxy service
  10. sudo service haproxy restart
  11. Use one of the following commands to configure the HAProxy service to start automatically:
    • CentOS6: sudo chkconfig haproxy on
    • CentOS7: sudo systemctl enable haproxy
  12. Ensure that port 443 is open on your load balancer. If not, run the following command:
  13. sudo iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT
    sudo service iptables save

Now that you have configured your servers, you need to test the connectivity. See Accessing Zoomdata from your Web Browser for steps.

For assistance with configuring SAML for use with HAProxy, contact Zoomdata Application Support.

Was this topic helpful?