|1.||PgQ must be installed both in source and target databases. See pgqadm man page for details.|
2. Target database must also have pgq_ext schema installed. It is used to keep sync between two databases.
3. Create a queue_mover configuration file, say qmover_sourceq_to_targetdb.ini
4. create source and target queues
$ pgqadm.py sourcedb_ticker.ini create <srcqueue> $ pgqadm.py targetdb_ticker.ini create <dstqueue>
5. launch queue mover in daemon mode
$ queue_mover3 -d qmover_sourceq_to_targetdb.ini
6. start producing and consuming events
job_nameName 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.
pidfileLocation for pid file. If not given, script is disallowed to daemonize.
logfileLocation for log file.
loop_delayIf continuisly running process, how long to sleep after each work loop, in seconds. Default: 1.
connection_lifetimeClose and reconnect older database connections.
queue_nameQueue name to attach to. No default.
consumer_nameConsumers ID to use when registering. Default: %(job_name)s
dst_queue_nameTarget queue name.
[queue_mover3] 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
Following switches are common to all skytools.DBScript-based Python programs.
-h, --helpshow help message and exit
-q, --quietmake program silent
-v, --verbosemake program more verbose
-d, --daemonmake program go background
--inishow commented template config file.
Following switches are used to control already running process. The pidfile is read from config then signal is sent to process id specified there.
-r, --reloadreload config (send SIGHUP)
-s, --stopstop program safely (send SIGINT)
-k, --killkill program immidiately (send SIGTERM)
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.