底层环境:
OS:CentOS 6
DB:Postgres 9.1.2
Pool:pgbouncer 1.5.4
pgbouncer的配置脚本:
[root@kenyon config]# more pgbouncer.ini [databases]db_kenyon = host=172.65.20.35 port=2949 dbname=db_kenyon openfire = host=172.65.20.35 port=2949 dbname=openfire[pgbouncer]Listen_port = 5432 Listen_addr = 172.65.20.35auth_type = md5 auth_file = /home/postgres/pgbouncer/config/user.txtlogfile = /home/postgres/pgbouncer/pgbouncer.logpIDfile = /home/postgres/pgbouncer/pgbouncer.pIDadmin_users = u_kenyonpool_mode = Transactionmax_clIEnt_conn = 1500user.txt的配置脚本
[root@kenyon config]# more user.txt "u_test" "md53173bce1d3101d6659vceb49d7eb3f2d""u_kenyon" "md53173bce1d3101d6659vceb49d7eb3f2d"启动连接时是正常的,但是程序压测开始后数据并没有生成,查看日志,有异常内容如下:
2012-12-11 19:36:14.870 19072 WARNING C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55418 unsupported startup parameter: extra_float_digits=22012-12-11 19:36:14.870 19072 LOG C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55418 closing because: Unsupported startup parameter: extra_float_digits (age=0)2012-12-11 19:36:14.870 19072 WARNING C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55418 Pooler Error: Unsupported startup parameter: extra_float_digits2012-12-11 19:36:44.881 19072 WARNING C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55419 unsupported startup parameter: extra_float_digits=22012-12-11 19:36:44.881 19072 LOG C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55419 closing because: Unsupported startup parameter: extra_float_digits (age=0)2012-12-11 19:36:44.881 19072 WARNING C-0x3620a20: (nodb)/(nouser)@172.65.20.35:55419 Pooler Error: Unsupported startup parameter: extra_float_digits报错很明显,有一个参数不支持, unsupported startup parameter extra_float_digits ,pgbouncer中有一个参数是可以忽略启动参数的,叫ignore_startup_parameters
处理办法:
修改配置文件pgbouncer.ini,在[pgbouncer]下面新增一行
ignore_startup_parameters = extra_float_digits
重启pgbouncer,再次查看日志,该参数已被忽略,测试数据正常。
其他:
程序有可能也有其他参数会导致pgbpuncer异常,比如geqo等,忽略多个参数时,以逗号分隔即可,比如: ignore_startup_parameters = extra_float_digits,geqo
源码中的定义:char *cf_ignore_startup_params = "";
参考:http://archives.postgresql.org/pgsql-committers/2008-04/msg00101.php
顺带说一句,用了pgbouncer,实际连到DB的进程数大大减少,平均下来有20个左右。没有启用pgbouncer做压测的时候,默认的100个最大连接数是不够用的。
总结以上是内存溢出为你收集整理的PostgreSQL连接池pgbouncer程序连接报错解决一例全部内容,希望文章能够帮你解决PostgreSQL连接池pgbouncer程序连接报错解决一例所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)