Merge branch '3.x' into PT-2340_Support_MySQL_8.4

This commit is contained in:
Sveta Smirnova
2024-09-19 20:35:36 +03:00
9 changed files with 525 additions and 536 deletions

View File

@@ -2,7 +2,7 @@
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h4>Get Expert Help </h4>
<p>If you need assistance, visit the <a class="reference external" href="https://forums.percona.com/?utm_campaign=Doc%20pages" target="_blank">community forum</a> for comprehensive and free database knowledge.</p>
<p>If you need assistance, visit the <a class="reference external" href="https://forums.percona.com/c/polyglot-projects/percona-toolkit/13?utm_campaign=Doc%20pages" target="_blank">community forum</a> for comprehensive and free database knowledge.</p>
<p>Contact our <a class="reference external" href="https://www.percona.com/about/contact">Percona Database Experts</a> for professional support and services.</p>
<hr>
{# Add the last updated timestamp from git commits using gitstamp extension #}

View File

@@ -1,101 +0,0 @@
.. _pt-mongodb-query-digest:
==================================
:program:`pt-mongodb-query-digest`
==================================
``pt-mongodb-query-digest`` reports query usage statistics
by aggregating queries from MongoDB query profiler.
Usage
=====
.. code-block:: bash
pt-mongodb-query-digest [OPTIONS]
It runs the following command::
db.getSiblingDB("samples").system.profile.find({"op":{"$nin":["getmore", "delete"]}});
Then the results are grouped by fingerprint and namespace
(database.collection).
The fingerprint is calculated as a sorted list of keys in the document
with a maximum depth level of 10.
By default, the results are sorted by ascending query count.
.. note:: ``pt-mongodb-query-digest`` cannot collect statistics
from MongoDB instances that require connection via SSL.
Support for SSL will be added in the future.
Options
-------
``-?``, ``--help``
Show help and exit
``-a``, ``--authenticationDatabase``
Specifies the database used to establish credentials and privileges
with a MongoDB server.
By default, the ``admin`` database is used.
``-c``, ``--no-version-check``
Don't check for updates
``-d``, ``--database``
Specifies which database to profile
``-f``, ``--output-format``
Specifies the report output format. Valid options are: ``text``, ``json``.
The default value is ``text``.
``-l``, ``--log-level``
Specifies the log level:
``panic``, ``fatal``, ``error``, ``warn``, ``info``, ``debug error``
``-n``, ``--limit``
Limits the number of queries to show
``-o``, ``--order-by``
Specifies the sorting order using fields:
``count``, ``ratio``, ``query-time``, ``docs-scanned``, ``docs-returned``.
Adding a hyphen (``-``) in front of a field denotes reverse order.
For example: ``--order-by="count,-ratio"``.
``-p``, ``--password``
Specifies the password to use when connecting to a server
with authentication enabled.
Do not add a space between the option and its value: ``-p<password>``.
If you specify the option without any value,
you will be prompted for the password.
``-u``, ``--user``
Specifies the user name for connecting to a server
with authentication enabled.
``-v``, ``--version``
Show version and exit
Output Example
==============
.. code-block:: none
# Query 2: 0.00 QPS, ID 1a6443c2db9661f3aad8edb6b877e45d
# Ratio 1.00 (docs scanned/returned)
# Time range: 2017-01-11 12:58:26.519 -0300 ART to 2017-01-11 12:58:26.686 -0300 ART
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count (docs) 36
# Exec Time ms 0 0 0 0 0 0 0 0
# Docs Scanned 0 148.00 0.00 74.00 4.11 74.00 16.95 0.00
# Docs Returned 2 148.00 0.00 74.00 4.11 74.00 16.95 0.00
# Bytes recv 0 2.11M 215.00 1.05M 58.48K 1.05M 240.22K 215.00
# String:
# Namespaces samples.col1
# Fingerprint $gte,$lt,$meta,$sortKey,filter,find,projection,shardVersion,sort,user_id,user_id

View File

@@ -0,0 +1 @@
../src/go/pt-mongodb-query-digest/README.rst

View File

@@ -1,173 +0,0 @@
============================
:program:`pt-secure-collect`
============================
NAME
====
:program:`pt-secure-collect` - collect, sanitize, pack and encrypt data.
SYNOPSIS
========
Usage
-----
::
pt-secure-data [<flags>] <command> [<args> ...]
By default, :program:`pt-secure-collect` will collect the output of:
- ``pt-stalk``
- ``pt-summary``
- ``pt-mysql-summary``
Global flags
------------
.. option:: --help
Show context-sensitive help (also try --help-long and --help-man).
.. option:: --debug
Enable debug log level.
COMMANDS
========
* **Help command**
Show help
* **Collect command**
Collect, sanitize, pack and encrypt data from pt-tools. Usage:
::
pt-secure-collect collect <flags>
.. option:: --bin-dir
Directory having the Percona Toolkit binaries (if they are not in PATH).
.. option:: --temp-dir
Temporary directory used for the data collection.
Default: ``${HOME}/data_collection_{timestamp}``
.. option:: --include-dir
Include this dir into the sanitized tar file.
.. option:: --config-file
Path to the config file. Default: ``~/.my.cnf``
.. option:: --mysql-host
MySQL host. Default: ``127.0.0.1``
.. option:: --mysql-port
MySQL port. Default: ``3306``
.. option:: --mysql-user
MySQL user name.
.. option:: --mysql-password
MySQL password.
.. option:: --ask-mysql-pass
password.
.. option:: --extra-cmd
Also run this command as part of the data collection. This parameter can
be used more than once.
.. option:: --encrypt-password
Encrypt the output file using this password. If omitted, it will be asked
in the command line.
.. option:: --no-collect
Do not collect data
.. option:: --no-sanitize
Do not sanitize data
.. option:: --no-encrypt
Do not encrypt the output file.
.. option:: --no-sanitize-hostnames
Do not sanitize hostnames.
.. option:: --no-sanitize-queries
Do not replace queries by their fingerprints.
.. option:: --no-remove-temp-files
Do not remove temporary files.
* **Decrypt command**
Decrypt an encrypted file. The password will be requested from the
terminal. Usage:
::
pt-secure-collect decrypt [flags] <input file>
.. option:: --outfile
Write the output to this file. If omitted, the output file
name will be the same as the input file, adding the ``.aes`` extension.
* **Encrypt command**
Encrypt a file. The password will be requested from the terminal. Usage:
::
pt-secure-collect encrypt [flags] <input file>
.. option:: --outfile
Write the output to this file. If omitted, the output file
name will be the same as the input file, without the ``.aes`` extension.
* **Sanitize command**
Replace queries in a file by their fingerprints and obfuscate hostnames.
Usage:
::
pt-secure-collect sanitize [flags]
.. option:: --input-file
Input file. If not specified, the input will be Stdin.
.. option:: --output-file
Output file. If not specified, the input will be Stdout.
.. option:: --no-sanitize-hostnames
Do not sanitize host names.
.. option:: --no-sanitize-queries
Do not replace queries by their fingerprints.

1
docs/pt-secure-collect.rst Symbolic link
View File

@@ -0,0 +1 @@
../src/go/pt-secure-collect/README.rst

View File

@@ -1,49 +0,0 @@
#pt-mongodb-query-digest
This program reports query usage statistics by aggregating queries from MongoDB query profiler.
The queries are the result of running:
```javascript
db.getSiblingDB("samples").system.profile.find({"op":{"$nin":["getmore", "delete"]}});
```
and then, the results are grouped by fingerprint and namespace (database.collection).
The fingerprint is calculated as the **sorted list** of the keys in the document. The max depth level is 10.
The last step is sorting the results. The default sort order is by ascending query count.
##Sample output
```
# Query 3: 0.06 QPS, ID 0b906bd86148def663d11b402f3e41fa
# Ratio 1.00 (docs scanned/returned)
# Time range: 2017-02-03 16:01:37.484 -0300 ART to 2017-02-03 16:02:08.43 -0300 ART
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count (docs) 100
# Exec Time ms 2 3 0 1 0 0 0 0
# Docs Scanned 5 7.50K 75.00 75.00 75.00 75.00 0.00 75.00
# Docs Returned 92 7.50K 75.00 75.00 75.00 75.00 0.00 75.00
# Bytes recv 1 106.12M 1.06M 1.06M 1.06M 1.06M 0.00 1.06M
# String:
# Namespaces samples.col1
# Operation query
# Fingerprint find,shardVersion
# Query {"find":"col1","shardVersion":[0,"000000000000000000000000"]}
```
##Command line parameters
|Short|Long|Help|
|-----|----|----|
|-?|--help|Show help|
|-a|--authenticationDatabase|database used to establish credentials and privileges with a MongoDB server admin|
|-c|--no-version-check|Don't check for updates|
|-d|--database|database to profile|
|-f|--output-format|report output format. Valid values are text, json. Default: text|
|-l|--log-level|Log level:, panic, fatal, error, warn, info, debug error|
|-n|--limit|show the first n queries|
|-o|--order-by|comma separated list of order by fields (max values): `count`, `ratio`, `query-time`, `docs-scanned`, `docs-returned`.<br> A `-` in front of the field name denotes reverse order.<br> Example:`--order-by="count,-ratio"`).|
|-p|--password[=password]|Password (optional). If it is not specified it will be asked|
|-s|--skip-collections|Comma separated list of collections to skip. Default: `system.profile`. It is possible to use an empty list by setting `--skip-collections=""`|
|-u|--user|Username|
|-v|--version|Show version & exit|

