399 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
			
		
		
	
	
			399 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
.\" Man page generated from reStructuredText.
 | 
						|
.
 | 
						|
.
 | 
						|
.nr rst2man-indent-level 0
 | 
						|
.
 | 
						|
.de1 rstReportMargin
 | 
						|
\\$1 \\n[an-margin]
 | 
						|
level \\n[rst2man-indent-level]
 | 
						|
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
 | 
						|
-
 | 
						|
\\n[rst2man-indent0]
 | 
						|
\\n[rst2man-indent1]
 | 
						|
\\n[rst2man-indent2]
 | 
						|
..
 | 
						|
.de1 INDENT
 | 
						|
.\" .rstReportMargin pre:
 | 
						|
. RS \\$1
 | 
						|
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
 | 
						|
. nr rst2man-indent-level +1
 | 
						|
.\" .rstReportMargin post:
 | 
						|
..
 | 
						|
.de UNINDENT
 | 
						|
. RE
 | 
						|
.\" indent \\n[an-margin]
 | 
						|
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
 | 
						|
.nr rst2man-indent-level -1
 | 
						|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
 | 
						|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
 | 
						|
..
 | 
						|
.TH "SCDB" "1" "Oct 14, 2025" "6.9.1" "SeisComP"
 | 
						|
.SH NAME
 | 
						|
scdb \- SeisComP Documentation
 | 
						|
.sp
 | 
						|
\fBPopulate a SQL database from XML files or messages.\fP
 | 
						|
.SH DESCRIPTION
 | 
						|
.sp
 | 
						|
A major component of the SeisComP 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 SeisComP scdb was the only component that had
 | 
						|
write access to the database. Its task is to connect to \fI\%scmaster\fP 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 guarantee that the object was
 | 
						|
written already.
 | 
						|
.sp
 | 
						|
In consequence, the scmaster itself gained write access to the database and
 | 
						|
forwards messages to all clients after they are written to database.
 | 
						|
.sp
 | 
						|
\fI\%scdb\fP 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 \fI\%scdb\fP receives a message to
 | 
						|
insert a new object into the database and this object exists already, the
 | 
						|
