An excellent way to understand the functionality of a tool is through a tutorial. The following section is a tutorial on how to use Control Center.
It is assumed that during the installation of PostgreSQL - Red Hat Edition, the post-installer was run, which created a database cluster in /var/lib/pgsql/data. It is also assumed that Control Center was started by the superuser postgres.
Topics to be covered in this tutorial are:
Browsing for a database engine
Initializing a database cluster
Modifying database cluster configuration files
Allowing TCP/IP connections
Modifying Host-Based Authentication configuration
Starting a database engine
Stopping a database engine
There is the possibility that a server may have many PostgreSQL versions that have different, sometimes incompatible, file formats. Before you initialize a database cluster, you must associate or assign a Database Engine to the cluster.
For this tutorial, there is just one available database engine. For future reference, to assign a database engine to a cluster, from the Menu Bar select Init => Assign Engine. The Assign Engine dialog appears.
For this tutorial, selecting Init => Assign Engine displays the following informational dialog.
After a clean install, when you start Control Center (as described in Section 6.3 Starting Control Center), you will notice that the cluster icon beside the rhdb cluster name is blue and the Engine State is Not Initialized. This is due to the fact that the rpm post install step creates the cluster but does not initialize it. The rhdb cluster name is associated with the service script of the same name.
The first task is to initialize the default database cluster. To initialize a database cluster, from the Menu Bar choose Init => Initialize Main Storage Area.
The Initialize Main Storage Area dialog appears. For the purpose of this tutorial, you will just select the defaults. The Cluster Name, rhdb, is the name of the service script. The PGDATA path will be /var/lib/pgsql/data and the Database Engine will be selected from /usr/bin, which contains the PostgreSQL - Red Hat Edition 7.3.4 enhanced postmaster.
Select OK to initialize the default database cluster. Once the cluster has been successfully initialized, notice that the Summary Area has been updated to display a red cluster icon and an Engine State of Stopped. This means that the cluster has been initialized but the database engine has not been started.
For the purposes of the other tutorials in this manual, you will update the configuration files for the cluster to allow connections over TCP/IP with the postmaster listening on port 5432.
To allow the postmaster to accept TCP/IP connections on port 5432, you will need to modify two configuration files, postgresql.conf and pg_hba.conf, located in the /var/lib/pgsql/data directory. In this section, you will use Control Center to modify these files.
To allow the postmaster to accept TCP/IP connections, from the Menu Bar select Edit => Cluster. The Edit Cluster dialog appears.
Enable TCP/IP by selecting the TCP/IP Enabled checkbox and selecting OK.
Notice that the Detail Area states that TCP/IP has been enabled, but is not currently listening on the port. This is due to the engine not being started yet. You can also display the current setting of the tcpip_socket option by selecting the Options tab in the Detail Area.
Another method of altering the TCP/IP setting is to edit the Run Time Options. To edit the Run Time Options, from the Menu Bar select Edit => Run Time Options. The Edit Run Time Options dialog appears. This dialog displays the current run time options for the cluster. Select the Connections & Authentication tab.
Notice that tcpip_socket already has a value of true. If you wish to change this value to false, select tcpip_socket to highlight the choice and select Edit.
Now that TCP/IP has been enabled, you must modify the Host-Based Authentication (HBA) file, pg_hba.conf, to allow connections using TCP/IP. For more information on Host-Based Authentication, refer to the PostgreSQL 7.3 Administrator's Guide. For the purposes of this tutorial, you will add the following line to the pg_hba.conf file to allow connections from anywhere, with trust authentication.
host all all 0.0.0.0 0.0.0.0 trust
This setting is for tutorial purposes only. This may or may not be acceptable for your installation. Refer to the PostgreSQL 7.3 Adminstrator's Guide for more information on Host-Based Authentication.
To alter the pg_hba.conf information, from the Menu Bar select Edit => HBA. The Edit HBA dialog appears.
To add a new line in the pg_hba.conf file, select Add. The Add HBA Entry dialog appears. Click on the Type combo box to select the host. Enter an IP-Address and IP-Mask of 0.0.0.0 and select a Method of trust.
Select OK to submit the changes. Notice that the Edit HBA dialog has been updated to include the modifications.
Select OK to close the Edit HBA dialog.
You have now successfully configured the default database cluster to accept TCP/IP connections on port 5432 using trust host-based authentication. The next task is to start the database engine associated with the cluster. To start the database engine, you can either select Control => Start from the Menu Bar or select the Start Engine button from the Toolbar.
Notice that the cluster icon beside the rhdb cluster in the Summary Area is now green (representing Started) and that the Engine State has changed to Started. At this point, you can start using the other PostgreSQL - Red Hat Edition Graphical Tools against the default cluster.
Now that you have started database engine successfully, the next task is to stop the database engine. To stop the database engine, you can either select Control => Stop from the Menu Bar or select the Stop Engine button from the Toolbar.
Notice that the cluster icon beside the rhdb name in the Summary Area is now red (representing Stopped) and that the Engine State has changed to Stopped.