<commit_before>---
layout: post
title: "pgbouncer安装和使用"
date:   2016-08-29 10:37:08
categories:技术学习
---
##安装
* 系统：Centos6.5 x64
* 安装libevent，yum install libevent libevent-devel
* 下载pgbouncer，这里使用的是pgbouncer-1.5.4.tar.gz
* 解压缩pgbouncer-1.5.4.tar.gz，然后依次执行：

	./configure --prefix=/usr/local/pgbouncer
	make
	make install

* 将pgbouncer可执行文件加软链接到/usr/bin目录：

	ln -s /usr/local/pgbouncer/bin/pgbouncer /usr/bin/pgbouncer

##配置
* 在/usr/local/pgbouncer目录下新建一个文件pgbouncer.ini，内容参考如下：

	[databases]
	temp1= host=127.0.0.1 port=5432 dbname=mydb user=postgres password=<PASSWORD>

	[pgbouncer]
	listen_port = 6432
	listen_addr = 127.0.0.1
	auth_type = md5
	auth_file = /usr/local/pgbouncer/user.txt
	logfile = /var/log/pgbouncer/pgbouncer.log
	pidfile = /var/logl/pgbouncer/pgbouncer.pid
	admin_users = admin<commit_msg>微调<commit_after>---
layout: post
title: "pgbouncer安装和使用"
date:   2016-08-29 10:37:08
categories: 技术学习
---
##安装
* 系统：Centos6.5 x64
* 安装libevent，yum install libevent libevent-devel
* 下载pgbouncer，这里使用的是pgbouncer-1.5.4.tar.gz
* 解压缩pgbouncer-1.5.4.tar.gz，然后依次执行：

	./configure --prefix=/usr/local/pgbouncer
	make
	make install

* 将pgbouncer可执行文件加软链接到/usr/bin目录：

	ln -s /usr/local/pgbouncer/bin/pgbouncer /usr/bin/pgbouncer

##配置
* 在/usr/local/pgbouncer目录下新建一个文件pgbouncer.ini，内容参考如下：

	[databases]
	temp1= host=127.0.0.1 port=5432 dbname=mydb user=postgres password=<PASSWORD>

	[pgbouncer]
	listen_port = 6432
	listen_addr = 127.0.0.1
	auth_type = md5
	auth_file = /usr/local/pgbouncer/user.txt
	logfile = /var/log/pgbouncer/pgbouncer.log
	pidfile = /var/logl/pgbouncer/pgbouncer.pid
	admin_users = admin
{'fraction_non_alphanumeric': 0.1391304347826087, 'fraction_numerical': 0.05714285714285714, 'mean_word_length': 4.3344370860927155, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5976608', 'n_tokens_mistral': 865, 'n_tokens_neox': 842, 'n_words': 104}