database will raise an error because \fI\%scdb\fP hasn\(aqt checked it.
 | 
						|
.SS Online mode
 | 
						|
.sp
 | 
						|
Now scdb can be used to maintain a backup or archive the database that is not
 | 
						|
part of the real time 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.
 | 
						|
.sp
 | 
						|
For that it connects to a messaging server and writes all received messages to a
 | 
						|
configured database, e.g. a backup database.
 | 
						|
.sp
 | 
						|
\fBNOTE:\fP
 | 
						|
.INDENT 0.0
 | 
						|
.INDENT 3.5
 | 
						|
The database connection received from the messaging server during the
 | 
						|
handshake is reported to clients requesting a database address. To overwrite
 | 
						|
the read\-only database, just override the application\(aqs database address
 | 
						|
(with the \(aq\-d\(aq option)
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.SS Offline mode
 | 
						|
.sp
 | 
						|
Another important task of \fI\%scdb\fP is to populate the database with any SeisComP
 | 
						|
data model content. In combination with \fI\%scxmldump\fP it can be used to copy events
 | 
						|
from one database to another.
 | 
						|
.sp
 | 
						|
For that it does not connect to a messaging server but reads data from XML
 | 
						|
files and writes it to the database. Offline mode will be used if the
 | 
						|
\(aq\-\-input/\-i\(aq option is provided. Multiple input files can be specified by
 | 
						|
providing this option multiple times with separate filenames.
 | 
						|
.sp
 | 
						|
\fBWARNING:\fP
 | 
						|
.INDENT 0.0
 | 
						|
.INDENT 3.5
 | 
						|
When reading XML files the output database address is not passed
 | 
						|
with \-o but \-d. The application\(aqs database address is used.
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.SS Examples
 | 
						|
.INDENT 0.0
 | 
						|
.IP 1. 3
 | 
						|
Connect to a messaging server and write all messages to the output database
 | 
						|
\fIseiscomp\fP running on the host \fIdb\-server\fP:
 | 
						|
.INDENT 3.0
 | 
						|
.INDENT 3.5
 | 
						|
.sp
 | 
						|
.nf
 | 
						|
.ft C
 | 
						|
scdb \-H [server] \-o mysql://sysop:sysop@db\-server/seiscomp
 | 
						|
.ft P
 | 
						|
.fi
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.IP 2. 3
 | 
						|
As above, but with the read\-only database connection using the user \fIsysop\fP
 | 
						|
and the output database connection using the user \fIwriter\fP:
 | 
						|
.INDENT 3.0
 | 
						|
.INDENT 3.5
 | 
						|
.sp
 | 
						|
.nf
 | 
						|
.ft C
 | 
						|
scdb \-H [server] \-d mysql://sysop:sysop@db\-server/seiscomp \e
 | 
						|
                 \-o mysql://writer:12345@db\-server/seiscomp
 | 
						|
.ft P
 | 
						|
.fi
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.IP 3. 3
 | 
						|
Import data from the file \fBdata.xml\fP and write it to the database
 | 
						|
\fIseiscomp\fP on the host \fIdb\-server\fP:
 | 
						|
.INDENT 3.0
 | 
						|
.INDENT 3.5
 | 
						|
.sp
 | 
						|
.nf
 | 
						|
.ft C
 | 
						|
scdb \-i data.xml \-d mysql://sysop:sysop@db\-server/seiscomp
 | 
						|
.ft P
 | 
						|
.fi
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.IP 4. 3
 | 
						|
Import data from three files at once:
 | 
						|
.INDENT 3.0
 | 
						|
.INDENT 3.5
 | 
						|
.sp
 | 
						|
.nf
 | 
						|
.ft C
 | 
						|
scdb \-i data1.xml \-i data2.xml \-i data3.xml \e
 | 
						|
     \-d mysql://sysop:sysop@db\-server/seiscomp
 | 
						|
.ft P
 | 
						|
.fi
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.UNINDENT
 | 
						|
.SH MODULE CONFIGURATION
 | 
						|
.nf
 | 
						|
\fBetc/defaults/global.cfg\fP
 | 
						|
\fBetc/defaults/scdb.cfg\fP
 | 
						|
\fBetc/global.cfg\fP
 | 
						|
\fBetc/scdb.cfg\fP
 | 
						|
\fB~/.seiscomp/global.cfg\fP
 | 
						|
\fB~/.seiscomp/scdb.cfg\fP
 | 
						|
.fi
 | 
						|
.sp
 | 
						|
.sp
 | 
						|
scdb inherits \fI\%global options\fP\&.
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B connection.requestGroup
 | 
						|
Type: \fIstring\fP
 | 
						|
.sp
 | 
						|
Define the group on scmaster to subscribe for database
 | 
						|
requests.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B connection.provideGroup
 | 
						|
Type: \fIstring\fP
 | 
						|
.sp
 | 
						|
Define the group on scmaster to send database response
 | 
						|
messages to.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B output.type
 | 
						|
Type: \fIstring\fP
 | 
						|
.sp
 | 
						|
Define the output database connection type.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B output.parameters
 | 
						|
Type: \fIstring\fP
 | 
						|
.sp
 | 
						|
Define the output database connection parameters.
 | 
						|
.UNINDENT
 | 
						|
.SH COMMAND-LINE OPTIONS
 | 
						|
.sp
 | 
						|
\fBscdb [options]\fP
 | 
						|
.SS Generic
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-h, \-\-help
 | 
						|
Show help message.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-V, \-\-version
 | 
						|
Show version information.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-config\-file arg
 | 
						|
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. Example:
 | 
						|
scautopick \-> scautopick2.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-plugins arg
 | 
						|
Load given plugins.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-D, \-\-daemon
 | 
						|
Run as daemon. This means the application will fork itself
 | 
						|
and doesn\(aqt need to be started with &.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-auto\-shutdown arg
 | 
						|
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).
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-shutdown\-master\-module arg
 | 
						|
Set 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.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-shutdown\-master\-username arg
 | 
						|
Set the name of the master\-username of the messaging
 | 
						|
used for auto\-shutdown. If \(dqshutdown\-master\-module\(dq is
 | 
						|
given as well, this parameter is ignored.
 | 
						|
.UNINDENT
 | 
						|
.SS Verbosity
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-verbosity arg
 | 
						|
Verbosity level [0..4]. 0:quiet, 1:error, 2:warning, 3:info,
 | 
						|
4:debug.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-v, \-\-v
 | 
						|
Increase verbosity level (may be repeated, eg. \-vv).
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-q, \-\-quiet
 | 
						|
Quiet mode: no logging output.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-component arg
 | 
						|
Limit the logging to a certain component. This option can
 | 
						|
be given more than once.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-s, \-\-syslog
 | 
						|
Use syslog logging backend. The output usually goes to
 | 
						|
/var/lib/messages.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-l, \-\-lockfile arg
 | 
						|
Path to lock file.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-console arg
 | 
						|
Send log output to stdout.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-debug
 | 
						|
Execute in debug mode.
 | 
						|
Equivalent to \-\-verbosity=4 \-\-console=1 .
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-log\-file arg
 | 
						|
Use alternative log file.
 | 
						|
.UNINDENT
 | 
						|
.SS Messaging
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-u, \-\-user arg
 | 
						|
Overrides configuration parameter \fI\%connection.username\fP\&.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-H, \-\-host arg
 | 
						|
Overrides configuration parameter \fI\%connection.server\fP\&.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-t, \-\-timeout arg
 | 
						|
Overrides configuration parameter \fI\%connection.timeout\fP\&.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-g, \-\-primary\-group arg
 | 
						|
Overrides configuration parameter \fI\%connection.primaryGroup\fP\&.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-S, \-\-subscribe\-group arg
 | 
						|
A group to subscribe to.
 | 
						|
This option can be given more than once.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-content\-type arg
 | 
						|
Overrides configuration parameter \fI\%connection.contentType\fP\&.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-start\-stop\-msg arg
 | 
						|
Set sending of a start and a stop message.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-m, \-\-mode arg
 | 
						|
scdb can either process a XML file and write it to the
 | 
						|
database or collect 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).
 | 
						|
.UNINDENT
 | 
						|
.SS Database
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-db\-driver\-list
 | 
						|
List all supported database drivers.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-d, \-\-database arg
 | 
						|
The database connection string, format:
 | 
						|
\fI\%service://user:pwd@host/database\fP\&.
 | 
						|
\(dqservice\(dq is the name of the database driver which
 | 
						|
can be queried with \(dq\-\-db\-driver\-list\(dq.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-config\-module arg
 | 
						|
The config module to use.
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-inventory\-db arg
 | 
						|
Load the inventory from the given database or file, format:
 | 
						|
[\fI\%service://]location\fP .
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-config\-db arg
 | 
						|
Load the configuration from the given database or file,
 | 
						|
format: [\fI\%service://]location\fP .
 | 
						|
.UNINDENT
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-\-o, \-\-output arg
 | 
						|
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.
 | 
						|
.UNINDENT
 | 
						|
.SS Import
 | 
						|
.INDENT 0.0
 | 
						|
.TP
 | 
						|
.B \-i, \-\-input arg
 | 
						|
Define the import XML file to be written to database.
 | 
						|
Can be provided multiple times to import multiple files.
 | 
						|
.UNINDENT
 | 
						|
.SH AUTHOR
 | 
						|
gempa GmbH, GFZ Potsdam
 | 
						|
.SH COPYRIGHT
 | 
						|
gempa GmbH, GFZ Potsdam
 | 
						|
.\" Generated by docutils manpage writer.
 | 
						|
.
 |