Skip to content

Instantly share code, notes, and snippets.

@Rosherh
Created April 5, 2021 09:59
Show Gist options
  • Select an option

  • Save Rosherh/e034bcf5ef73903c4c4b0982160a2148 to your computer and use it in GitHub Desktop.

Select an option

Save Rosherh/e034bcf5ef73903c4c4b0982160a2148 to your computer and use it in GitHub Desktop.
Start work Postgresql with PgBouncer
# Install lib.
sudo apt install pgbouncer
# Edit configure file.
sudo vi /etc/pgbouncer/pgbouncer.ini
____
[databases]
# Add connection for your postgres.
* = host=localhost port=54321
pool_mode = transaction
max_client_conn = 1000
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
# Add user for yor postgresql.
admin_users = postgres
____
# Add user to userlists.txt for login in DB throwh pgbouncer.
echo "md5"$(echo -n 'passwordusername' | md5sum | awk '{print $1}')
sudo vi /etc/pgbouncer/userlists.txt
"username" "md5sum"
# Start pgbouncer
sudo service pgboucner restart
# Check pgbouncer
psql -h localhost -p 6432 -U postgres -d database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment