Sun Cluster 2.2 Software Installation Guide

Chapter 6 Installing and Configuring Sun Cluster HA for Sybase

This chapter provides instructions for setting up and administering the Sun Cluster HA for Sybase data service on your cluster nodes.

This chapter includes the following sections:

Preparing to Install Sun Cluster HA for Sybase

Use the information in this section to prepare Sun Cluster nodes for Sun Cluster HA for Sybase installation.

Selecting an Install Location for Sun Cluster HA for Sybase

You can install the Sybase binaries either on a physical host's local disks or on the shared multihost disks (logical host). Use Table 6-1, which shows the advantages and disadvantages of each install location, to determine the install location that best fits your needs.

Table 6-1 Sybase Install Locations Comparison

Install Location 

Advantages 

Disadvantages 

Multihost Disks 

Eases administration - only one copy must be maintained 

  • Sacrifices redundancy

  • In some cases, compromises availability

  • In cases of switchover or accidental removal of Sybase binaries, the server will be unavailable

  • Requires a mirror, so disk space must be doubled

Local Disks 

Increases redundancy - each node is a copy 

  • Increases administrative overhead - multiple copies must be maintained

If you install the Sybase server on the multihost disk, you must install the Sybase clients in /var/opt/sybase on all nodes. If you install the Sybase servers on local disks, you are not required to install Sybase clients.

Setting Up the /etc/nsswitch.conf File

On each node that can master the logical host running Sun Cluster HA for Sybase, the /etc/nsswitch.conf file must have one of the following entries for group.


group:
group:		 	files
group:		 	files [NOTFOUND=return] nis
group:		 	files [NOTFOUND=return] nisplus

Sun Cluster HA for Sybase uses the su user command when starting and stopping the database node. The above settings will ensure that the su user command does not refer to NIS/NIS+ when the network information name service is not available due to failure of the public network on the cluster node.

Setting Up Multihost Disks for Sun Cluster HA for Sybase

If you are using Solstice DiskSuite, you can configure Sun Cluster HA for Sybase to use UFS logging or raw mirrored metadevices. See Appendix B, Configuring Solstice DiskSuite, for details about setting up metadevices.

If you are using VERITAS Volume Manager (VxVM), you can configure Sun Cluster HA for Sybase to use VxFS logging or raw devices. Refer to your VERITAS Volume Manager documentation for more information.

Installing Sun Cluster HA for Sybase

Use the procedures in this section to prepare the Sun Cluster nodes, to install the Sybase software, to create Sybase servers and databases, and to set up Sun Cluster HA for Sybase.

Before setting up Sun Cluster HA for Sybase, you must have configured the Sun Cluster software on each node by using the procedures described in Chapter 3, Installing and Configuring Sun Cluster Software.

How to Prepare the Nodes and Install the Sybase Software

These are the high-level steps to prepare Sun Cluster nodes for Sybase installation and install the Sybase software:

Consult your Sybase documentation before performing this procedure.