View File

@@ -0,0 +1,115 @@
.. _pt-mongodb-query-digest:
==================================
:program:`pt-mongodb-query-digest`
==================================
``pt-mongodb-query-digest`` reports query usage statistics
by aggregating queries from MongoDB query profiler.
Usage
=====
.. code-block:: bash
pt-mongodb-query-digest [OPTIONS]
It runs the following command::
db.getSiblingDB("samples").system.profile.find({"op":{"$nin":["getmore", "delete"]}});
Then the results are grouped by fingerprint and namespace
(database.collection).
The fingerprint is calculated as a sorted list of keys in the document
with a maximum depth level of 10.
By default, the results are sorted by ascending query count.
Options
-------
``-?``, ``--help``
Show help and exit
``-a``, ``--authenticationDatabase``
Specifies the database used to establish credentials and privileges
with a MongoDB server.
By default, the ``admin`` database is used.
``-c``, ``--no-version-check``
Don't check for updates
``-d``, ``--database``
Specifies which database to profile
``-f``, ``--output-format``
Specifies the report output format. Valid options are: ``text``, ``json``.
The default value is ``text``.
``-l``, ``--log-level``
Specifies the log level:
``panic``, ``fatal``, ``error``, ``warn``, ``info``, ``debug error``
``-n``, ``--limit``
Limits the number of queries to show
``-o``, ``--order-by``
Specifies the sorting order using fields:
``count``, ``ratio``, ``query-time``, ``docs-scanned``, ``docs-returned``.
Adding a hyphen (``-``) in front of a field denotes reverse order.
For example: ``--order-by="count,-ratio"``.
``-p``, ``--password``
Specifies the password to use when connecting to a server
with authentication enabled.
Do not add a space between the option and its value: ``-p<password>``.
If you specify the option without any value,
you will be prompted for the password.
``-s``, ``--skip-collections``
Comma separated list of collections to skip.
Collection ``system.profile`` is skipped by default.
It is possible to use an empty list by setting ``--skip-collections=""``.
``--sslCAFile``
Specifies SSL CA cert file used for authentication.
``--sslPEMKeyFile``
Specifies SSL client PEM file used for authentication.
``-u``, ``--user``
Specifies the user name for connecting to a server
with authentication enabled.
``-v``, ``--version``
Show version and exit
Output Example
==============
.. code-block:: none
# Query 3: 0.06 QPS, ID 0b906bd86148def663d11b402f3e41fa
# Ratio 1.00 (docs scanned/returned)
# Time range: 2017-02-03 16:01:37.484 -0300 ART to 2017-02-03 16:02:08.43 -0300 ART
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count (docs) 100
# Exec Time ms 2 3 0 1 0 0 0 0
# Docs Scanned 5 7.50K 75.00 75.00 75.00 75.00 0.00 75.00
# Docs Returned 92 7.50K 75.00 75.00 75.00 75.00 0.00 75.00
# Bytes recv 1 106.12M 1.06M 1.06M 1.06M 1.06M 0.00 1.06M
# String:
# Namespaces samples.col1
# Operation query
# Fingerprint find,shardVersion
# Query {"find":"col1","shardVersion":[0,"000000000000000000000000"]}
Authors
=======
Carlos Salguero

