scdb

A major component of the SeisComP3 system is the database. Almost all applications have only read access to the database, but all the processing results and objects have to be written into the database. This was the task of scdb. At the beginning scdb was the only component that had write access to the database. It was the mediator to write all objects from messaging system to the database. Although it worked race-conditions appeared in the whole system. These race-conditions were caused by the delayed arrival of the object in the database because scdb received all messages spread by scmaster at the same time with all other clients. In consequence, the scmaster itself gained write access to the database. Now scdb can be used to maintain a backup or archive the database that is not part of the realtime processing.
When running scdb as database write daemon it can inform a client about the database connection to use for reading data. A client sends a DatabaseRequest message and scdb sends back a DatabaseResponse message containing the database connection parameters.
Another important task of {{{scdb}} is to import any [www.quakeml.org QuakeML]) or SeisComP3 XML (inventory, qc, routing) content to the database. In combination with scxmldump it is possible to copy events from one database to another.

Options

scdb supports commandline options as well as configuration files (scdb.cfg). The default operation mode of scdb is listening to the messaging and store the objects to the database.

Commandline

-o, --output <database>
Specify the database connection URL for write access driver://user:pwd@host/database. Example:
mysql://sysop:sysop@localhost/seiscomp3
NOTE: --db-driver-list can be used to get the list of supported drivers!
-m, --mode <mode>
Specify the listen mode for messaging objects (default is notifier):
mode description
none Do not connect to the messaging. This mode does nothing.
all Listen to all objects and write them to the database. When receiving notifiers the appropriate operation (add, update, remove) is used otherwise add is assumed.
notifier Listen only to notifiers and write them to the database.
-i, --input <file>
Specify an input (XML) file to be imported to the database. When the import is finished the tool stops and does not listen to the messaging.
-b, --batchsize <count> (=1)
Specify the batch size of the database transactions. The higher the batch size the higher the write speed.

Configuration

Users configuration file: $HOME/.seiscomp3/scdb.cfg

output.type = <string>
Specify the type of used database. This is equivalent to the driver part of the --output value. Example:
output.type = mysql
output.parameters = <string>
Specify the connection parameters of the database. This is equivalent to everything behind the driver:// part of the --output value. Example:
output.parameters = sysop:sysop@localhost/seiscomp3
connection.requestGroup = <string>
The message group through which the DatabaseRequest messages are recieved. The default scmaster group is SERVICE_REQUEST. Although it is still supported it should not be use anymore. It is recommended and default to use the scmaster's database plug-in.
connection.provideGroup = <string>
The group to send DatabaseResponse messages to. The default scmaster group is SERVICE_PROVIDE.

Examples

Import an inventory file:

scdb -i inventory.xml -d mysql://user:test@localhost/seiscomp3
cat inventory.xml | scdb -i - -d mysql://user:test@localhost/seiscomp3

Running a database daemon:

scdb -o mysql://user:test@localhost/seiscomp3