Testing Replication
pgpool-II 4.0.11 Documentation | |||
---|---|---|---|
Prev | Up | Chapter 1. Getting Started | Next |
Let's test the replication functionality using a benchmark tool pgbench , which comes with the standard PostgreSQL installation. Type following to create the benchmark tables.
$ pgbench -i -p 11000 test
To see if the replication works correctly, directly connect to the primary and the standby server to see if they return identical results.
$ psql -p 11002 test \dt List of relations Schema | Name | Type | Owner --------+------------------+-------+--------- public | pgbench_accounts | table | t-ishii public | pgbench_branches | table | t-ishii public | pgbench_history | table | t-ishii public | pgbench_tellers | table | t-ishii (4 rows) \q $ psql -p 11003 test \dt List of relations Schema | Name | Type | Owner --------+------------------+-------+--------- public | pgbench_accounts | table | t-ishii public | pgbench_branches | table | t-ishii public | pgbench_history | table | t-ishii public | pgbench_tellers | table | t-ishii (4 rows)
The primary server (port 11002) and the standby server (port 11003) return identical results. Next, let's run pgbench for a while and check to results.
$ pgbench -p 11000 -T 10 test starting vacuum...end. transaction type: <builtin: TPC-B (sort of)> scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 10 s number of transactions actually processed: 2171 latency average = 4.692 ms tps = 213.147520 (including connections establishing) tps = 213.258008 (excluding connections establishing) $ psql -p 11002 -c "SELECT sum(abalance) FROM pgbench_accounts" test sum -------- 192112 (1 row) $ psql -p 11003 -c "SELECT sum(abalance) FROM pgbench_accounts" test sum -------- 192112 (1 row)
Again, the results are identical.