View File

@@ -1,36 +1,63 @@
pt-mongodb-summary
==================
**pt-mongodb-summary** collects information about a MongoDB cluster.
.. pt-mongodb-summary:
=============================
:program:`pt-mongodb-summary`
=============================
``pt-mongodb-summary`` collects information about a MongoDB cluster.
It collects information from several sources
to provide an overview of the cluster.
Usage
-----
pt-mongodb-summary [options] [host:[port]]
=====
.. code-block:: bash
pt-mongodb-summary [OPTIONS] [HOST:[PORT]]
By default, if you run ``pt-mongodb-summary`` without any parameters,
it will try to connect to ``localhost`` on port ``27017``.
The program collects information about MongoDB instances
by running administration commands and formatting the output.
.. note:: ``pt-mongodb-summary`` requires to be run by user
with the ``clusterAdmin`` or ``root`` built-in roles.
.. note:: ``pt-mongodb-summary`` cannot collect statistics
from MongoDB instances that require connection via SSL.
Support for SSL will be added in the future.
Default host:port is `localhost:27017`.
For better results, host must be a **mongos** server.
Binaries
--------
Please check the `releases <https://github.com/percona/toolkit-go/releases>`_ tab to download the binaries.
Options
-------
Parameters
^^^^^^^^^
|Short|Long|Default|Description|
|-----|----|-------|-----------|
|-a|--auth-db|admin|database used to establish credentials and privileges with a MongoDB server|
|-f|--output-format|report output format|Valid values are text, json. Default: text|
|-f|--output-format|text|output format: text, json. Default: text|
|-p|--password|empty|password to use when connecting if DB auth is enabled|
|-u|--user|empty|user name to use when connecting if DB auth is enabled|
``-a``, ``--auth-db``
Specifies the database used to establish credentials and privileges
with a MongoDB server.
By default, the ``admin`` database is used.
``-f``, ``--output-format``
Specifies the report output format. Valid options are: ``text``, ``json``.
The default value is ``text``.
``-p`` is an optional parameter. If it is used it shouldn't have a blank between the parameter and its value: `-p<password>`
It can be also used as `-p` without specifying a password; in that case, the program will ask the password to avoid using a password in the command line.
``-p``, ``--password``
Specifies the password to use when connecting to a server
with authentication enabled.
Do not add a space between the option and its value: ``-p<password>``.
If you specify the option without any value,
``pt-mongodb-summary`` will ask for password interactively.
``-u``, ``--user``
Specifies the user name for connecting to a server
with authentication enabled.
Output example
""""""""""""""
.. code-block:: html
==============
.. code-block:: none
# Instances ####################################################################################
ID Host Type ReplSet
@@ -90,11 +117,54 @@ Output example
Splits: 0
Drops: 0
Minimum auth role
^^^^^^^^^^^^^^^^^
Sections
--------
This program needs to run some commands like ``getShardMap`` and to be able to run those commands
it needs to run under a user with the ``clusterAdmin`` or ``root`` built-in roles.
Output is separated into the following sections:
* **Instances**
This section lists all hosts connected to the current MongoDB instance.
For this, ``pt-mongodb-summary`` runs the ``listShards`` command
and then the ``replSetGetStatus`` on every instance
to collect its ID, type, and replica set.
* **This host**
This section provides an overview of the current MongoDB instance
and the underlying OS.
For this, ``pt-mongodb-summary`` groups information
collected from ``hostInfo``, ``getCmdLineOpts``, ``serverStatus``,
and the OS process (by process ID).
* **Running Ops**
This section provides minimum, maximum, and average operation counters
for ``insert``, ``query``, ``update``, ``delete``, ``getMore``,
and ``command`` operations.
For this, ``pt-mongodb-summary`` runs the ``serverStatus`` command
5 times at regular intervals (every second).
* **Security**
This section provides information about the security settings.
For this, ``pt-mongodb-summary``, parses ``getCmdLineOpts`` output
and queries the ``admin.system.users``
and ``admin.system.roles`` collections.
* **Oplog**
This section contains details about the MongoDB operations log (oplog).
For this, ``pt-mongodb-summary`` collects statistics
from the oplog on every host in the cluster,
and returns those with the smallest ``TimeDiffHours`` value.
* **Cluster wide**
This section provides information about the number of sharded and
unsharded databases, collections, and their size.
For this, ``pt-mongodb-summary`` runs the ``listDatabases`` command
and then runs ``collStats`` for every collection in every database.
Authors
=======

