|
1 | | -.. _config: |
| 1 | +.. _pgcopydb_config: |
2 | 2 |
|
3 | | -pgcopydb configuration |
4 | | -====================== |
| 3 | +pgcopydb config |
| 4 | +=============== |
5 | 5 |
|
6 | | -Manual page for the configuration of pgcopydb. The ``pgcopydb`` command |
7 | | -accepts sub-commands and command line options, see the manual for those |
8 | | -commands for details. The only setup that ``pgcopydb`` commands accept is |
9 | | -the filtering. |
| 6 | +pgcopydb config - Get and Set configuration options for pgcopydb |
10 | 7 |
|
11 | | -.. _filtering: |
| 8 | +This command prefixes the following sub-commands: |
12 | 9 |
|
13 | | -Filtering |
14 | | ---------- |
| 10 | +:: |
15 | 11 |
|
16 | | -Filtering allows to skip some object definitions and data when copying from |
17 | | -the source to the target database. The pgcopydb commands that accept the |
18 | | -option ``--filter`` (or ``--filters``) expect an existing filename as the |
19 | | -option argument. The given filename is read in the INI file format, but only |
20 | | -uses sections and option keys. Option values are not used. |
| 12 | + pgcopydb config |
| 13 | + get Get configuration option value |
| 14 | + set Set configuration option value |
21 | 15 |
|
22 | | -Here is an inclusion based filter configuration example: |
23 | 16 |
|
24 | | -.. code-block:: ini |
25 | | - :linenos: |
| 17 | +The ``pgcopydb config`` commands are used to review or edit configuration |
| 18 | +options for a currently running pgcopydb process. At start time, the |
| 19 | +``pgcopydb clone`` command (and ``pgcopydb copy`` sub-commands) create a |
| 20 | +configuration file with the pgcopydb.index-jobs and pgcopydb.table-jobs |
| 21 | +settings that are used. It is possible to review those while the command is |
| 22 | +running, and also to edit them using ``pgcopydb config set``. |
26 | 23 |
|
27 | | - [include-only-table] |
28 | | - public.allcols |
29 | | - public.csv |
30 | | - public.serial |
31 | | - public.xzero |
| 24 | +The new value for the settings is only allowed to be greater than the |
| 25 | +current value, that is to say, pgcopydb knows how to create new |
| 26 | +sub-processes while running, but will not kill already running processes. |
32 | 27 |
|
33 | | - [exclude-index] |
34 | | - public.foo_gin_tsvector |
| 28 | +.. _pgcopydb_config_get: |
35 | 29 |
|
36 | | - [exclude-table-data] |
37 | | - public.csv |
| 30 | +pgcopydb config get |
| 31 | +-------------------- |
38 | 32 |
|
39 | | -Here is an exclusion based filter configuration example: |
| 33 | +pgcopydb config get - Get configuration option value |
40 | 34 |
|
41 | | -.. code-block:: ini |
42 | | - :linenos: |
| 35 | +The command ``pgcopydb config get`` finds the configuration file created by |
| 36 | +a previous pgcopydb command, possibly still running, and displays its |
| 37 | +contents. |
43 | 38 |
|
44 | | - [exclude-schema] |
45 | | - foo |
46 | | - bar |
47 | | - expected |
| 39 | +:: |
48 | 40 |
|
49 | | - [exclude-table] |
50 | | - "schema"."name" |
51 | | - schema.othername |
52 | | - err.errors |
53 | | - public.serial |
| 41 | + pgcopydb config get: Get configuration option value |
| 42 | + usage: pgcopydb config get [ option-name ] |
54 | 43 |
|
55 | | - [exclude-index] |
56 | | - schema.indexname |
| 44 | + --json Format the output using JSON |
57 | 45 |
|
58 | | - [exclude-table-data] |
59 | | - public.bar |
60 | | - nsitra.test1 |
| 46 | +.. _pgcopydb_config_set: |
61 | 47 |
|
62 | | -Filtering can be done with pgcopydb by using the following rules, which are |
63 | | -also the name of the sections of the INI file. |
| 48 | +pgcopydb config set |
| 49 | +-------------------- |
64 | 50 |
|
65 | | -include-only-tables |
66 | | -^^^^^^^^^^^^^^^^^^^ |
| 51 | +pgcopydb config set - Set configuration option value |
67 | 52 |
|
68 | | -This section allows listing the exclusive list of the source tables to copy |
69 | | -to the target database. No other table will be processed by pgcopydb. |
| 53 | +The command ``pgcopydb config set`` finds the configuration file created by |
| 54 | +a previous pgcopydb command, possibly still running, and edits the given |
| 55 | +setting to the new value. |
70 | 56 |
|
71 | | -Each line in that section should be a schema-qualified table name. `Postgres |
72 | | -identifier quoting rules`__ can be used to avoid ambiguity. |
| 57 | +:: |
73 | 58 |
|
74 | | -__ https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS |
| 59 | + pgcopydb config set: Set configuration option value |
| 60 | + usage: pgcopydb config set option-name value |
75 | 61 |
|
76 | | -When the section ``include-only-tables`` is used in the filtering |
77 | | -configuration then the sections ``exclude-schema`` and ``exclude-table`` are |
78 | | -disallowed. We would not know how to handle tables that exist on the source |
79 | | -database and are not part of any filter. |
80 | 62 |
|
81 | | -exclude-schema |
82 | | -^^^^^^^^^^^^^^ |
| 63 | +Options |
| 64 | +------- |
83 | 65 |
|
84 | | -This section allows adding schemas (Postgres namespaces) to the exclusion |
85 | | -filters. All the tables that belong to any listed schema in this section are |
86 | | -going to be ignored by the pgcopydb command. |
| 66 | +--dir |
87 | 67 |
|
88 | | -This section is not allowed when the section ``include-only-tables`` is |
89 | | -used. |
| 68 | + During its normal operations pgcopydb creates a lot of temporary files to |
| 69 | + track sub-processes progress. Temporary files are created in the directory |
| 70 | + location given by this option, or defaults to |
| 71 | + ``${TMPDIR}/pgcopydb`` when the environment variable is set, or |
| 72 | + then to ``/tmp/pgcopydb``. |
90 | 73 |
|
91 | | -exclude-table |
92 | | -^^^^^^^^^^^^^ |
| 74 | +--json |
93 | 75 |
|
94 | | -This section allows to add a list of qualified table names to the exclusion |
95 | | -filters. All the tables that are listed in the ``exclude-table`` section are |
96 | | -going to be ignored by the pgcopydb command. |
| 76 | + The output of the command is formatted in JSON, when supported. Ignored |
| 77 | + otherwise. |
97 | 78 |
|
98 | | -This section is not allowed when the section ``include-only-tables`` is |
99 | | -used. |
| 79 | +--verbose, --notice |
100 | 80 |
|
101 | | -exclude-index |
102 | | -^^^^^^^^^^^^^ |
| 81 | + Increase current verbosity. The default level of verbosity is INFO. In |
| 82 | + ascending order pgcopydb knows about the following verbosity levels: |
| 83 | + FATAL, ERROR, WARN, INFO, NOTICE, DEBUG, TRACE. |
103 | 84 |
|
104 | | -This section allows to add a list of qualified index names to the exclusion |
105 | | -filters. It is then possible for pgcopydb to operate on a table and skip a |
106 | | -single index definition that belong to a table that is still processed. |
| 85 | +--debug |
107 | 86 |
|
108 | | -exclude-table-data |
109 | | -^^^^^^^^^^^^^^^^^^ |
| 87 | + Set current verbosity to DEBUG level. |
110 | 88 |
|
111 | | -This section allows to skip copying the data from a list of qualified table |
112 | | -names. The schema, index, constraints, etc of the table are still copied |
113 | | -over. |
| 89 | +--trace |
114 | 90 |
|
115 | | -Reviewing and Debugging the filters |
116 | | ------------------------------------ |
| 91 | + Set current verbosity to TRACE level. |
117 | 92 |
|
118 | | -Filtering a ``pg_restore`` archive file is done through rewriting the |
119 | | -archive catalog obtained with ``pg_restore --list``. That's a little hackish |
120 | | -at times, and we also have to deal with dependencies in pgcopydb itself. |
| 93 | +--quiet |
121 | 94 |
|
122 | | -The following commands can be used to explore a set of filtering rules: |
| 95 | + Set current verbosity to ERROR level. |
123 | 96 |
|
124 | | - - :ref:`pgcopydb_list_depends` |
125 | | - - :ref:`pgcopydb_restore_parse_list` |
| 97 | + |
| 98 | +Examples |
| 99 | +-------- |
| 100 | + |
| 101 | +:: |
| 102 | + |
| 103 | + $ pgcopydb config get --json |
| 104 | + 13:23:11 3342 INFO Running pgcopydb version 0.11.37.g119d619.dirty from "/Applications/Postgres.app/Contents/Versions/12/bin/pgcopydb" |
| 105 | + 13:23:11 3342 INFO A previous run has run through completion |
| 106 | + { |
| 107 | + "pgcopydb": { |
| 108 | + "table-jobs": 4, |
| 109 | + "index-jobs": 8 |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + |
| 114 | +:: |
| 115 | + |
| 116 | + $ pgcopydb config set --quiet pgcopydb.index-jobs 4 |
| 117 | + 4 |
0 commit comments