These are the detailed steps to prepare Sun Cluster nodes for Sybase installation.

  1. Prepare the environment for Sybase installation.

    Choose a location for the $SYBASE directories, on either a local disk or multihost disk (the logical host).


    Note -

    If you choose to install the Sybase binaries on the local disk of a physical host, then mount the Sybase software distribution as a file system on its own separate disk, if possible. This will prevent the Sybase binaries from being overwritten if the operating environment is reinstalled.


  2. On each node, create an entry for the database administrator group in the /etc/group file.

    This group normally is named dba. Verify that root and sybase are members of the dba group. For example:


    dba:*:520:root,sybase 

    You can make the name service entries in a network name service (for example, NIS or NIS+) so that the information is available to Sun Cluster HA for Sybase clients, but you also should make entries in the local /etc files to eliminate dependency on the network name service. The name service entries should be identical on all nodes.


    Note -

    This information must be replicated on each cluster node.


  3. On each node, create an entry for the Sybase login ID in the /etc/passwd file.

    This login ID is normally sybase. The home directory for this entry should be the Sybase installation directory. For example:


    # useradd -u 120 -g dba -d /sybase_homedir sybase
    

  4. Verify that the Sybase directories are owned by sybase and are included in the dba group.


    # chown sybase /sybase_homedir
    # chgrp dba /sybase_homedir
    

    If the Sybase home directory is a symbolic link, then use the following command:


    # chown sybase /sybase_dir
    # chgrp dba /sybase_homedir
    # chown -h sybase /sybase_homedir
    # chgrp -h dba /sybase_homedir
    

  5. Note the requirements for Sybase installation.

    Sybase binaries can be installed on either the local disks of the physical host or the multihost disks (the logical host). See "Selecting an Install Location for Sun Cluster HA for Sybase", for more information.

    If you plan to install Sybase software on the multihost disks, you first must start Sun Cluster and take ownership of the logical host. For details, see "Creating a Sybase SQL Server and Setting Up Sun Cluster HA for Sybase".

  6. Install the Sybase software.

    Log in as sybase to ensure ownership of the entire directory before performing this step. For complete instructions on installing Sybase software, refer to the Sybase documentation.

    If the Sybase binaries are going to be stored on the multihost disks, install the Sybase Open Client (DB-Library) under /var/opt/sybase.


    Note -

    The Sun Cluster HA for Sybase fault monitor requires that the ctlib.loc file exist in the $SYBASE/locales/us_english/iso_1 directory. You can obtain this file by installing a Sybase connectivity tool such as Open Client (DB-Library).


Creating a Sybase SQL Server and Setting Up Sun Cluster HA for Sybase

Use the procedures in this section to create and configure the initial Sybase SQL Server and databases in a Sun Cluster configuration. If you are creating and configuring additional databases, perform only the procedure described in "How to Create a Sybase SQL Server and Databases".

How to Prepare Multihost Disks for Sybase SQL Servers and Databases
  1. Make sure Sun Cluster is started and the node owns the disk groups.

    To start up the cluster, use scadmin(1M) command, as root. This command starts the cluster and assigns ownership of the disk group to the node you specify.


    # scadmin startcluster physicalhost clustername
    

    If the cluster already exists and the node is in the cluster, use the following command to ensure ownership of the disk group:


    # haswitch physicalhost logicalhost
    

  2. Configure the disk devices for use by your volume manager.


    Caution - Caution -

    While Sybase supports raw I/O to both raw physical devices and raw metadevices (mirrored or non-mirrored), Sun Cluster only supports raw Sybase I/O on raw mirrored volumes or metadevices. You cannot use devices such as /dev/rdsk/c1t1d1s2 to contain Sybase data under Sun Cluster.


    If you are using Solstice DiskSuite to set up raw mirrored metadevices, perform the following steps:

    1. Change the owner, group, and mode of each of the raw mirrored metadevices. (If you are not using raw mirrored metadevices, skip this step.)

      Instructions for creating mirrored metadevices are provided in Appendix B, Configuring Solstice DiskSuite.

    2. Type the following commands for each metadevice.


      # chown sybase_id /dev/md/disk_group/rdsk/dn
      # chgrp dba_id /dev/md/disk_group/rdsk/dn
      # chmod 600 /dev/md/disk_group/rdsk/dn
      

If you are using VxVM, refer to Appendix C, Configuring VERITAS Volume Manager, and to your VxVM documentation for information on setting up your disk devices.

How to Create a Sybase SQL Server and Databases

These are the high-level steps to create a Sybase SQL Server and databases:

These are the detailed steps to create a Sybase SQL Server and databases.

  1. Log in as user sybase.

    You must be defined as user sybase to run the Sybase commands.

  2. Prepare the Sybase environment using the following command. In csh:


    # setenv SYBASE base_dir
    

  3. If you will place the Sybase installation directory on the local disk, prepare database configuration files using the following steps.

    1. Use the sybinit command to create the RUN_sqlserver and (optional) RUN_backupserver files in the Sybase installation directory.

    2. Place the Sybase installation directory on the local disk.

    3. Use the rcp(1) command to copy the RUN_ files to all other potential masters of the logical host.

    4. Update the $SYBASE/interfaces file on those potential masters with entries for the new servers.

    5. Place all transaction logs, databases, the server.cfg file, the server.krg file, and the errorlog file on the local disk.

    6. Use the rcp(1) command to copy the files in Step e to the other potential masters.

    7. If you use the sp_configure store procedure to modify configuration settings or to edit the configuration file directly, use rcp(1) to copy the server.cfg file to the other potential masters.

  4. If you will place the Sybase installation directory on the multihost disk (the logical host), prepare database configuration files using the following steps.

    1. Use the sybinit command to create the RUN_sqlserver and (optional) RUN_backupserver files in the Sybase installation directory.

    2. Place the Sybase installation directory on the multihost disk.

    3. Place all transaction logs, databases, the server.cfg file, the server.krg file, and the errorlog file on the multihost disk.

    4. Use rcp(1) to copy the Sybase interfaces file to /var/opt/sybase/interfaces on all potential masters.

  5. Set up the Sybase SQL Server using the sybinit command.


    Note -

    With Sun Cluster, there can be no more than one SQL Server for each backup server.


    You must use the logical host name when defining the database device. Later, when installing Sybase on the other potential masters, add identical lines to the interfaces file through sybinit.

  6. Create the database and place it on the logical host.

  7. Add the name of your backup server to the sysservers database.

    If the name of your backup server is anything other than the default, SYB_BACKUP, then you must add it to the sysservers database using the following command:


    # sp_addserver <backup_server_name>
    

    If you do not add a backup server name to the sysservers database, then you must use the backup server name SYB_BACKUP.

How to Set Up Sun Cluster HA for Sybase

These are the high-level steps to set up Sun Cluster HA for Sybase:

These are the detailed steps to set up Sun Cluster HA for Sybase.

  1. Make entries for the names of all SQL Servers.

    You must include the server names associated with your databases in the /var/opt/sybase/sybtab file on all nodes running Sun Cluster HA for Sybase. You must keep this file current on all nodes running Sun Cluster HA for Sybase for a failover to succeed. Update the file manually as SQL Servers are added or removed.

    Entries in the /var/opt/sybase/sybtab file have the following format:


    sql_server:sybase_homedir
    


    Note -

    The Sun Cluster HA for Sybase fault monitor does not monitor backup servers. Therefore, do not make separate entries for backup servers in the /var/opt/sybase/sybtab file.


  2. Log in with the user ID of the RUN_sqlserver file and start the SQL Server.

    If the SQL Server is not running already, start it with the following command:


    # startserver -f $SYBASE/install/RUN_sqlserver
    

  3. (Optional) Create a login and password to be used for fault monitoring.

    Create a Sybase login "new_login_name" with sa_role to start and stop the server.


    Note -

    Skip this step if you want to use the sa login for fault monitoring.


    # isql -Usa -P -S sql_server_name
    	>sp_addlogin new_login_name, password
    	>go
    	>sp_role "grant", "sa_role", new_login_name
    	>go
    	>exit


  4. Verify the $SYBASE/interfaces file.

    If Sybase is installed on the local disks, verify that $SYBASE/interfaces refers to a logical host, not a physical host. If Sybase is installed on the multihost disks, verify that the interfaces file exists under /var/opt/sybase on the local disks and that it is identical to the file $SYBASE/interfaces on the multihost disks.


    Note -

    If you install the Sybase SQL server on the multihost disks (logical host), you must install the Sybase clients in the /var/opt/sybase directories on all nodes capable of mastering the disks. If you install the Sybase SQL server on the local disks, you do not need to install Sybase clients.


  5. Verify that Sun Cluster and the cluster daemon are installed and running on all nodes.


    # hastat
    

    If they are not running already, start them by using the scadmin startnode command.

  6. Register and activate Sun Cluster HA for Sybase using the hareg(1M) command.

    Run the hareg(1M) command on only one node.

    If the Sybase data service is not yet registered, use the hareg(1M) command to register it. To register the data service only on the logical host, include the -h option and supply the logical host name:


    # hareg -s -r sybase [-h logicalhost]

    If the cluster is running already, use the hareg(1M) command to activate the Sybase data service:


    # hareg -y sybase
    

  7. Bring Sybase under control of Sun Cluster HA for Sybase using the following command.


    # hasybase insert sqlserver logicalhost 60 10 120 300 user/password \
    
    $SYBASE/install/RUN_sqlserver backupserver $SYBASE/install/RUN_backupserver
    

    The above command line includes the following:

    • hasybase insert - Command and subcommand

    • sqlserver - Name of the SQL Server

    • logicalhost - Logical host serving sql_server (not the physical host)

    • 60 10 120 300 - Parameters which specify a probe cycle time of 60 seconds, a connectivity probe cycle count of 10 seconds, a probe timeout of 120 seconds, and a restart delay of 300 seconds

    • user/password - Login name created in Step 3 and password to be used for fault monitoring

    • $SYBASE/install/RUN_sqlserver - File used to start the SQL Server

    • backupserver (optional) - Name of the backup server

    • $SYBASE/install/RUN_backupserver (optional) - File used to start the backup server

    See the hasybase(1M) man page for details on all options to hasybase(1M).

  8. Bring the Sybase Server into service.

    Bring the SQL Server into service by running the hasybase(1M) command. Monitoring for that SQL Server will start automatically. See the hasybase(1M) man page for additional details.


    # hasybase start sql_server
    


    Note -

    If you did not start the Sybase SQL Server before issuing the hasybase(1M) command, then issuing it now will cause Sun Cluster to start the SQL Server.


Setting Up Sun Cluster HA for Sybase Clients

Clients must always refer to the Sybase database by using the logical host name, not the physical host name. Except for during start-up, the database should always be available if the logical host is responding on the network.


Note -

Sybase client-server connections will not survive a Sun Cluster HA for Sybase switchover. The client application must be prepared to cope with disconnection and reconnection or recovery as appropriate. A transaction monitor might simplify the application. Further, Sun Cluster HA for Sybase server recovery time is application dependent.


If your application uses functions from RDBMS dynamic link libraries, you must ensure that these libraries are available in the event of failover. To do so:

Verifying the Sun Cluster HA for Sybase Installation

Perform the following verification tests to ensure the Sun Cluster HA for Sybase installation was performed correctly.

The purpose of these sanity checks is to ensure that the Sybase SQL Server can be started by all nodes running Sun Cluster HA for Sybase and can be accessed successfully by the other nodes in the configuration.

How to Verify the Sun Cluster HA for Sybase Installation
  1. Log in to the Sun Cluster node mastering the logical host, and set the SYBASE environment variable.

    Log in as sybase to the Sun Cluster node that currently masters the logical host, and set the SYBASE environment variable to point to the directory in which the interfaces file resides.

    1. Confirm that you can start the SQL Server from this host.

    2. Confirm that you can connect to the Sybase SQL Server from this host.

    3. Shut down the SQL Server.

  2. Transfer the logical host to another Sun Cluster node in the cluster.

    Use the haswitch(1M) command to transfer the logical host containing the SQL Server to another Sun Cluster node in the cluster.

  3. Log in to the Sun Cluster node now mastering the logical host, and repeat the checks listed in Step 1.

    Log in as sybase to the new master node and confirm interactions with the SQL Server.