This documentation shows how to set up and configure Moab to connect to a PostgreSQL database using the ODBC driver. This document assumes the necessary ODBC drivers have already been installed and configured.
To set up and configure Moab to connect to a PostgreSQL database using the ODBC driver, do the following:
![]() |
This solution has been tested and works with these file versions:
For a Debian-based system, unixodbc-dev is required, but it might not be required for Red Hat flavors (such as CentOS and RHEL). |
Configure the PostgreSQL and ODBC driver. The /etc/odbcinst.ini file should contain content similar to what follows:
[PostgreSQL] Description = PostgreSQL ODBC driver Driver = /usr/lib/odbc/psqlodbca.so Setup = /usr/lib/odbc/libodbcpsqlS.so Debug = 0 CommLog = 1 UsageCount = 2
Configure Moab to use the PostgreSQL ODBC driver. Moab uses an ODBC datastore file to connect to PostgreSQL using ODBC. This file must be located in the Moab home directory (/opt/moab by default) and be named dsninfo.dsn, which is used by Moab. If the following content, which follows the standard ODBC driver file syntax, is not already included in the /etc/odbc.ini file, make sure that you include it. Also, include the same content in the dsninfo.dsn file.
[ODBC] Driver = PostgreSQL Description = PostgreSQL Data Source Servername = localhost Port = 5432 Protocol = 8.4 UserName = postgres Password = moab Database = Moab
![]() |
The user should have read/write privileges on the Moab database. |
The preceding example file tells ODBC to use the PostgreSQL driver, postgres user, moab password, and to connect to PostgreSQL running on the localhost on port 5432. ODBC uses this information and connects to the database called Moab.
Test the ODBC to PostgreSQL connection by running the isql command, which reads the /etc/odbc.ini file:
$ isql -v ODBC +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> show tables; +-----------------------------------------------------------------+ | Tables_in_Moab | +-----------------------------------------------------------------+ | EventType | | Events | | GeneralStats | | GenericMetrics | | Moab | | NodeStats | | NodeStatsGenericResources | | ObjectType | | mcheckpoint | +-----------------------------------------------------------------+ SQLRowCount returns 10 10 rows fetched SQL>
If you encounter any errors using the isql command, then there were problems setting up the ODBC to PostgreSQL connection.
> ./moab-db-postgresql.sh postgres Create db user "postgres" in postgreSQL? (y/n)>
Download and install the ODBC version of Moab. Install and configure Moab as normal but add the following in the Moab configuration file (moab.cfg):
USEDATABASE ODBC # Turn on stat profiling USERCFG[DEFAULT] ENABLEPROFILING=TRUE GROUPCFG[DEFAULT] ENABLEPROFILING=TRUE QOSCFG[DEFAULT] ENABLEPROFILING=TRUE CLASSCFG[DEFAULT] ENABLEPROFILING=TRUE ACCOUNTCFG[DEFAULT] ENABLEPROFILING=TRUE NODECFG[DEFAULT] ENABLEPROFILING=TRUE
![]() | > moabd is a safe and recommended method of starting Moab if things are not installed in their default locations. |
Copyright © 2012 Adaptive Computing Enterprises, Inc.®