HowTo: Install the SCM PostgreSQL Database on a Remote Server
From SCInterface Wiki
Installation notes pending. Please posted to the forums if you have a question at http://forums.scinterface.com.
The reason of this document is to offer some assistance to help setup SCInterface so that the SCM can connect to a remote database. This setup is done in two parts:
- First the database server setup then the SCM setup.
- The user will be asked up to 4 questions : db host, db port, db user and password.
This article may also be useful in order to Configure PostgreSQL Defaults with SCInterface.
Database Setup for Postgresql 7.4+/8.x
The following only needs to be done once on the initial database setup.
- Remote access setup
- You will need to make sure that your database server is setup to accept incoming tcp connections. This is done in the postgresql.conf file usually found in /etc/postgresql*/main or somewhere under /var/lib/pgsql.
- listen_addresses = '*'
- port = 5432
- Now to make sure that users using tcp connections can use passwords to log in : open pg_hba.conf which would be in the same folder as your postgresql.conf file.
- make sure you have a line that looks like this that is uncommented : host all all 0.0.0.0 0.0.0.0 md5
- You will need to make sure that your database server is setup to accept incoming tcp connections. This is done in the postgresql.conf file usually found in /etc/postgresql*/main or somewhere under /var/lib/pgsql.
- DB setup
- Download and run the SCInterface Postgresql Database setup script : http://download.scinterface.com/db_pg_install.sh
- scmuser access password
- Connect into the database using your favorite client, then set the scmuser's password to something.
- su - scmuser
- psql SCM_ServerDB
- -OR-
- psql -H hostname -p port -U username databasename -W
- This password will have to be given to the SCM installer when asked for it later on. The output of 'SELECT MD5(RANDOM());' is usually a good choice here, since you don't need to memorize this by any means, and using an easy password would greatly compromise the security of your system.
- ALTER USER scmuser WITH PASSWORD '59992159d25c48e06f8354e7f9846f65';
- Connect into the database using your favorite client, then set the scmuser's password to something.
- Each remote SCM will not have to run this. Add the database information into the main database for the SCMs to use. Here is an example:
SCM_ServerDB=> select a.*,b.* from serverlist as a, dbservers as b where a.serverid=b.serverid; serverid | servername | address | port | servertype | serverplatform | serverid | username | password | databasename | version ----------+------------+--------------------------------+------+------------+----------------+----------+----------+----------+--------------+--------- 10000 | ServerDB | myserver.scinterface.com | 5432 | dbServer | 1 | 10000 | scmuser | | SCM_ServerDB | 2.0 10001 | LogsDB | myserver.scinterface.com | 5432 | dbServer | 1 | 10001 | scmuser | | SCM_Logs | 2.0 (2 rows) SCM_ServerDB=> update dbservers set password='RANDOMPASSWORDHERE'; UPDATE 2 SCM_ServerDB=> \q [root@mysci ~]# service SCM stop [root@mysci ~]# service SCM start Starting the SCInterface SCM [root@mysci ~]# netstat -an | grep 510 tcp 0 0 0.0.0.0:51026 0.0.0.0:* LISTEN tcp 1 0 64.34.199.205:33510 160.36.178.159:80 CLOSE_WAIT
Configuring a Remote SCM
- Changes to get the SCM to start.
- Adding a new SCM to the current database with an SCM already installed
- Login to the UI.
- Select Admin -> SCManagers
- Add another SCManager with the correct IP address and hostname.
- Adding a new SCM to the current database with an SCM already installed
- Note: This step may be deprecated. Changes to get the SCM to start on a new installation
- Connect to the SCM_ServerDB database, go to the serverlist table. For your sanity's sake, do not directly add or remove entries in this table.
- Set the address of the two databases to be either a dns-resolvable hostname or numeric ip(v4) address (in the x.x.x.x format)
- UPDATE serverlist SET address='dbhost.mydomain.com' WHERE serverid=10000 OR serverid=10001;
- Set the address of the SCM entry to be the FQDN of the server hosting your SControlManager (the one where servertype = iGMServer). This __must__ match the output of `hostname -f` on that host.
- UPDATE serverlist SET address='scmhost.mydomain.com' WHERE serverid=20000;
- SCM Setup
- Proceed through normal installation steps here (download + run the SCInterface installation script http://download.scinterface.com/scinterface_install.sh), and if you opt to install or upgrade the SCM component, you will be asked some questions about the database to initially connect to. Enter your database hostname, port, username and password when asked for them and your SCM will be automatically setup for you.
- For those of you who are already configured with a local database, you can move this db to the remote one via pg_dump and all that good stuff, then choose to reinstall the SCM (option=I). This will uninstall your SCM + DB, then when you are in the SCM configuration area an enter the remote address, the installer will skip local db config.
- It may also be useful to install postgresql-libs and postgresql-devel as these are needed to debug the communication between the remote SCM and the database. The HowTo: Install PostgreSQL is a useful reference for this.
- Repeat the two steps above for each SCM that you wish to have connect into the remote PostgreSQL server.

