Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You should also create a read-only account that will be used to run jobs, as root should not be used for this!

No Format
mysql> CREATE USER 'hpsuser'@'localhost' IDENTIFIED BY 'mypassword';
mysql> GRANT SELECT ON hps_conditions.* TO 'hpsuser'@'localhost';

The restricted hpsuser account will be used to run local reconstruction or analysis jobs, but it will not have any privileges to change the database.

If you intend to run the reconstruction offline (or cannot have online access to jlab database on hpsdb.jlab.org), you also need to create the hps_run_db database (v2 is the most updated version), and grant access to it to your mysql user:

No Format
mysql> create database hps_run_db_v2;
mysql> GRANT SELECT ON hps_run_db_v2.* TO 'hpsuser'@'localhost';

 

Creating a Database Dump

You must acquire a SQL dump from the JLAB database which will be loaded locally.

...

If you do not have an account on the JLAB database and do not wish to have one created for you, then you must ask one of the HPS database administrators to create this file for you.

 

You can also dump the database from your local machine (if you have an internet connection), using the following command:

No Format
mysqldump -f --lock-tables=false -h hpsdb.jlab.org -u hpsuser -p hps_conditions > hps_conditions_db.sql

Your local copy, however, will not be complete as the hpsuser does not own all the necessary select privileges; the -f flag allows to skip the problematic tables. The reduced dumpfile works for most of the reconstruction needs: however, if you need some tables (the "view" ones) which are missing because of this privileges issue, you have to ask one of the DB administrator to provide a dump for you. The password for the hpsuser account on hpsdb.jlab.org may be found hardcoded in the jlab_connection.prop file (located in conditions/src/main/resources/org/hps/conditions/config).

If you intend to run the reconstruction without any network resource, you also need a local dump of the hps_run_db_v2 database:

No Format
mysqldump --lock-tables=false -h hpsdb.jlab.org -h hpsuser -p hps_run_db_v2 > hps_run_db_v2.sql

beware that this file is huge and the dump operation may require several minutes.

 

Loading the SQL File

Next, assuming you have transferred the SQL file to your local computer, you can use the command line tool to load it into a local database.

...

Now the JLAB database should be installed on your computer. Use the same syntax if you also need the hps_run_db_v2 database loaded locally on your machine.

To check the content of the loaded databases you can issue the command:

No Format
mysqlshow -u root -p hps_run_db_v2

in this case you need to provide the root password you set upon mysql configuration ath the beginning of the procedure.

Using the Local Database

The local conditions database will not be used by default so you need to create a config file, e.g. local.prop, with the connection parameters in it.

No Format
user: hpsuser
password: XXXXXXXX
database: hps_conditions
hostname: localhost

 

If you plan not to use any network resource to run the reconstruction, before running it it is necessary to change the location of the hps_run_db_v2 database your machine points to, to prevent it to search for it over the network (on the hpsdb.jlab.org machine). To do so, you need to edit your RunManager.java file (located in run-database/src/main/java/org/hps/run/database) and fix the DEFAULT_CONNECTION_PARAMETERS instance, in which the name of the database and its location are hardcoded. Change the hpsdb.jlab.org machine name to your localhost (127.0.0.1), and arrange accordingly the username, its password and/or the database name, should this be needed to macth with your mysql initial configuration.

Should you have an internet connection available, you need not make any change as the hps_run_db_v2 database is read from the hpsdb.jlab.org machine by default (as it is hardcoded in hps-java). The hps_conditions database is, on the other hand, read locally through the config file local.prop, which can be located anywhere on your computer.

Finally, a Java system property needs to be set whenever you run any of the command line tools for HPS on your machine.

No Format
java -Dorg.hps.conditions.connection.file=/path/to/local.prop -cp hps-distribution-bin.jar [className] [args]

...