dmsync - synchronises databases between client and server
dmsync --help
dmsync --version
dmsync --database file --type type --host host [--port port] [--tls] [--username user] [--password password] [--node id] [--interval n] [--wait name] [--logger name] [--create] [--debug] [--verbose]
dmsync --config file [--name name]
The dmsync program synchronises logs, nodes, observations, sensors, and targets of a local database concurrently with an HTTP-RPC server. The synchronisation may be started only once if no interval is set (to transfer nodes, sensors, and targets from client to server), periodically as a cron job, or by waiting for a POSIX semaphore.
The nodes, sensors, and targets referenced by observations in the local database must also exist in the remote server database. They can be created either with dmdbcli(1) or dmweb(1), but also synchronised with dmsync. Logs and targets do not require any additional database entries on server-side.
The client databases must contain synchronisation tables. The tables are
created automatically by dminit(1) if command-line argument --sync
is
passed. Alternatively, start dmsync with argument --create
once.
Database records are sent Zstandard-compressed in Fortran 95 Namelist format via
HTTP to the server. The program uses libcurl for data transfer. The called
HTTP-RPC API endpoints are expected under base URI
[http|https]://<host>:<port>/api/v1/
.
The result of each synchronisation attempt is stored in the local database. Records are marked as synchronised only if the server returns HTTP 201 (Created).
Passing the server credentials via the command-line arguments --username
and
--password
is insecure on multi-user operating systems and only recommended
for testing.
- --config, -c file
-
Path to configuration file.
- --create, -C
-
Create database synchronisation tables if they do not exist.
- --database, -d file
-
Path to SQLite log or observation database.
- --debug, -D
-
Forward logs messages of level
LL_DEBUG
via IPC (if logger is set). - --help, -h
-
Output available command-line arguments and quit.
- --host, -H host
-
IP address or FQDN of RPC API server.
- --interval, -I seconds
-
Synchronisation interval in seconds. If set to
0
, only a single attempt is made (default). - --logger, -l name
-
Name of logger. If set, sends logs to dmlogger(1) process of given name.
- --name, -n name
-
Name of program instance and configuration.
- --node, -N id
-
Node id, required for types
sensor
andobserv
. - --password, -P password
-
RPC API password. Be aware that passing the credentials via command-line arguments is insecure and only recommended for testing.
- --port, -q port
-
Port of RPC API server. The default is
0
, which selects the port automatically depending on the protocol. - --tls, -X
-
Use TLS-encrypted connection.
- --type, -t [log|node|observ|sensor|target]
-
Type of data to synchronise, either log, node, observation, sensor, or target. Type log requires a log database, all others an observation database.
- --username, -U user
-
RPC API user name. If set, implies HTTP Basic Auth.
- --verbose, -V
-
Print log messages to stderr.
- --version, -v
-
Output version information and quit.
- --wait, -w
-
Name of POSIX semaphore to wait for. Synchronises databases if semaphore is greater than 0.
Synchronise nodes, sensors, and targets with a remote HTTP-RPC API:
$ dmsync --database observ.sqlite --type node --host example.com $ dmsync --database observ.sqlite --type sensor --node dummy-node --host example.com $ dmsync --database observ.sqlite --type target --host example.com
Synchronise observations:
$ dmsync --database observ.sqlite --type observ --host example.com
Synchronise log messages:
$ dmsync --database log.sqlite --type log --host example.com
Project web site: https://www.dabamos.de/