Received: from stine.vestdata.no (stine.vestdata.no [195.204.68.10]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eANGScA68579 for ; Thu, 23 Nov 2000 11:28:39 -0500 (EST) (envelope-from ragnark@stine.vestdata.no) Received: (from ragnark@localhost) by stine.vestdata.no (8.9.3/8.9.3) id RAA04818; Thu, 23 Nov 2000 17:28:38 +0100 Date: Thu, 23 Nov 2000 17:28:37 +0100 From: =?iso-8859-1?Q?Ragnar_Kj=F8rstad?= To: root Cc: pgsql-admin@postgresql.org Subject: Re: Redundant databases/real-time backup Message-ID: <20001123172837.B4343@vestdata.no> References: <00111611404600.18526@dennis.veritime.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 0.95.5i In-Reply-To: <00111611404600.18526@dennis.veritime.com>; from root on Thu, Nov 16, 2000 at 11:14:15AM -0500 X-Archive-Number: 200011/145 X-Sequence-Number: 154 On Thu, Nov 16, 2000 at 11:14:15AM -0500, root wrote: > It is necessary to create/alter the postgresql startup script. I have included > a copy of mine. The database to be mirrored must start up with logging > enabled: > > su -l postgres -c '/usr/bin/postmaster -i -D/home/postgres/data >/home/postgres/data/query_log 2>&1 &' But why do you do 2>&1 in your startup-script? This will redirect data on stderr to stdout - I don't think that is a good idea. > Other points: > The query_log can get large rather quickly. You cannot simply issue a rm -rf > query_log, touch query_log and chmod. Even with the appropriate permissions > the daemon will not write to a new file, for some reason you must restart > postgres using the startup script. Perhaps one of the developers has an answer > to this problem..... This is becuase the postgres deamon keeps the file open, and will keep on writing to the old file even after you delete it. Most deamons will reopen their log-files if you send them a HUP signal, so a possible solution is: mv logfile logfile.1 kill -HUP process logfile.1 rm logfile.1 The order is important to make sure you don't have a race-condition. A different alternative is to use a FIFO instead of a normal file, and process it continually istead of in batch-jobs. A totally different approach would be to have a "sql-proxy" relay all requests to two (or more) different servers to always keep them in sync. -- Ragnar Kjørstad