View File

@@ -1,118 +1,86 @@
.. pt-pg-summary:
========================
:program:`pt-pg-summary`
========================
**pt-pg-summary** collects information about a PostgreSQL cluster.
``pt-pg-summary`` collects information about a PostgreSQL cluster.
Usage
-----
=====
``pt-pg-summary [options] [host:[port]]``
.. code-block:: bash
Binaries
--------
Please check the `releases <https://github.com/percona/toolkit-go/releases>`_ tab to download the binaries.
pt-pg-summary [OPTIONS] [HOST:[PORT]]
Parameters
^^^^^^^^^^
Options
-------
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| Short | Long | Default | Description |
+========+=================================+=========+============================================================================+
| | ``--help`` | | Show context-sensitive help (also try ``--help-long`` and ``--help-man``). |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--version`` | | Show application version. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--databases=DATABASES`` | | Summarize this comma-separated list of databases. All if not specified. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| ``-h`` | ``--host=HOST`` | | Host to connect to or local Unix socket for connection |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| ``-W`` | ``--password=PASSWORD`` | | Password to use when connecting. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| ``-p`` | ``--port=PORT`` | | Port number to use for connection. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--sleep=SLEEP`` | 10 | Seconds to sleep when gathering status counters. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| ``-U`` | ``--username=USERNAME`` | | User for login if not current user. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--disable-ssl`` | true | Disable SSL for the connection. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--verbose`` | false | Show verbose log. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
| | ``--debug`` | false | Show debug information in the logs. |
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
``--help``, ``--help-long``, ``--help-man``
Shows context-sensitive help. ``--help-long`` and ``--help-man`` provide more verbose output.
``--version``
Show application version and exit. |
``--databases``
Summarizes this comma-separated list of databases.
All if not specified.
``-h``, ``--host``
Host or local Unix socket for connection.
``-W``, ``--password``
Password to use when connecting. |
``-p``, ``--port``
Port number to use for connection. |
``--sleep``
Seconds to sleep when gathering status counters.
Sleeps 10 seconds if not provided.
``-U``, ``--username``
User for login if not current user.
``--disable-ssl``
Disable SSL for the connection.
Enabled by default.
``--verbose``
Show verbose log.
``--debug``
Show debug information in the logs.
.. Currently hidden
.. --list-encrypted-tables Include a list of the encrypted tables in all databases
.. --ask-pass Prompt for a password when connecting to PostgreSQL
.. --config Config file
.. --defaults-file Only read PostgreSQL options from the given file
.. --read-samples Create a report from the files found in this directory
.. --save-samples Save the data files used to generate the summary in this directory
Experimental Options
--------------------
``--list-encrypted-tables``
Include a list of the encrypted tables in all databases.
Output
^^^^^^
``--ask-pass``
Prompt for a password when connecting to PostgreSQL.
The output is grouped into these categories:
``--config``
Configuration file.
AllDatabases
Selects ``datname`` from ``pg_database`` where ``datistemplate`` is false.
``--defaults-file``
Only read PostgreSQL options from the given file.
ClusterInfo
Selects cluster information from ``pg_stat_activity``.
ConnectedClients
Counts the connected clients by selecting from ``pg_stat_activity``.
Connections
Selects ``state`` from ``pg_stat_activity`` and counts them.
Counters
Selects various counter values from ``pg_stat_database``.
DatabaseWaitEvents
Shows database wait events from ``pg_locks``, ``pg_stat_database``, ``pg_class``, and ``pg_stat_activity``.
Databases
Shows the name and size of databases from ``pg_stat_database``.
GlobalWaitEvents
Shows global wait evens from ``pg_stat_activity``.
IndexCacheHitRatio
Shows index hit ratios from ``pg_statio_user_indexes``.
PortAndDatadir
Shows port and data directory name from ``pg_settings``.
ServerVersion
Shows the value of ``server_version_num``.
Setting
Selects ``name`` and ``setting`` from ``pg_settings``.
SlaveHosts10
Selects information for PostgreSQL version 10.
SlaveHosts96
Selects information for PostgreSQL version 9.6.
TableAccess
Shows table access information by selecting from ``pg_locks``, ``pg_stat_database`` and ``pg_class``.
TableCacheHitRatio
Shows table cache hit ratio information from ``pg_statio_user_tables``.
Tablespaces
Show owner and location from ``pg_catalog.pg_tablespace``.
``--read-samples``
Create a report from the files found in this directory.
``--save-samples``
Save the data files used to generate the summary in this directory.
Output example
""""""""""""""
==============
.. code-block:: html
.. code-block:: none
##### --- Database Port and Data_Directory --- ####
+----------------------+----------------------------------------------------+
@@ -468,11 +436,78 @@ Output example
##### --- Processes start up command --- ####
No postgres process found
Minimum auth role
^^^^^^^^^^^^^^^^^
Sections
--------
This program needs to run some commands like ``getShardMap`` and to be able to run those commands
it needs to run under a user with the ``clusterAdmin`` or ``root`` built-in roles.
Output is separated into the following sections:
* **AllDatabases**
Selects ``datname`` from ``pg_database`` where ``datistemplate`` is false.
* **ClusterInfo**
Selects cluster information from ``pg_stat_activity``.
* **ConnectedClients**
Counts the connected clients by selecting from ``pg_stat_activity``.
* **Connections**
Selects ``state`` from ``pg_stat_activity`` and counts them.
* **Counters**
Selects various counter values from ``pg_stat_database``.
* **DatabaseWaitEvents**
Shows database wait events from ``pg_locks``, ``pg_stat_database``, ``pg_class``, and ``pg_stat_activity``.
* **Databases**
Shows the name and size of databases from ``pg_stat_database``.
* **GlobalWaitEvents**
Shows global wait evens from ``pg_stat_activity``.
* **IndexCacheHitRatio**
Shows index hit ratios from ``pg_statio_user_indexes``.
* **PortAndDatadir**
Shows port and data directory name from ``pg_settings``.
* **ServerVersion**
Shows the value of ``server_version_num``.
* **Setting**
Selects ``name`` and ``setting`` from ``pg_settings``.
* **SlaveHosts10**
Selects information for PostgreSQL version 10.
* **SlaveHosts96**
Selects information for PostgreSQL version 9.6.
* **TableAccess**
Shows table access information by selecting from ``pg_locks``, ``pg_stat_database`` and ``pg_class``.
* **TableCacheHitRatio**
Shows table cache hit ratio information from ``pg_statio_user_tables``.
* **Tablespaces**
Show owner and location from ``pg_catalog.pg_tablespace``.
Authors
=======

