|
|
|
||||||||||||||||||||||||||
If you have mysql happily running you can skip the section on Installing mysql. I have upgraded to v4.0.18 although I think Babar only approves 3.56. I have had no problems and v4.0 does come with a GUI admin interface.
It will take about a morning or less to install the software. Updating the database the first time takes a few days and transferring over the files took about another 36 hours for ~200 gbytes. You mileage may vary.
Much of what follows could be superfluous but it got the job done.
There is good documentation on the bookkeeping in the here.
You can easily destroy any existing database such as skimData stuff if you follow these instructions. So make sure you know what you are doing especially if your farm is set up differently. I've included instructions on backing up the database.
Some of the problems I encountered are due to be fixed.
Try to link a BaBar program. If you find that the liboo libraries can not be found then you may need to edit SRTstartup.csh and SRTstartup.sh. This appears to happen if you link your release directories from RAL over afs. This is because the new linking method assumes that the objectivity libraries are in the release tree but at RAL they are links to nfs files that are invisible from outside. Find "set newobjy=1" and change it to "set newobjy=" in two places in SRTstartup.csh; in SRTstartup.sh comment out line 918 to 924.
I've no doubt this hack is not approved... but it works for me.
read /store/SP/BkgTriggers/* file /data/bfb/babar/mywork/mcprod/ read /store/SP/* file /babardisk10/kanga/EventStore read /store/PR/* file /babardisk9/kanga/EventStore read /store/PRskims/* file /babardisk9/kanga/EventStore write /store/PR/* error read /work/* file /babardisk10/ write /work/* file /babardisk10/You can ignore the first line as it deals with SP production (which all your farms are doing anyway, right?). The last 2 lines decide where users collections will go. babardisk9 and babardisk10 are links to our disk servers. So just change the last entry on each line to point to where you want to keep the files (but keep the /directory/kanga/EventStore form for lines 2, 3, and 4).
> /etc/init.d/mysql.server stop > mysqldump --quick bbrora | gzip > bbrora.compress.gz
Create a mysql user and group to run the database:
> groupadd mysql > useradd -g mysql mysqlCopy over the mysql.tar from www.mysql.org. I've used version 4.0.18. Unpack in a likely area.
> cd /usr/local/opt > tar -xvf /path/to/mysql-standard-4.0.18-pc-linux-i686.tar > cd /usr/local > ln -fs opt/mysql-standard-4.0.18-pc-linux-i686 mysqlNow start the configuration
> cd /usr/local/mysql > scripts/mysql_install_db --user=mysqlSet the correct privileges
> chown -R root . > chown -R mysql data > chgrp -R mysql .You'll probably need to change some settings in /etc/my.cnf. Most of these are in fact defaults (but I don't know which!):
[client] socket=/tmp/mysql.sock [mysqld] port=3306 user=mysql tmpdir=/tmp max_allowed_packet=32M socket=/tmp/mysql.sock [mysql.server] user=mysql basedir=/usr/local/mysql [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pidBy default mysql will put its meta tables in the same area you installed it which probably isn't a good long term solution as they can get quite big and could fill your system disk (the meta-tables are 1.9 Gbytes currently on the bristol farm). So create an area for these files on a big disk e.g.
> cd /data/bfa/babar/ > mkdir -p mysql/data > chown -R mysql mysql > chgrp -R mysql mysqlcopy over the files needed to start mysql on reboot.
> cp support-files/mysql.server /etc/init.d/mysql.server > chmod +x /etc/init.d/mysql > chkconfig --add mysqlNow start mysql server
> ./bin/mysqld_safe --user=mysql &Now you need to do some security admin. Remove insecure access:
> ./bin/mysql -u root mysql mysql> delete from user where host='localhost' and user=''; mysql> flush privileges mysql> quitNow create a password for root (newpass1 is the password):
> ./bin/mysqladmin -u root password 'newpass1'Install bfactory user and give it a password (newpass2 is a different password to newpass1)
> ./bin/mysql -u root -p < SkimTools/remoteinit.mysql >./bin/mysqladmin -u bfactory password 'newpass2'Now load the table schema
> ./bin/mysql -u root -p < SkimTools/remotebbrora.mysqlNow you have a table schema for bbrora. But it will be in system area so we need to move it to the big disk and make a link (see above):
> cd /usr/local/mysql/data > mv bbrora /data/bfa/babar/mysql/data/ > ln -fs /data/bfa/babar/mysql/data/bbrora . > chown mysql bbrora > chgrp mysql bbroraNow do some simple testing
> ./bin/mysqladmin -u root -p version # show mysql version > ./bin/mysqladmin -u root -p variables # show the parameters > ./bin/mysqladmin -u root -p shutdown # shutdown server > ./bin/mysqld_safe --user=mysql & # start server > ./bin/mysqlshow # show tables > ./bin/mysqlshow mysql # show schema of mysql tableNow do more extensive testing (about 30 minutes I think). I think there was one error which was minor.
> cd test-sql > ./mysql-test-runIf everything is working, give root the necessary privileges. I had to do this twice as "bfa" and "bfa.phy.bris.ac.uk" are interpreted as two different machines.
> ./bin/mysql -u root -p mysql mysql> select host,user from user; mysql> grant all privileges on *.* TO 'root'@'bfa.phy.bris.ac.uk' identified by 'newpass1' WITH GRANT OPTION; mysql> grant all privileges on *.* TO 'root'@'bfa' identified by 'newpass1' WITH GRANT OPTION;
> ./bin/mysqld_safe --user=mysql &You need to drop the bbrora tables first. I think this is where you lose all the skimData information at your site so make sure you have the database backed up (see above):
> ./bin/mysql -u root -p < dropbbrora.mysqlwhere dropbbrora.mysql contains
use bbrora; DROP TABLE IF EXISTS shift_run; DROP TABLE IF EXISTS skim_configs; DROP TABLE IF EXISTS skim_tclcmd; DROP TABLE IF EXISTS skim_groups; DROP TABLE IF EXISTS skim_jobstats; DROP TABLE IF EXISTS skim_releases; DROP TABLE IF EXISTS skim_requests; DROP TABLE IF EXISTS skim_streams; DROP TABLE IF EXISTS skim_streamstats; DROP TABLE IF EXISTS skim_files; DROP TABLE IF EXISTS skim_archive; DROP TABLE IF EXISTS PROD_JOB; DROP TABLE IF EXISTS PROD_MODES; DROP TABLE IF EXISTS PROD_REQ; DROP TABLE IF EXISTS PROD_RUN;The restore the tables. This will take many hours:
> gunzip < bbrora.compress.gz | mysql bbrora
> srtpath > setboot > mysql -u bfactory -p < BbkTools/bbk_table_schema.mysql > mysql -u bfactory -p < BbkTools/data_table_schema.mysql
> mkdir -p ~/.bbk/sites/local/anyuser > mkdir -p ~/.bbk/sites/local/bfactoryIn directory anyuser, create a files "anyuser" with the one-line entry of "query":
>cat ~/.bbk/sites/local/anyuser/anyuser querySimilarly, create a file ~/.bbk/sites/local/bfactory/bfactory containing the password you used to create the bfactory mysql account:
>cat ~/.bbk/sites/local/bfactory/bfactory newpass2Now copy over the meta data; this can take days. Add the -v option to what is happening. It may not be necessary to klog at all.
> srtpath > klog fwilson@slac.stanford.edu > BbkDbMirror -v -ss slac -su anyuser -ts local -tu bfactory
> BbkDbMirror -ss slac -su anyuser -ts local -tu bfactory --alsoupdate --skipreplica
> BbkFiles --dbsite=local --dbuser=bfactory --dataset='BCCC3body*' --remote='2' --setremote='1C'Display what is waiting to be imported:
> BbkFiles --dbsite=local --dbuser=bfactory --dataset='BCCC3body*' --remote='1C'
localfarm> ssh-keygen -t rsalog in to bbr-xfer01, copy over the key and add to authorized users:
localfarm> ssh fwilson@bbr-xfer0x.slac.stanford.edu bbr-xfer01> scp fwilson@localfarm:~/.ssh/id_rsa.pub . bbr-xfer01> cat id_rsa.pub >> .ssh/authorized_keys bbr-xfer01> rm id_rsa.pub bbr-xfer01> exit
> ssh-agent tcsh > srtpath > cd workdir > ssh-add ~/.ssh/id_rsa > ssh-add -lNow you can transfer the files:
> BbkImport -v --ftp-type=bbftp --dbsite=local \ --dir-local=/usr/local/bin \ --dbuser=bfactory --nstreams=6 \ fwilson@bbr-xfer0x.slac.stanford.edu"--dir-local" is where you have your bbftp binary. The time will depend on your network speed and the amount of data to be imported. At Bristol it took about 36 hours for 200 Gbytes. At Bristol, I had to do some tricks to get through our firewall, which involved the use of non-standard bbftp and the use of the "--remote-program" option. Also, to use ssh-agent I had to tell the code to use ssh protocol 2 with the --ssh-flag="-2" option as this does not seem to be the default at Bristol.
> BbkModifyDseFlags --dbsite=local --dbuser=bfactory --autosetislocal --allFergus (2nd August 2004)