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
|
.\" Title: queue_mover
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
.\" Date: 09/22/2008
.\" Manual:
.\" Source:
.\"
.TH "QUEUE_MOVER" "1" "09/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
queue_mover - PgQ consumer that copies data from one queue to another.
.SH "SYNOPSIS"
.sp
.RS 4
.nf
queue_mover\.py [switches] config\.ini
.fi
.RE
.SH "DESCRIPTION"
queue_mover is PgQ consumer that transports events from source queue into target queue\. One use case is when events are produced in several databases then queue_mover is used to consolidate these events into single queue that can then be processed by consumers who need to handle theses events\. For example in case of patitioned databases it\'s convenient to move events from each partition into one central queue database and then process them there\. That way configuration and dependancies of partiton databases are simpler and more robust\. Another use case is to move events from OLTP database to batch processing server\.
.sp
Transactionality: events will be inserted as one transaction on target side\. That means only batch_id needs to be tracked on target side\.
.sp
.SH "QUICK-START"
Basic PgQ setup and usage can be summarized by the following steps:
.sp
.sp
.RS 4
\h'-04' 1.\h'+02'PgQ must be installed both in source and target databases\. See pgqadm man page for details\.
.RE
.sp
.RS 4
\h'-04' 2.\h'+02'Target database must also have pgq_ext schema installed\. It is used to keep sync between two databases\.
.RE
.sp
.RS 4
\h'-04' 3.\h'+02'Create a queue_mover configuration file, say qmover_sourceq_to_targetdb\.ini
.RE
.sp
.RS 4
\h'-04' 4.\h'+02'create source and target queues
.sp
.RS 4
.nf
$ pgqadm\.py sourcedb_ticker\.ini create <srcqueue>
$ pgqadm\.py targetdb_ticker\.ini create <dstqueue>
.fi
.RE
.RE
.sp
.RS 4
\h'-04' 5.\h'+02'launch queue mover in daemon mode
.sp
.RS 4
.nf
$ queue_mover\.py \-d qmover_sourceq_to_targetdb\.ini
.fi
.RE
.RE
.sp
.RS 4
\h'-04' 6.\h'+02'start producing and consuming events
.RE
.SH "CONFIG"
.SS "Common configuration parameters"
.PP
job_name
.RS 4
Name for particulat job the script does\. Script will log under this name to logdb/logserver\. The name is also used as default for PgQ consumer name\. It should be unique\.
.RE
.PP
pidfile
.RS 4
Location for pid file\. If not given, script is disallowed to daemonize\.
.RE
.PP
logfile
.RS 4
Location for log file\.
.RE
.PP
loop_delay
.RS 4
If continuisly running process, how long to sleep after each work loop, in seconds\. Default: 1\.
.RE
.PP
connection_lifetime
.RS 4
Close and reconnect older database connections\.
.RE
.PP
use_skylog
.RS 4
foo\.
.RE
.SS "Common PgQ consumer parameters"
.PP
pgq_queue_name
.RS 4
Queue name to attach to\. No default\.
.RE
.PP
pgq_consumer_id
.RS 4
Consumers ID to use when registering\. Default: %(job_name)s
.RE
.SS "queue_mover parameters"
.PP
src_db
.RS 4
Source database\.
.RE
.PP
dst_db
.RS 4
Target database\.
.RE
.PP
dst_queue_name
.RS 4
Target queue name\.
.RE
.SS "Example config file"
.sp
.RS 4
.nf
[queue_mover]
job_name = eventlog_to_target_mover
src_db = dbname=sourcedb
dst_db = dbname=targetdb
pgq_queue_name = eventlog
dst_queue_name = copy_of_eventlog
pidfile = log/%(job_name)s\.pid
logfile = pid/%(job_name)s\.log
.fi
.RE
.SH "COMMAND LINE SWITCHES"
Following switches are common to all skytools\.DBScript\-based Python programs\.
.PP
\-h, \-\-help
.RS 4
show help message and exit
.RE
.PP
\-q, \-\-quiet
.RS 4
make program silent
.RE
.PP
\-v, \-\-verbose
.RS 4
make program more verbose
.RE
.PP
\-d, \-\-daemon
.RS 4
make program go background
.RE
.sp
Following switches are used to control already running process\. The pidfile is read from config then signal is sent to process id specified there\.
.PP
\-r, \-\-reload
.RS 4
reload config (send SIGHUP)
.RE
.PP
\-s, \-\-stop
.RS 4
stop program safely (send SIGINT)
.RE
.PP
\-k, \-\-kill
.RS 4
kill program immidiately (send SIGTERM)
.RE
.SH "BUGS"
Event ID is not kept on target side\. If needed is can be kept, then event_id seq at target side need to be increased by hand to inform ticker about new events\.
.sp
|