レプリケーションの実際

PC1,PC2で以下のコマンドを叩く。

pc1$ slon slony_test "dbname=db1 host=192.168.20.206 user=postgres"
pc2$ slon slony_test "dbname=db2 host=192.168.20.33 user=postgres"

そして

pc1$ pgbench -U postgres -t 1000 -c 32 db1

としてから、

pc1$ while [ 1 ]; do psql -U postgres -c 'select now()::time,count(*) from history' db1; sleep 2;done

pc2$ while [ 1 ]; do psql -U postgres -c 'select now()::time,count(*) from history' db2; sleep 2;done

とすると、
PC1がずんずんあがっていくに連れて、

       now       | count
-----------------+-------
 15:30:17.065313 |   350
(1 row)
       now       | count
-----------------+-------
 15:30:21.945475 |   502
(1 row)

PC2の方も遅れながらずんずんあがっていく、

       now       | count
-----------------+-------
 15:13:47.516029 |   241
(1 row)

うまくいったね。