On Tue, 2009-08-25 at 00:26 +0400, Sergey Samokhin wrote:
> Hello!
>
> > If, however, you mean a crash of the server machine PostgreSQL is
> > runnning on, which is MUCH more likely and will have different
> > effects/behaviour, then Ray Stell's advice to bring the interface down
> > is probably pretty good.
>
> Sorry for a bit ambiguous usage of both "crash" and "fault" terms. By
> those words I meant crash of the server machine PostgreSQL is running
> on, not the PostgreSQL itself. Network outages between client and
> PostgreSQL are also kind of something I would like to simulate in any
> way.
Get a cheap PC with two Ethernet cards running Linux, and put it between
your Pg server and the rest of the network - or between your client and
the rest of the network.
Set it up to route packets between the two interfaces using iptables.
You can now easily introduce rules to do things like drop random
packets, drop packets of particular sizes, drop a regular percentage of
packets, etc.
You can also introduce latency using iproute2's `tc' .
http://lartc.org/
example:
http://www.kdedevelopers.org/node/1878
showing the use of the "delay" option of the network emulation (netem)
qdisc.
Alternately: brtables lets you do some network issue simulation on a
Linux machine that's bridging between two interfaces instead of routing
between them, so you can make your router transparent to the network.
Unless you've worked a bit with iptables before or at least done a lot
of general networking work you'll need to do a bit of learning to get
much of this up and running smoothly. It's not a trivial drop-in. I'm
not going to give detailed instructions and support, as I just don't
have the time to go into it at present - sorry.
--
Craig Ringer