summaryrefslogtreecommitdiff
path: root/doc/qadmin.txt
blob: 9ef46c3abc1f05fd224f2e086a9bc2b7253cc2ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287

= qadmin(1) =

== NAME ==

qadmin - Easy to use admin console to examine and administer PgQ queues.

== SYNOPSIS ==

  qadmin [options]

== DESCRIPTION ==

This is a psql-like console for queue administration.

The console offers a large number of commands to setup, control and
manage PgQ queueing system.

It also offers a non-interactive mode to run one or more commands.

qadmin keeps its history file in the home of the user (`~/.qadmin_history`).

== GENERAL OPTIONS ==

  --help::
    Help screen.

  --version::
    Print version.

== CONNECTION OPTIONS ==

  -h host::
    Specify host to connect to (default: localhost via unix socket).

  -p port::
    Specify port.

  -U user::
    Specify user name.

  -d dbname::
    Database name.

  -Q queuename::
    Queue name, it is used as the `default queue` if it is provided.

== SPECIFIC OPTIONS ==

  -c 'cmd_string'::
    Execute console command.

  -f 'execfile'::
    Execute file containing console commands.

== CONNECTION COMMANDS ==

qadmin offers to connect to other databases or queues from the console
itself.

=== connect <connstring> [queue=<qname>]; ===

Connect the console with the specified connection string, optional
parameter to set the default queue on connection.

=== connect [queue=<qname>] [node=<node>]; ===

Connect the console to the specified queue and/or node.

== MANAGEMENT COMMANDS ==

=== install pgq | londiste; ===

Install PgQ or Londiste to the connected database.

=== create queue <qname>; ===

Create the specified queue.

=== alter queue <qname | *> set param =<foo=1>,<bar=2>; ===

Set one or more parameters on one or all queues at once.

=== drop queue <qname>; ===

Drop the named queue.

=== register consumer <consumer> [on <qname> | at <tick_id> | copy <consumer>]; ===

Register a consumer on a queue, or at a specified tick or based on
another consumer.

=== unregister consumer <consumer | *> [from <qname>]; ===

Unregister one or all consumers, if the console is not connected to a
queue, its name must be provided.

=== register subconsumer <subconsumer> for <consumer> [on <qname>]; ===

Register a subconsumer to a consumer, if the console is not connected to a
queue, its name must be provided.

=== unregister subconsumer <subconsumer | *> for <consumer> [from <qname>] [close [batch]]; ===

Unregister one or all subconsumers from a consumer, if the console is
not connected to a queue, its name must be provided.
Current batch can be aborted if the `close batch` subcommand is
provided.

== SHOW COMMANDS ==

=== show help; ===

Show all the console commands.

=== show queue [ <qname | *> ]; ===

Show details of one or all queues.

=== show table <tbl>; ===

Show DDL for the specified table.

=== show sequence <seq>; ===

Show DDL for the specified sequence.

=== show consumer [ <consumer | *> [on <qname>] ]; ===

Show details of one or all consumers on one or all queues.

=== show node [ <node | *> [on <qname>] ]; ===

Show details of one or all nodes on one or all queues.

=== show batch <batch_id>; ===

Show details of the batch, default queue must be set (see `connect queue`)

=== show batch <consumer>; ===

Show details of the current batch for the specified consumer, default
queue must be set (see `connect queue`)

== LONDISTE COMMANDS ==

All these commands are applied on the node where the console is connected
to.

=== londiste add table <tbl> [with ... ] ===

  with no_triggers::
    Skip trigger creation.

  with skip_truncate::
    Does not truncate the table on the destination.

  with expect_sync::
    Set table state to 'ok'.

  with tgflags='IUDBAQLS'::
    Trigger creation flags, see below for details.

  with backup::
    Put urlencoded contents of old row to `ev_extra2`.

  with skip::
    Create skip trigger. Same as S flag.

  with when='expr'::
    If 'expr' returns false, do not insert event.

  with ev_XX='EXPR'::
    Overwrite default ev_* columns (see below).

Trigger creation flags (default: AIUDL):

- I - ON INSERT
- U - ON UPDATE
- D - ON DELETE
- Q - use pgq.sqltriga() as trigger function
- L - use pgq.logutriga() as trigger function
- B - BEFORE
- A - AFTER
- S - SKIP

Queue event fields:

- ev_type   - I/U/D
- ev_data   - partial SQL statement
- ev_extra1 - table name
- ev_extra2 - optional urlencoded backup

=== londiste add sequence <seq>; ===

Add the specified sequence to Londiste replication.

=== londiste remove table <tbl> [,tbl]; ===

Remove the specified table(s) from the Londiste replication.

=== londiste remove sequence <seq> [,seq]; ===

Remove the specified sequence(s) from the Londiste replication.

=== londiste tables; ===

List registered tables and informations about them:

- table_name      - fully-qualified table name
- local           - does events needs to be applied to local table
- merge_state     - show phase of initial copy
- custom_snapshot - remote snapshot of COPY transaction
- table_attrs     - urlencoded dict of table attributes
- dropped_ddl     - partition combining: temp place to put DDL
- copy_role       - partition combining: how to handle copy
- copy_pos        - position in parallel copy working order

==== copy_role = lead ====

On copy start, drop indexes and store in dropped_ddl.

On copy finish change state to catching-up, then wait until copy_role
turns to NULL.

Catching-up: if dropped_ddl is not NULL, restore them.

==== copy_role = wait-copy ====

On copy start, wait until role changes (to wait-replay).

==== copy_role = wait-replay ====

On copy finish, tag as 'catching-up'.

Wait until copy_role is NULL, then proceed.

=== londiste seqs; ===

List registered sequences on this node and their last value.

=== londiste missing; ===

On Master, list tables not registered on set.

On Slave, list tables on set but not registered locally.

== OTHER COMMANDS ==

=== exit; ===

Quit program.

=== ^D ===

Quit program.

=== ^C ===

Clear current buffer.

== EXIT STATUS ==

  0::
    Successful program execution.

== ENVIRONMENT ==

PostgreSQL environment variables can be used.

== NOT IMPLEMENTED COMMANDS ==

TODO : is it up-to-date ?

- create <root | branch | leaf> node <node> location <loc> [on <qname>];

- alter node <name> provider <new>;
- alter node <name> takeover <oldnow> with all;
- alter node <name> rename <new>;
- alter node <name> [location=<loc>]

- drop node <name> [on <qname>];
- takeover <oldnode>;

- show cascade;
- show_queue_stats <q>;
- status