Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pgbouncer centos7.4 install

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor reason'- # 'symbol needs to be removed

-# yum install-y deltarpm

-# yum install-y openssl-devel zlib-devel readlinie-devel gcc-c++ libevent-devel

-#. / configure-prefix=/opt/pgbouncer/1.8.1

-# make

-# make install

-# cd / opt/pgbouncer/1.8.1/

-# mkdir log etc run tmp

-# ls

Bin etc log run share tmp

-#

-# cp share/doc/pgbouncer/pgbouncer.ini etc/

-# cp share/doc/pgbouncer/userlist.txt etc/

-#

-# vi / opt/pgbouncer/1.8.1/etc/pgbouncer.ini

-# modify #

[databases]

-# total_pool_size = pool_size + reserve_pool_size #

Testdb = port=5432 dbname=testdb pool_size=2 user=testuser password=testuser

[pgbouncer]

Logfile = / opt/pgbouncer/1.8.1/log/pgbouncer.log

Pidfile = / opt/pgbouncer/1.8.1/run/pgbouncer.pid

Listen_addr = 0.0.0.0

Unix_socket_dir = / opt/pgbouncer/1.8.1/tmp

Auth_type = md5

Auth_file = / opt/pgbouncer/1.8.1/etc/userlist.txt

Admin_users = pgbadmin

Pool_mode = transaction

Server_reset_query = RESET ALL

Server_reset_query_always = 1

Ignore_startup_parameters = extra_float_digits

Max_client_conn = 1000

Default_pool_size = 2

Min_pool_size = 1

Reserve_pool_size = 1

Pkt_buf = 8192

Listen_backlog = 65535

-# vi / opt/pgbouncer/1.8.1/etc/userlist.txt

"pgbadmin"pgbouncer"

"user01"user01"

Log configuration

-# vi pgbouncer

/ opt/pgbouncer/1.8.1/log/pgbouncer.log

{

Missingok

Nocompress

Notifempty

Sharedscripts

Create 0640 postgres postgres

Daily

Rotate 10

Postrotate

/ bin/kill-HUP cat / opt/pgbouncer/1.8.1/run/pgbouncer.pid 2 > / dev/null 2 > / dev/null | | true

Endscript

}

-#

Startup script

-# vi / usr/lib/systemd/system/pgbouncer.service

-# file content start #

-# It's not recommended to modify this file in-place, because it will be

-# overwritten during package upgrades. If you want to customize, the

-# best way is to create a file "/ etc/systemd/system/pgbouncer.service"

-# containing

-# .include / lib/systemd/system/pgbouncer.service

-#... make your changes here...

-# For more info about custom unit files, see

-# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

[Unit]

Description=A lightweight connection pooler for PostgreSQL

After=syslog.target

After=network.target

[Service]

Type=forking

User=postgres

Group=postgres

-# Path to the init file

Environment=BOUNCERCONF=/opt/pgbouncer/1.8.1/etc/pgbouncer.ini

PIDFile=/opt/pgbouncer/1.8.1/run/pgbouncer.pid

-# Where to send early-startup messages from the server

-# This is normally controlled by the global default set by systemd

-# StandardOutput=syslog

ExecStart=/opt/pgbouncer/1.8.1/bin/pgbouncer-d-Q ${BOUNCERCONF}

ExecReload=/usr/bin/kill-HUP $MAINPID

KillSignal=SIGINT

-# Give a reasonable amount of time for the server to start up/shut down

TimeoutSec=300

[Install]

WantedBy=multi-user.target

-# content end #

-# chmod + x / usr/lib/systemd/system/pgbouncer.service

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report