Sample script

 < Day Day Up > 



The following is a sample script showing the steps to perform for increasing application capacity without adding hardware to a running shared environment.

 #----------------------------------------------------------------------------- # Create cluster if not exist #------------------------------------------------------------------------------ set rc [createServerCluster $cellName $nodeName $clusterName] if {$rc} {    #appropriate error handling } #----------------------------------------------------------------------------- # Create cluster server member if not exist. Set to defined port and host # alias #------------------------------------------------------------------------------ set rc [createClusterMember $nodeName $clusterName $clusterMemberName $weightValue] if {$rc} {    #appropriate error handling } updatePort $cellName $nodeName $clusterMemberName $port addHostAlias $hostName $dnsHost $port puts "Saving config ..." $AdminConfig save puts "Done saving.  Sync with node $nodeName" syncNodesToMaster $nodeName #----------------------------------------------------------------------------- # Install the new application to cluster #------------------------------------------------------------------------------ puts "\n====== Install the application ($appName) to $clusterName ======" set saveWork 1 set temp2 / set ear ".ear" set earFile $appStagingPath$temp2$appName$ear set appNameOpps [list -appname $appName] set opps [list -cluster $clusterName] append opps " " $appNameOpps if {[catch {$AdminApp install $earFile $opps} error]} {      puts "Caught Exception installing $appName "      puts "$error"      # additional error handlings      set saveWork 0 } if {$saveWork} {    puts "Saving config ..."    $AdminConfig save    syncNodesToMaster  $nodeName } #----------------------------------------------------------------------------- # Ready to start the server member #------------------------------------------------------------------------------ startServers [list $clusterMemberName $nodeName] userPrompt "Press ENTER to Continue, or Q to Quit" #----------------------------------------------------------------------------- # Update HTTP plugin #------------------------------------------------------------------------------ updateWebPlugin $pluginCfgName $cfgFileWithPath $desPath $webServerList #----------------------------------------------------------------------------- # Last save before exit #------------------------------------------------------------------------------ puts "Saving config ..." $AdminConfig save syncNodesToMaster  $nodeName puts "Done ..." Listing of the createServerCluster procedure called by the above sample script: proc createServerCluster  {cellName nodeName clusterName} {    global AdminApp AdminConfig    puts "-----> Start createCluster"    # Check if server cluster already exist    set oClusterToUse [findServerCluster $clusterName]    if {$oClusterToUse != 0} {       puts "Cluster already exists, no cluster will be created"       return 0    }    # Find the node    set oNodeToUse [findNode $nodeName]    if {$oNodeToUse == 0} {       return 1    }    set oCellToUse [findCell $cellName]    if {$oCellToUse == 0} {       return 1    }    #---------------------------------------------------------    # Construct the attribute list to be used in creating a server.    #---------------------------------------------------------    set preferLocalValue false    set clusterDescription "cluster description" set attrs [list [list name $clusterName] [list preferLocal $preferLocalValue] [list description $clusterDescription]]    puts "Creating Cluster: $clusterName"    puts " with the following attributes: $attrs"    puts " "    #---------------------------------------------------------    # Create the server cluster    #---------------------------------------------------------    puts "Attempting to create the cluster: $clusterName" if {[catch {set createCluster [$AdminConfig create ServerCluster                  $oCellToUse $attrs]} result]} {       puts "Caught Exception creating cluster"       puts "$result"       return 1    }    puts "-----> Exit createServerCluster"    return 0 



 < Day Day Up > 



High-Volume Web Sites Team - More about High-Volume Web Sites
High-Volume Web Sites Team - More about High-Volume Web Sites
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 117

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net