This chapter contains instructions for configuring Red Hat Enterprise Linux to make database services highly available.
Note | |
---|---|
The following descriptions present example database configuration instructions. Be aware that differences may exist in newer versions of each database product. Consequently, this information may not be directly applicable. |
A database service can serve highly-available data to a database application. The application can then provide network access to database client systems, such as Web servers. If the service fails over, the application accesses the shared database data through the new cluster system. A network-accessible database service is usually assigned an IP address, which is failed over along with the service to maintain transparent access for clients.
This section provides an example of setting up a cluster service for an Oracle database. Although the variables used in the service scripts depend on the specific Oracle configuration, the example may aid in setting up a service for individual environments. Refer to Section 6.2 Tuning Oracle Service for information about improving service performance.
In the example that follows:
The service includes one IP address for the Oracle clients to use.
The service requires two mounted file systems, one for the Oracle software (/u01/) and the other for the Oracle database (/u02/), which can be stored in a shared resource such as a GFS filesystem or storage area network (SAN) are set up and exported as a filesystem accessible to the cluster as a resource before the service is added.
An Oracle administration account with the username oracle is created on every cluster nodes that run the service before the service are actually added. Note that only one node can be running the service at a time, but other nodes must be configured for the database service for proper failover to those nodes.
The administration directory must be accessible to all nodes configured for failover of the database service, and therefore must exist on shared storage, such as a GFS cluster or storage area network (SAN) and mounted locally (for example, /u01/app/oracle/admin/db1).
Create a consistent user/group configuration that can properly access Oracle service for each cluster node. For example:
mkdir /users groupadd -g 900 dba groupadd -g 901 oinstall useradd -u 901 -g 901 -d /users/oracle -m oracle usermod -G 900 oracle |
The Oracle service example uses three scripts that must be placed in /users/oracle and owned by the Oracle administration account. The oracle script is used to start and stop the Oracle service. You must specify this as a Script resource when you configure the service using the Cluster Configuration Tool. This script calls the other Oracle example scripts. The startdb and stopdb scripts start and stop the database. Note that there are many ways for an application to interact with an Oracle database.
The following is an example of the oracle script, which is used to start, stop, and check the status of the Oracle service.
#!/bin/sh # # Cluster service script to start, stop, and check status of oracle # cd /users/oracle case $1 in start) su - oracle -c ./startdb ;; stop) su - oracle -c ./stopdb ;; status) status oracle ;; esac |
The following is an example of the startdb script, which is used to start the Oracle Database Server instance:
#!/bin/sh # # # Script to start the Oracle Database Server instance. # ######################################################################## # # ORACLE_RELEASE # # Specifies the Oracle product release. # ######################################################################## ORACLE_RELEASE=9.2.0 ######################################################################## # # ORACLE_SID # # Specifies the Oracle system identifier or "sid", which is the name of # the Oracle Server instance. # ######################################################################## export ORACLE_SID=TEST ######################################################################## # # ORACLE_BASE # # Specifies the directory at the top of the Oracle software product and # administrative file structure. # ######################################################################## export ORACLE_BASE=/u01/app/oracle ######################################################################## # # ORACLE_HOME # # Specifies the directory containing the software for a given release. # The Oracle recommended value is $ORACLE_BASE/product/<release> # ######################################################################## export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE} ######################################################################## # # LD_LIBRARY_PATH # # Required when using Oracle products that use shared libraries. # ######################################################################## export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH ######################################################################## # # PATH # # Verify that the users search path includes $ORACLE_HOME/bin # ######################################################################## export PATH=$PATH:${ORACLE_HOME}/bin ######################################################################## # # This does the actual work. # # Start the Oracle Server instance based on the initSID.ora # initialization parameters file specified. # ######################################################################## /u01/app/oracle/product/9.2.0/bin/sqlplus << EOF sys as sysdba spool /home/oracle/startdb.log startup pfile = /u01/app/oracle/product/9.2.0/admin/test/scripts/init.ora open; spool off quit; EOF exit |
The following is an example of the stopdb script, which is used to stop the Oracle Database Server instance:
#!/bin/sh # # # Script to STOP the Oracle Database Server instance. # ###################################################################### # # ORACLE_RELEASE # # Specifies the Oracle product release. # ###################################################################### ORACLE_RELEASE=9.2.0 ###################################################################### # # ORACLE_SID # # Specifies the Oracle system identifier or "sid", which is the name # of the Oracle Server instance. # ###################################################################### export ORACLE_SID=TEST ###################################################################### # # ORACLE_BASE # # Specifies the directory at the top of the Oracle software product # and administrative file structure. # ###################################################################### export ORACLE_BASE=/u01/app/oracle ###################################################################### # # ORACLE_HOME # # Specifies the directory containing the software for a given release. # The Oracle recommended value is $ORACLE_BASE/product/<release> # ###################################################################### export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE} ###################################################################### # # LD_LIBRARY_PATH # # Required when using Oracle products that use shared libraries. # ###################################################################### export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH ###################################################################### # # PATH # # Verify that the users search path includes $ORACLE_HOME/bin # ###################################################################### export PATH=$PATH:${ORACLE_HOME}/bin ###################################################################### # # This does the actual work. # # STOP the Oracle Server instance in a tidy fashion. # ###################################################################### /u01/app/oracle/product/9.2.0/bin/sqlplus << EOF sys as sysdba spool /home/oracle/stopdb.log shutdown abort; spool off quit; EOF exit |
To use the Cluster Configuration Tool to configure a failover Oracle service installed on Red Hat GFS, perform the following steps:
Start the Cluster Configuration Tool by typing system-config-cluster at a shell prompt.
Create the Oracle Script resource.
Click the Resources property, then click the Create a Resource button.
Choose the Script resource from the drop-down menu.
Create a Name for the resource, such as oracle-script.
Enter the name of the File with path for the Script, such as /users/oracle/oracle.
Click OK to create the resource.
Add the IP address resource for the Oracle service.
Click the Resources property, then click the Create a Resource button.
Choose the IP Address resource from the drop-down menu.
Enter the IP address to be used by clients to access the Oracle service. Leave Link Monitor checked.
Click OK to create the resource.
Add a GFS resource for the Oracle service and administrative files (ORACLE_HOME and ORACLE_BASE).
Click the Resources property, then click the Create a Resource button.
Choose the GFS resource from the drop-down menu.
Enter the Name of the GFS resource where the ORACLE_HOME and ORACLE_BASE files are installed (for example, oracle-home.
Enter the path on the local filesystem where the oracle_home device is mounted in the Mount Point field.
Enter the block device upon which the ORACLE_HOME and ORACLE_BASE files are installed in the Device field.
Enter any mount options needed to mount the GFS resource in the Options field.
Click OK to create the resource.
Add a GFS resource for the Oracle data partition.
Click the Resources property, then click the Create a Resource button.
Choose the GFS resource from the drop-down menu.
Enter the Name of the GFS resource for the oracle data (for example, oracle-data.
Enter the path on the local filesystem where the Oracle data device is mounted in the Mount Point field.
Enter the block device upon which the Oracle data partition is installed in the Device field.
Enter any mount options needed to mount the GFS resource in the Options field.
Click OK to create the resource.
Create the Oracle service.
Click Create a Service. Type a Name for the service in the Add a Service dialog.
In the Service Management dialog, select a Failover Domain from the drop-down menu or leave it as None.
Click the Add a Shared Resource to this service button. From the available list, choose each resource that you created in the previous steps. Repeat this step until all resources have been added.
Click OK.
Click File => Save to save your configuration.