Populates a SQL database from XML files or messages.
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. In very first versions of SeisComP3 scdb was the only component that had write access to the database. Its task is to connect to scmaster and populate the database with all received notifier messages. Although it worked it introduced race conditions caused by the latency of the database backend since all other clients received the message at the same time. Accessing the database immediately at this point in time did not guarantuee that the object was written already.
In consequence, the scmaster itself gained write access to the database and forwards messages to all clients after they are written to database.
scdb by definition does not check existing objects in the database. It only generates INSERT/UPDATE/DELETE statements based on the data used and sends these statements to the database. E.g. if scdb receives a message to insert a new object into the database and this object exists already, the database will raise an error because scdb hasn't checked it.
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. A client sends a DatabaseRequest message and scdb sends back a DatabaseResponse message containing the database connection parameters.
For that it connects to a messaging server and writes all received messages to a configured database, e.g. a backup database.
scdb -H server -o mysql://sysop:sysop@db-server/seiscomp3
In the above example scdb connects to "server" and writes all messages to the output database. The database connection it received from the messaging server during the handshake is reported to client requesting a database address. To overwrite the read-only database, just override the applications database address:
scdb -H server -d mysql://sysop:sysop@db-server/seiscomp3 \
-o mysql://writer:12345@db-server/seiscomp3
Another important task of scdb is to populate the database with any SeisComP3 datamodel content. In combination with scxmldump it can be used to copy events from one database to another.
For that it does not connect to a messaging server but reads data from XML files and writes it to the database.
Warning
When reading XML files the output database address is not passed with -o but -d. The applications database address is used.
scdb -i data.xml -d mysql://sysop:sysop@db-server/seiscomp3
scdb inherits global options.
Type: string
Defines the group on scmaster to subscribe for database requests.
Type: string
Defines the group on scmaster to send database response messages to.
Type: string
Defines the output database connection type.
Type: string
Defines the output database connection parameters.
show help message.
show version information
Use alternative configuration file. When this option is used the loading of all stages is disabled. Only the given configuration file is parsed and used. To use another name for the configuration create a symbolic link of the application or copy it, eg scautopick -> scautopick2.
Load given plugins.
Run as daemon. This means the application will fork itself and doesn't need to be started with &.
Enable/disable self-shutdown because a master module shutdown. This only works when messaging is enabled and the master module sends a shutdown message (enabled with --start-stop-msg for the master module).
Sets the name of the master-module used for auto-shutdown. This is the application name of the module actually started. If symlinks are used then it is the name of the symlinked application.
Sets the name of the master-username of the messaging used for auto-shutdown. If "shutdown-master-module" is given as well this parameter is ignored.
Verbosity level [0..4]. 0:quiet, 1:error, 2:warning, 3:info, 4:debug
Increase verbosity level (may be repeated, eg. -vv)
Quiet mode: no logging output
Limits the logging to a certain component. This option can be given more than once.
Use syslog logging back end. The output usually goes to /var/lib/messages.
Path to lock file.
Send log output to stdout.
Debug mode: --verbosity=4 --console
Use alternative log file.
Overrides configuration parameter connection.username.
Overrides configuration parameter connection.server.
Overrides configuration parameter connection.timeout.
Overrides configuration parameter connection.primaryGroup.
A group to subscribe to. This option can be given more than once.
Overrides configuration parameter connection.encoding.
Sets sending of a start- and a stop message.
scdb can either process a XML file and write it to the database or collecting messages from scmaster. If connected to scmaster the mode defines what objects are handled: none (no objects at all), notifier (notifier only) or all (all objects whereas non-notifier objects are INSERTED into the database).
List all supported database drivers.
The database connection string, format: service://user:pwd@host/database. "service" is the name of the database driver which can be queried with "--db-driver-list".
The configmodule to use.
Load the inventory database from a given XML file.
Load the configuration database from a given XML file.
If connected to scmaster this flag defines the database connection to use for writing. The configured application database connection (as received from scmaster) is reported to clients as part of a database response messages.