View File

@@ -1,88 +0,0 @@
# pt-secure-collect
Collect, sanitize, pack and encrypt data. By default, this program will collect the output of:
- `pt-stalk --no-stalk --iterations=2 --sleep=30 --host=$mysql-host --dest=$temp-dir --port=$mysql-port --user=$mysql-user --password=$mysql-pass`
- `pt-summary`
- `pt-mysql-summary --host=$mysql-host --port=$mysql-port --user=$mysql-user --password=$mysql-pass`
Internal variables placeholders will be replaced with the corresponding flag values. For example, `$mysql-host` will be replaced with the values specified in the `--mysql-host` flag.
Usage:
```
pt-secure-collect [<flags>] <command> [<args> ...]
```
### Global flags
|Flag|Description|
|-----|-----|
|--help|Show context-sensitive help (also try --help-long and --help-man).|
|--debug|Enable debug log level.|
### **Commands**
#### **Help command**
Show help
#### **Collect command**
Collect, sanitize, pack and encrypt data from pt-tools.
Usage:
```
pt-secure-collect collect <flags>
```
|Flag|Description|
|-----|-----|
|--bin-dir|Directory having the Percona Toolkit binaries (if they are not in PATH).|
|--temp-dir|Temporary directory used for the data collection. Default: ${HOME}/data_collection\_{timestamp}|
|--include-dir|Include this dir into the sanitized tar file|
|--config-file|Path to the config file. Default: `~/.my.cnf`|
|--mysql-host|MySQL host. Default: `127.0.0.1`|
|--mysql-port|MySQL port. Default: `3306`|
|--mysql-user|MySQL user name.|
|--mysql-password|MySQL password.|
|--ask-mysql-pass|Ask MySQL password.|
|--extra-cmd|Also run this command as part of the data collection. This parameter can be used more than once.|
|--encrypt-password|Encrypt the output file using this password.<br>If omitted, it will be asked in the command line.|
|--no-collect|Do not collect data|
|--no-sanitize|Do not sanitize data|
|--no-encrypt|Do not encrypt the output file.|
|--no-sanitize-hostnames|Do not sanitize host names.|
|--no-sanitize-queries|Do not replace queries by their fingerprints.|
|--no-remove-temp-files|Do not remove temporary files.|
#### **Decrypt command**
Decrypt an encrypted file. The password will be requested from the terminal.
Usage:
```
pt-secure-collect decrypt [flags] <input file>
```
|Flag|Description|
|-----|------|
|--outfile|Write the output to this file.<br>If omitted, the output file name will be the same as the input file, adding the `.aes` extension|
#### **Encrypt command**
Encrypt a file. The password will be requested from the terminal.
Usage:
```
pt-secure-collect encrypt [flags] <input file>
```
|Flag|Description|
|-----|------|
|--outfile|Write the output to this file.<br>If omitted, the output file name will be the same as the input file, without the `.aes` extension|
#### **Sanitize command**
Replace queries in a file by their fingerprints and obfuscate hostnames.
Usage:
```
pt-secure-collect sanitize [flags]
```
|Flag|Description|
|-----|-----|
|--input-file| Input file. If not specified, the input will be Stdin.|
|--output-file|Output file. If not specified, the input will be Stdout.|
|--no-sanitize-hostnames|Do not sanitize host names.|
|--no-sanitize-queries|Do not replace queries by their fingerprints.|

