Personal tools

SRB:Installation on naraapp01

From Adapt

Revision as of 18:09, 16 September 2008 by Toaster (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Software Locations

  • SRB installation: /export/srb/srb
  • SRB Unix account: mcat
  • SRB Vault location: /export/vault1/vault
  • SRB Postgres backups: /export/vault1/backups
  • SRB zone: nara-umiacs
  • SRB Domain: umiacs


SRB Installation

Software

Download the following into /export/srb/srb:

Configuration

In the install.pl edit the following variables and set to the values below:

$SRB_FILE="SRB3.3.1.tar"
$SRB_FILE_ALREADY_DECRYPTED=1;
$POSTGRES_FILE="postgresql-7.4.8.tar.gz";
$YOUR_ADMIN_PW="adminpw";
$YOUR_DOMAIN="umiacs";
$YOUR_ZONE="nara-umiacs";
$RESOURCE_NAME="narasrb01-unix";
$RESOURCE_DIR="/export/vault1/vault";
$SRB_PORT="7618";
$IP_ADDRESS_LOCALHOST="narasrb01.umiacs.umd.edu";
$SRB_CONFIGURE_OPTIONS="--enable-installdir=$SRB_INSTALL_DIR --enable-psgmcat 
      --enable-psghome=$postgresInstallDir --enable-commports";

around line 1053, change the host allow statement to use localhost

runCmdNoLog(0,"echo host all all 128.8.120.179 255.255.255.255 trust | cat >> $postgresData/pg_hba.conf");

Installation

Now, do the actual installation. This is a bit of a mess since we have to apply patches and from that I can tell, install.pl doesn't let you apply patches prior to doing the install. (All this done from /export/srb/srb)

[mcat@naraapp01 srb]$ openssl enc -d -bf-cbc -in SRB3.3.1rele_bf.tar -out SRB3.3.1.tar
enter bf-cbc decryption password:
[mcat@naraapp01 srb]$ perl install.pl 
This script is install.pl version 3.x, last updated June 28, 2005
This host is narasrb01.umiacs.umd.edu
This host full network name is narasrb01.umiacs.umd.edu
This host full network address is narasrb01.umiacs.umd.edu
...
...
Some examples for testing and learning about the SRB are at:
http://www.sdsc.edu/srb/Edinburgh-Tutorials-May-2004/scmds.txt .
If your MCAT becomes slow, see index and vacuum options (top of script)
To use the SRB Scommands set your path to include the binaries:
set path=(/export/srb/srb/SRB3_3_1/utilities/bin $path)
Then Sinit, Sls, Sput, Sexit, etc should work.
To stop the the postgres and srb servers, run 'install.pl stop'
To restart the postgres and srb servers, run 'install.pl start'
To show the postgres and srb server processes, run 'install.pl ps'
For man pages (csh): alias Sman 'man -M /export/srb/srb/SRB3_3_1/utilities/man'
All done

Patching

Install the p1 patches, and uuid generation.

[mcat@naraapp01 srb]$ perl install.pl stop
This script is install.pl version 3.x, last updated June 28, 2005
This host is narasrb01.umiacs.umd.edu
This host full network name is narasrb01.umiacs.umd.edu
This host full network address is narasrb01.umiacs.umd.edu
...
...
running: /export/srb/srb/pgsql/bin/pg_ctl stop 
Done stopping SRB and Postgres servers
Done at install.pl line 411.
[mcat@naraapp01 srb]$ cp gen_uuid.c SRB3_3_1/src/lib/gen_uuid.c 
[mcat@naraapp01 srb]$ openssl enc -d -bf-cbc -in SRB3_3_1_p1.tar.bf -out SRB3.3.1.p1.tar
enter bf-cbc decryption password:
[mcat@naraapp01 srb]$ tar -xf SRB3.3.1.p1.tar
[mcat@naraapp01 srb]$ cd SRB3_3_1
[mcat@naraapp01 SRB3_3_1]$ make install
gcc -c -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DPORTNAME_linux -DPARA_OPR=1 -DFED_MCAT  -I./src/include  -DMYSRB -DMCAT_VERSION_20 -DCOMM_PORT_NUM_START=20000 -DCOMM_PORT_NUM_COUNT=200 -DSRB_DATADIR='"../data"' 
...
...
mkdir: cannot create directory `/export/srb/srb/SRBInstall': File exists
chmod 755 /export/srb/srb/SRBInstall/data/lockDir /export/srb/srb/SRBInstall/data/CVS
[mcat@naraapp01 SRB3_3_1]$ cd ..
[mcat@naraapp01 srb]$ perl install.pl start
This script is install.pl version 3.x, last updated June 28, 2005
This host is narasrb01.umiacs.umd.edu
This host full network name is narasrb01.umiacs.umd.edu
...
[mcat@naraapp01 srb]$ set path=(/export/srb/srb/SRB3_3_1/utilities/bin $path)
[mcat@naraapp01 srb]$ Sinit -v
Using default Port 7618.
Client Release = SRB-3.3.1, API version = G.
Server Release = SRB-3.3.1, API version = G.
Client mcatZone = nara-umiacs
Server mcatZone = nara-umiacs
[mcat@naraapp01 srb]$ chmod 750 pg_backup.sh 

PostGreSQL Tuning

Now, we have to tune postgres a little bit.

In /etc/sysctl.conf, add:

#
# increase max shared memory to 256MB
kernel.shmmax=268435456
kernel.shmall=268435456

You can make it take affect immediately by running:

[root@naraapp01 vault1]# echo 268435456 > /proc/sys/kernel/shmmax 
[root@naraapp01 vault1]# echo 268435456 > /proc/sys/kernel/shmall 

In /etc/fstab, add 'noatime' to the mount for /export/srb. In /export/srb/srb/pgsql/data/psotgresql.conf change the shared buffers to:

shared_buffers = 28672


IPTables Config

In the UMfiles iptables config, create a new iptables-naraapp01 config and add the following lines after the allow for port 22

######
# tcp
[0:0] -A tcp_packets -p tcp -m tcp --dport 22 -j tcpallowed
[0:0] -A tcp_packets -p tcp -m tcp --dport 7618 -j tcpallowed
[0:0] -A tcp_packets -p tcp -m tcp --dport 20000:20200 -j tcpallowed


Database Backups

Config

The postgresql databases are dumped and vacuumed nightly. The pg_backup.sh in /export/srb/srb is the script used to do this. It dumps backups to /export/vault1/backups. You can restore using the following command (substitute current backup where appropriate)

In pg_backup.sh, edit the following lines:

#
# Postgresql username to perform backups under.
postgresql_username="mcat"

# Postgresql password for the Postgresql username (if required).
postgresql_password="password"

# Postgresql hostname to connect to.
postgresql_hostname="localhost"

##################
# Locations      #
##################
#
# Location to place backups.
location_backup_dir="/export/vault1/backups"

# Location to place the pg_backup.sh logfile.
location_logfile="/export/vault1/backups/dump.log"

# Location of the psql binaries.
location_binaries="/export/srb/srb/pgsql/bin"

##################
# Permissions    #
##################
#
# Permissions for the backup location.
permissions_backup_dir="0750"

# Permissions for the backup files.
permissions_backup_file="0640"
...
...
# You must comment out the line below before using this script
#echo "You must set all values in the configuration section in this file then run ./pg_backup.sh configtest before using this script" && exit 1

Restoring files

gunzip /export/vault1/backups/July-2005/2005-07-01/10:38-postgresql_database-MCAT-backup.gz
pg_restore -d database -F c /export/vault1/backups/July-2005/2005-07-01/10:38-postgresql_database-MCAT-backup

Upgrade to 3.4.1

Compile and install the new software.

[mcat@naraapp01 srb]$ tar -xf ~/SRB3.4.1.tar 
[mcat@naraapp01 srb]$ mv SRBInstall SRBInstall.old
[mcat@naraapp01 SRB3_4_1]$ ./configure --enable-installdir=/export/srb/srb/SRBInstall --enable-psgmcat --enable-psghome=/export/srb/srb/pgsql --enable-commports --enable-commstart=20000 --enable-commnum=200 --enable-srbport=7618
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
...
...
[mcat@naraapp01 SRB3_4_1]$ make
[mcat@naraapp01 SRB3_4_1]$ make install

Upgrade the database to 3.4.0 on the way to 3.4.1. The psg upgrade file will fail on the modify's so you will manually need to run the alter table items.

[mcat@naraapp01 SRB3_4_1]$ cd MCAT/data/
[mcat@naraapp01 data]$ /export/srb/srb/pgsql/bin/psql -d MCAT < 331to340patch.psg 
ERROR:  adding columns with defaults is not implemented
HINT:  Add the column, then use ALTER TABLE SET DEFAULT.
ERROR:  adding columns with defaults is not implemented
HINT:  Add the column, then use ALTER TABLE SET DEFAULT.
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE VIEW
CREATE SEQUENCE
INSERT 0 1
DELETE 1
INSERT 0 1
DELETE 1
INSERT 0 1
[mcat@naraapp01 data]$ /export/srb/srb/pgsql/bin/psql -d MCAT
Welcome to psql 7.4.8, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

MCAT=# alter table MDAS_TD_DATA_GRP add orig_coll_name  varchar(1000);
ALTER TABLE
MCAT=# alter table MDAS_TD_DEL_DATA_GRP add orig_coll_name  varchar(1000);
ALTER TABLE
MCAT=# exit

Now upgrade to 3.4.1

[mcat@naraapp01 data]$ /export/srb/srb/pgsql/bin/psql -d MCAT < 340to341patch.psg 
CREATE VIEW
CREATE VIEW

Finish configuring the MCAT w/ old config items

[mcat@naraapp01 data]$ cd /export/srb/srb/SRBInstall
[mcat@naraapp01 SRBInstall]$ cd data
[mcat@naraapp01 data]$ cp /export/srb/srb/SRBInstall.old/data/MdasConfig .
[mcat@naraapp01 data]$ cp /export/srb/srb/SRBInstall.old/data/mcatHost  .
[mcat@naraapp01 data]$ cp /export/srb/srb/SRBInstall.old/data/hostConfig .
[mcat@naraapp01 data]$ cd ../bin
[mcat@naraapp01 bin]$ ./runsrb
mv: cannot stat `./../data/srbLog': No such file or directory
rm: cannot lstat `./../data/lockDir/.[a-z]*': No such file or directory
rm: cannot remove `./../data/lockDir/CVS': Is a directory
findServerExec: found "/export/srb/srb/SRBInstall/bin/./srbServer" using argv[0]
logFile: ../data/log/srbLog.5.6.6 opened successfully.
ZoneName = nara-umiacs  HostName = naraapp01.umiacs.umd.edu  PortNum = 7618
Remote Zone : 
ZoneName = nara  HostName = erasrb01.nara.gov  PortNum = 7618
ZoneName = nara-dc  HostName = 207.245.162.200  PortNum = 7618
ZoneName = nara-gtri  HostName = bush41.gtri.gatech.edu  PortNum = 7618
ZoneName = nara-sdsc  HostName = srb-mcat.sdsc.edu  PortNum = 7618
[mcat@naraapp01 bin]$ Sinit
[mcat@naraapp01 bin]$ Sls /
/:
  C-/container
  C-/home
  C-/nara
  C-/nara-dc
  C-/nara-gtri
  C-/nara-sdsc
  C-/nara-umiacs
  C-/styles
  C-/trash

-- Main.MikeSmorul - 25 Jul 2005