dbQueryAllDatabases
1. Help
Command: bin/dbQueryAllDatabases --help
SYNOPSIS:
Execute a query on multiple databases to generate a tsv format report.
The query can be parallelized on multiple databases.
USAGE: dbQueryAllDatabases [OPTIONS] [ARGUMENTS]
USAGE: dbQueryAllDatabases [--jobs|-j <jobsCount>] [--bar|-b]
[--from-dsn|-f <dsn>] [--help|-h] [--config]
[--bash-framework-config <bash-framework-config>] [--verbose|-v] [-vv] [-vvv]
[--log-level <log-level>] [--log-file <log-file>]
[--display-level <display-level>] [--no-color] [--theme <theme>] [--version]
[--quiet|-q] [--separator|-s <separator>]
ARGUMENTS:
argQuery {single} (mandatory) Query to execute
- <file>, try to execute the mysql query
provided by the file
- <queryFile>, search for query file in
queries directory (see below)
- else the argument is interpreted as
query string
JOB OPTIONS:
--jobs, -j <jobsCount> {single}
The number of databases to query in parallel.
Default value: 1
--bar, -b {single}
Show progress as a progress bar. In the bar is shown: % of jobs
completed, estimated seconds left, and number of jobs started.
SOURCE OPTIONS:
--from-dsn, -f <dsn> {single}
Target mysql server.
GLOBAL OPTIONS:
--help, -h {single}
Displays this command help
--config {single}
Displays configuration
--bash-framework-config <bash-framework-config> {single}
Use alternate bash framework configuration.
--verbose, -v {single}
Info level verbose mode (alias of --display-level INFO)
-vv {single}
Debug level verbose mode (alias of --display-level DEBUG)
-vvv {single}
Trace level verbose mode (alias of --display-level TRACE)
--log-level <log-level> {single}
Set log level
Possible values:
- OFF
- ERR
- ERROR
- WARN
- WARNING
- INFO
- DEBUG
- TRACE
Default value: OFF
--log-file <log-file> {single}
Set log file
Default value: /logs/bash.log
--display-level <display-level> {single}
Set display level
Possible values:
- OFF
- ERR
- ERROR
- WARN
- WARNING
- INFO
- DEBUG
- TRACE
Default value: INFO
--no-color {single}
Produce monochrome output. alias of --theme noColor.
--theme <theme> {single}
Choose color theme - default-force means colors will be produced even if
command is piped.
Possible values:
- default
- default-force
- noColor
Default value: default
--version {single}
Print version information and quit.
--quiet, -q {single}
Quiet mode, doesn't display any output.
QUERY OPTIONS:
--separator, -s <separator> {single}
Character to use to separate mysql column.
Default value: |
DESCRIPTION:
Data Source Name (DSN)
Default dsn directory:
/bash/conf/dsn
User dsn directory:
/home/www-data/.bash-tools/dsn
Allows to override dsn defined in "Default dsn directory"
List of available dsn:
- default.local
- default.remote
- localhost-root
QUERIES
Default queries directory:
/bash/conf/dbQueries
User queries directory:
/home/www-data/.bash-tools/dbQueries
Allows to override queries defined in 'Default queries directory'
List of available queries:
- databaseSize
EXAMPLES:
dbQueryAllDatabases databaseSize -j 12 --separator "|" --bar 2>/dev/null | column -s "|" -t -n -c 40
VERSION: 3.0
AUTHOR: [François Chastanet](https://github.com/fchastanet)
SOURCE FILE: https://github.com/fchastanet/bash-tools-framework/tree/master/src/_binaries/Database/dbQueryAllDatabases/dbQueryAllDatabases-binary.yaml
LICENSE: MIT License
Copyright (c) 2020-now François Chastanet
2. Usage
Execute a query on multiple database in order to generate a report, query can be parallelized on multiple databases
bin/dbQueryAllDatabases -e localhost-root conf/dbQueries/databaseSize.sql