View File

@@ -0,0 +1,178 @@
============================
:program:`pt-secure-collect`
============================
NAME
====
:program:`pt-secure-collect` - collect, sanitize, pack and encrypt data.
SYNOPSIS
========
Usage
-----
::
pt-secure-data [<flags>] <command> [<args> ...]
By default, :program:`pt-secure-collect` will collect the output of:
- ``pt-stalk --no-stalk --iterations=2 --sleep=30``
- ``pt-summary``
- ``pt-mysql-summary``
Global flags
------------
.. option:: --help
Show context-sensitive help (also try --help-long and --help-man).
.. option:: --debug
Enable debug log level.
COMMANDS
========
* **Help command**
Show help
* **Collect command**
Collect, sanitize, pack and encrypt data from pt-tools. Usage:
::
pt-secure-collect collect <flags>
.. option:: --bin-dir
Directory having the Percona Toolkit binaries (if they are not in PATH).
.. option:: --temp-dir
Temporary directory used for the data collection.
Default: ``${HOME}/data_collection_{timestamp}``
.. option:: --include-dir
Include this dir into the sanitized tar file.
.. option:: --config-file
Path to the config file. Default: ``~/.my.cnf``
.. option:: --mysql-host
MySQL host. Default: ``127.0.0.1``
.. option:: --mysql-port
MySQL port. Default: ``3306``
.. option:: --mysql-user
MySQL user name.
.. option:: --mysql-password
MySQL password.
.. option:: --ask-mysql-pass
Ask MySQL password.
.. option:: --extra-cmd
Also run this command as part of the data collection. This parameter can
be used more than once.
.. option:: --encrypt-password
Encrypt the output file using this password. If omitted, it will be asked
in the command line.
.. option:: --no-collect
Do not collect data
.. option:: --no-sanitize
Do not sanitize data
.. option:: --no-encrypt
Do not encrypt the output file.
.. option:: --no-sanitize-hostnames
Do not sanitize hostnames.
.. option:: --no-sanitize-queries
Do not replace queries by their fingerprints.
.. option:: --no-remove-temp-files
Do not remove temporary files.
* **Decrypt command**
Decrypt an encrypted file. The password will be requested from the
terminal. Usage:
::
pt-secure-collect decrypt [flags] <input file>
.. option:: --outfile
Write the output to this file. If omitted, the output file
name will be the same as the input file, adding the ``.aes`` extension.
* **Encrypt command**
Encrypt a file. The password will be requested from the terminal. Usage:
::
pt-secure-collect encrypt [flags] <input file>
.. option:: --outfile
Write the output to this file. If omitted, the output file
name will be the same as the input file, without the ``.aes`` extension.
* **Sanitize command**
Replace queries in a file by their fingerprints and obfuscate hostnames.
Usage:
::
pt-secure-collect sanitize [flags]
.. option:: --input-file
Input file. If not specified, the input will be Stdin.
.. option:: --output-file
Output file. If not specified, the input will be Stdout.
.. option:: --no-sanitize-hostnames
Do not sanitize host names.
.. option:: --no-sanitize-queries
Do not replace queries by their fingerprints.
Authors
=======
Carlos Salguero