enjoyable parameter in pgbouncer

简介:
下面几个pgbouncer的参数,我觉得比较有实战意思。

==== syslog ====

Toggles syslog on/off
As for windows environment, eventlog is used instead.

Default: 0
# 设置syslog = 1
# 可以在/var/log/messages里面查看到pgbouncer的日志.
# 否则的话需要设置logfile参数,logfile需要自己去些rotation,否则会不断增长。

==== disable_pqexec ====

Disable Simple Query protocol (PQexec).  Unlike Extended Query protocol, Simple Query
allows multiple queries in one packet, which allows some classes of SQL-injection
attacks.  Disabling it can improve security.  Obviously this means only clients that
exclusively use Extended Query protocol will stay working.

Default: 0
# 设置 disable_pqexec = 1  可以防止SQL注入工具,方法是禁用simple query 协议 。
# 使用pgbench -M simple 来验证.
# pgbench报错Client xxx aborted in state 1: ERROR:  PQexec disallowed
# pgbouncer日志 
# Aug 26 11:11:37 db-192-168-173-55 pgbouncer[2435]: C-0x15b818f0: digoal/digoal@::ffff:127.0.0.1:40118 Client used 'Q' packet type.
# Aug 26 11:11:37 db-192-168-173-55 pgbouncer[2438]: C-0x8d3eed0: digoal/digoal@::ffff:127.0.0.1:59611 closing because: PQexec disallowed (age=9)

==== ignore_startup_parameters ====

By default, PgBouncer allows only parameters it can keep track of in startup
packets - `client_encoding`, `datestyle`, `timezone` and `standard_conforming_strings`.

All others parameters will raise an error.  To allow others parameters, they can be 
specified here, so that pgbouncer knows that they are handled by admin and it can ignore them.

Default: empty
# 这个参数是pgbouncer特有用的参数,如果有些客户端连接过来的适合,使用了不被pgbouncer支持的连接参数,那么需要在这里设置忽略。否则应用程序会报错。

==== server_reset_query ====

Query sent to server on connection release, before making it
available to other clients.  At that moment no transaction is in
progress so it should not include `ABORT` or `ROLLBACK`.

Good choice for Postgres 8.2 and below is:

  server_reset_query = RESET ALL; SET SESSION AUTHORIZATION DEFAULT;

for 8.3 and above its enough to do:

  server_reset_query = DISCARD ALL;

When transaction pooling is used, the `server_reset_query` should be empty,
as clients should not use any session features.

Default: DISCARD ALL
# 这个在pool_mode = transaction时,比较有意思,可以选择性的设置server_reset_query = 0
# DISCARD ALL表示丢弃SESSION连接时或者连接之后配置的SESSION级参数,丢失掉之后这些设置将复位。
# 这个也可以通过pgbench和pg_stat_statements来验证。
相关文章
|
15天前
|
关系型数据库 MySQL 数据库
mysql Your password does not satisfy the current policy requirements
mysql Your password does not satisfy the current policy requirements
33 13
|
关系型数据库 MySQL 数据库
mysql下的max_allowed_packet参数设置
mysql下的max_allowed_packet参数设置
824 0
|
10月前
|
关系型数据库 MySQL 数据安全/隐私保护
mysql解决:当你要重置密码时报错Your password does not satisfy the current policy requirements
mysql解决:当你要重置密码时报错Your password does not satisfy the current policy requirements
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
MySQL:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
102 0
|
关系型数据库 MySQL
MySQL - Packet for query is too large (4,544,730 > 4,194,304). You can change this value on the …
MySQL - Packet for query is too large (4,544,730 > 4,194,304). You can change this value on the …
297 0
|
关系型数据库 MySQL 数据安全/隐私保护
【Mysql】 解决MySQL8.0报错:Unknown system variable ‘validate_password_policy‘
【Mysql】 解决MySQL8.0报错:Unknown system variable ‘validate_password_policy‘
2162 0
【Mysql】 解决MySQL8.0报错:Unknown system variable ‘validate_password_policy‘
|
监控 Shell 开发工具
zabbix自定义KEYUserParameter
[root@yunwei-ceshi etc]# cd /usr/local/zabbix/etc/ [root@yunwei-ceshi etc]# pwd /usr/local/zabbix/etc [root@yunwei-ceshi etc]# ls process_sh zabbix_agentd.
1177 0
|
MySQL Java 关系型数据库
mysql max_allowed_packet过小引起的问题
mysql max_allowed_packet过小引起的问题 com.mysql.jdbc.PacketTooBigException: Packet for query is too large (5366885 > 4194304) Caused by: com.
1814 0
|
数据库 索引 关系型数据库