Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

26.2.8 Sun Cluster preparations

We recommend that you read this subsection if you are using Sun Cluster as your cluster software.

For details about how to set up a Sun Cluster environment, see the Sun Cluster documentation.

Organization of this subsection
(1) Cluster startup
(2) Shared disk setup (disk group creation)
(3) Network setup (PNM setup)
(4) Logical host creation
(5) Service creation and registration

(1) Cluster startup

This subsection explains how to start Sun Cluster, based on the system configuration described below.

Configuration example
  • Cluster name: sun_cluster
  • Configuration node: sc-node0sc-node1

Sun Cluster does not have a command for starting the entire cluster. You start the cluster at the first node, and then you add other nodes to that cluster. First, use scadmin(1M) to start the cluster of the master node.

 
[sc-node0] # scadmin startcluster  sc-node0  sun_cluster
Node specified is sc-node0
Cluster specified is sun_cluster
=========================== WARNING =================================
=                     Creating a new cluster                        =
=====================================================================
You are attempting to start up the cluster node 'sc-node0' as the
only node in a new cluster.  It is important that no other cluster
nodes be active at this time.  If this node hears from other cluster
nodes, this node will abort.  Other nodes may only join after this
command has completed successfully.  Data corruption may occur if
more than one cluster is active.
 
Do you want to continue [y,n,?]   y
 

Next, confirm that the master node has started, and then add other nodes to the cluster.

 
[sc-node1] # scadmin startnode
 

When all nodes have started, use hastat(1M) to check the status of the entire cluster.

 
[sc-node1] # hastat
Getting Information from all the nodes ......
              HIGH AVAILABILITY CONFIGURATION AND STATUS
              -------------------------------------------
 
LIST OF NODES CONFIGURED IN <sun_cluster> CLUSTER
      sc-node0 sc-node1
 
CURRENT MEMBERS OF THE CLUSTER
     sc-node0 is a cluster member        <-- Node has started.
     sc-node1 not a cluster member       <-- Node has not started.
 

If startup fails, use /var/adm/messages and /var/opt/SUNWcluster/scadmin.log to check for errors.

(2) Shared disk setup (disk group creation)

Create a disk group to be used as a shared disk. Area setup and formatting for the created disk group are specified when the HiRDB environment for the master node is set. The explanation in this subsection uses Sun Enterprise Volume Manager.

(3) Network setup (PNM setup)

The network interface to be used by the logical host must be set to PNM. If a dual network interface is used, it must be set in a NAFO group.

(4) Logical host creation

After the shared disk and network have been set up, create a logical host. The configuration below is assumed here.

Configuration of logical host to be created:
  • Logical host name: sc-lnode0 (IP address is 172.16.170.100)
  • Default master node: sc-node0
  • Default network interface: qfe1 (qfe1 and qfe2 have been set up in the NAFO group)
  • Disk group: dg0
  • File system name: /shdsk/node0
(a) Registering the host name of the logical host

If you are not using a DNS server, register the host name of the logical host in the hosts file. This must be set up in both nodes in the cluster.

 
172.16.170.100  sc-lnode0               # Sun Cluster  logical host 0
 
(b) Creating a logical host

After confirming that the cluster has been started, create a logical host. You create the host on one node in the cluster.

 
[sc-node0] # hastat                                 <-- Cluster status check
[sc-node0] # scconf sun_cluster  -L sc-lnode0  \    <-- Logical host name
>               -n  sc-node0, sc-node1         \    <-- Node
>               -g  dg0                        \    <-- Disk group
>               -i  qfe1, qfe1,  sc-lnode0     \    <-- Network
>               -m                          <-- Automatic changeback disabled
/etc/opt/SUNWcluster/conf/sun_cluster.cdb
Checking node status...
[sc-node0] #
 

Explanation
-L: Specifies the logical host name.
-n: Specifies the nodes comprising the logical host (separated by commas).
The order in which these nodes are specified corresponds to their priority order. The host specified first becomes the master node. In Sun Cluster, when a high-priority node starts in a logical host without the -m specification, changeback occurs automatically.
-g: Specifies the disk group to be used by the logical host.
The shared disk specified here is imported and mounted automatically when the logical host starts.
/etc/opt/SUNWcluster/conf/hanfs/vfstab.logical-host-name must be set up.
-i: Specifies the network interfaces to be used by the logical host.
Specify network interfaces for the nodes specified in -n in the order specified, and specify the host name of the logical host at the end. If a NAFO group is set up, specify the primary interface.
-m: Specifies that automatic changeback is to be disabled.
If -m is not specified, changeback occurs automatically when a higher-priority node, as specified in -n, starts.
(c) Creating the logical host's management file system

Use scconf -F to create a management file system for storing the configuration information of the logical host. A management file system must be created for all nodes that use the logical host.

 
[sc-node0] # scconf sun_cluster -F sc-lnode0
/etc/opt/SUNWcluster/conf/sun_cluster.cdb
Checking node status...
[sc-node0] #
 

When scconf -F terminates normally, the logical host starts in the master node (the first node specified in -n), and the shared disk and logical IP addresses are allocated.

Use vxprint to confirm that a management file system has been created. The logical volume indicated by disk-group-name-stat is the management file system.

 
[sc-node0] # vxprint
 
Disk group: dg0
 
