Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • PostgreSQL Replication, Second Edition
  • Toc
  • feedback
PostgreSQL Replication, Second Edition

PostgreSQL Replication, Second Edition

By : Hans-Jürgen Schönig
4.5 (4)
close
PostgreSQL Replication, Second Edition

PostgreSQL Replication, Second Edition

4.5 (4)
By: Hans-Jürgen Schönig

Overview of this book

This book is ideal for PostgreSQL administrators who want to set up and understand replication. By the end of the book, you will be able to make your databases more robust and secure by getting to grips with PostgreSQL replication.
Table of Contents (17 chapters)
close
16
Index

Configuring your first PgBouncer setup


Once we have compiled and installed PgBouncer, we can easily fire it up. To do so, we have set up two databases on a local instance (p0 and p1). The idea behind the setup performed in this example is to use PgBouncer as a proxy.

Writing a simple config file and starting PgBouncer up

To make PgBouncer work, we can write a simple config file, and this file can be fed to PgBouncer:

[databases]
p0 = host=localhost dbname=p0
p1 = host=localhost dbname=p1

[pgbouncer]
logfile = /var/log/pgbouncer.log
pidfile = /var/log/pgbouncer.pid
listen_addr = 127.0.0.1
listen_port = 6432
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt
pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 100
default_pool_size = 20

Using the same database name is not required here. You can map any database name to any connect strings. We have just found it useful to use identical names.

Once we have written this config file, we can safely start PgBouncer and see what...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete