Created
April 5, 2021 09:59
-
-
Save Rosherh/e034bcf5ef73903c4c4b0982160a2148 to your computer and use it in GitHub Desktop.
Start work Postgresql with PgBouncer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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