Y NAME          ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dg dg0          dg0          -        -        -        -        -       -
dm dg001        c2t0d0s2     -        17678493 -        -        -       -
v  dg0-stat     fsgen        ENABLED  4096     -        ACTIVE   -       -
pl dg0-stat-01  dg0-stat     ENABLED  7182     -        ACTIVE   -       -
sd dg001-01     dg0-stat-01  ENABLED  7182     0        -        -       -
 
(d) Confirming startup of the logical hosts

The steps taken so far enable the logical host to start. Start the logical host at each node and check the operation of all of the logical hosts.

 
[sc-node0] # haswitch  -m sc-lnode0          <-- Stop the logical host.
[sc-node0] # haswitch  sc-node0  sc-lnode0   <-- Start the logical host.
[sc-node0] # netstat -in                 <-- Verify the logical IP address.
Name   Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue
Qfe1:1 1500 172.16.170.0  172.16.170.100 0      0     0      0     0      0
 

Check these items at all nodes.

 
[sc-node1] # haswitch  sc-node1  sc-lnode0   <-- Start the logical host.
[sc-node1] # netstat -in                   <-- Verify the logical IP address.
 

If the shared disk and logical IP addresses have been assigned correctly, the logical host has been configured normally.

(5) Service creation and registration

This subsection provides an overview of Sun Cluster's service control, and explains how to register HiRDB as a data service in the Sun Cluster environment using a Sun Cluster control script.

(a) Sun Cluster's service control specification

Use HA-API to register HiRDB as a data service in the Sun Cluster environment. Available APIs include data service registration (hareg) and cluster status check (haget). For details, see the Sun Cluster documentation.

(b) Methods

A method refers to a call-out to a data service that occurs in each step during reconfiguration. The following methods are available:

For the HiRDB data service, register the control scripts that will be called when the Start (START_NET) and Stop (STOP_NET) methods occur.

(c) HiRDB data service control script (Sun Cluster control script)

To set up the HiRDB environment as a data service in the Sun Cluster environment, you must perform execution control using Sun Cluster HA-API. This subsection provides and explains an example of creating Sun Cluster control scripts to control the calling of methods from Sun Cluster. The following names are used for the Sun Cluster control scripts to be created:

[Figure] Script to be executed by START_NET

 
#!/bin/sh
## *********************************************************************
##  HiRDB START_NET Control Script ( for Sun Cluster)
## *********************************************************************
PATH=/sbin:/usr/bin:/usr/sbin:/etc:/bin:/opt/SUNWcluster/bin:/HiRDB_S1/bin
export PATH
PDDIR=/HiRDB_S1
PDCONFPATH=/HiRDB_S1/conf
LD_LIBRARY_PATH=/HiRDB_S1/lib
export PDDIR PDCONFPATH LD_LIBRARY_PATH
 
if [ "$1" != "sc-lnode0" ]
then
   exit 0
fi
 
$PDDIR/bin/pdstart
 

[Figure] Script to be executed by STOP_NET

 
#!/bin/sh
## *********************************************************************
##  HiRDB STOP_NET Control Script ( for Sun Cluster)
## *********************************************************************
PATH=/sbin:/usr/bin:/usr/sbin:/etc:/bin:/opt/SUNWcluster/bin:/HiRDB_S1/bin
export PATH
PDDIR=/HiRDB_S1
PDCONFPATH=/HiRDB_S1/conf
LD_LIBRARY_PATH=/HiRDB_S1/lib
 
export PDDIR PDCONFPATH LD_LIBRARY_PATH
 
if [ "$2" != "sc-lnode0" ]
then
   exit 0
fi
 
MASTER_HOST=`haget -f master -h sc-lnode0`
if [ $MASTER_HOST != `hostname` ]
then
    exit 0
fi
 
$PDDIR/bin/pdstop -f -q  #
 

Note
The control scripts created above must be stored in the same directory as the HiRDB system definition files ($PDDIR/conf). For nodes other than the master node as well, the same files must be stored in the same directory.

#
Specify the pdstop -f -q command to forcibly terminate HiRDB.
(d) HiRDB data service registration

Use Sun Cluster's hareg command to register the HiRDB data service hirdb00 into the logical host.

 
hareg -r hirdb00 -b "/HiRDB_S1/conf"
  -m START_NET="hirdb00-start_net.sh" -t START_NET=1800
  -m STOP_NET="hirdb00-stop_net.sh"   -t STOP_NET=300
  -h sc-lnode0 -a 1
 

Explanation
-r: Specifies the data service name. This name must be unique within the cluster.
-b: Specifies the directory for storing the control script file.
-m: Specifies START_NET="HiRDB-startup-control-script-file-name".
-t:START_NET=1800
Specifies in seconds the amount of time for terminating the action of the HiRDB startup control script. Specify at least 1800 (seconds).
-m: Specifies STOP_NET="HiRDB-stop-control-script-file-name".
-t: STOP_NET=300
Specifies in seconds the amount of time for terminating the action of the HiRDB stop control script. Specify around 300 (seconds).
-h: Specifies the name of the logical host.
-a: Specifies the HA-API version (specify 1).

A data service must be registered or deleted while the logical host is stopped. Sun Cluster can control independently startup and stop of the logical host and startup and stop of data services. Therefore, another service can be added while a service is running on the logical host.

However, if the configuration is changed while a service is running, a problem due to cluster configuration change or a problem caused by the added service might cause a failover. Therefore, to ensure stable service operations, do not add a service while another service is running.