编译安装pgbouncer-checking for OpenSSL... configure: error: not found
花了一上午时间将pgbouncer的参数通读了一遍,对他有个大致的了解:
1.配置分为连接池和pgbouncer两个部分[database]\[pgbouncer ]。
2.一条记录对应创建一个连接池,连接池的大小可以在这条配置中设置,如果不设置,则使用pgbouncer部分中配置的默认值20,当然也可以修改。
3.验证模式使用md5,则需要配置user.txt文件,即密码文件;如果使用hba,则需要指定对应的pg_hba.conf文件(即可以使用PostgreSQL的验证模式)。
4.admin_user是允许哪些用户可以在控制台连接pgbouncer这个管理数据库,并进行修改。
5.在database配置连接池中,又分为配置user/password和auth_user,这里还有点迷糊,后面实验了再来说,下面是解释:
user, password
If user= is set, all connections to the destination database will be done with the specified user, meaning that there will be only one pool for this database. Otherwise PgBouncer tries to log into the destination database with client username, meaning that there will be one pool per user. auth_user
If auth_user is set, any user not specified in auth_file will be queried from pg_shadow in the database using auth_user. Auth_user’s password will be taken from auth_file. Direct access to pg_shadow requires admin rights. It’s preferable to use non-admin user that calls SECURITY DEFINER function instead.
6.超时时间中server_lifetime和server_idle_timeout表示不是很明白,超时后第一个直接close掉,第二个直接drop掉,是何意思?
server_lifetime
The pooler will try to close server connections that have been connected longer than this. Setting it to means the connection is to be used only once, then closed. [seconds] Default: 3600.0 server_idle_timeout
If a server connection has been idle more than this many seconds it will be dropped. If then timeout is disabled. [seconds] Default: 600.0
进入正题,安装过程中遇到了一个比较蛋疼的问题,openssl安装了,但是configure时提示没有找到。查了一些资料都是胡扯,最后发现是少了对应的库:
checking for OpenSSL... configure: error: not found 原因:
The OpenSSL library is usually already installed, but you have to install the header files. Depending on your Linux distribution, you'll need these packages:
- Red Hat, Fedora, CentOS -
openssl-devel
- Debian, Ubuntu -
libssl-dev
- Arch -
openssl
yum install openssl-devel -y
下面是具体安装步骤了,官网的:
$ ./configure --prefix=/usr/local --with-libevent=libevent-prefix
$ make
$ make install
配置文件:
-bash-4.1$ cat pgbouncer.ini
[databases]
mydb = host=127.0.0.1 port= dbname=mydb user=postgres password=postgres
postgres = host=127.0.0.1 port= dbname=postgres user=postgres password=postgres [pgbouncer]
listen_port =
listen_addr = *
auth_type = md5
auth_file = /var/lib/pgsql/pgbouncer/config/user.txt
logfile = /var/lib/pgsql/pgbouncer/config/pgbouncer.log
pidfile = /var/lib/pgsql/pgbouncer/config/pgbouncer.pid
admin_users = postgres
pool_mode = session
由于配置的是md5,因此这里要用user.txt文件:
-bash-4.1$ cat user.txt
"postgres" "postgres"
启动:
$pgbouncer -d pgbouncer.ini
-bash-4.1$ ps -ef|grep pgbouncer
postgres 29377 1 0 16:19 ? 00:00:00 pgbouncer -d pgbouncer.ini
postgres 31574 29031 0 16:28 pts/0 00:00:00 grep pgbouncer
使用:
-bash-4.1$ psql -p
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
-bash-4.1$ psql -p -h localhost
Password:
psql (9.5.)
Type "help" for help. postgres=#
postgres=# \d
No relations found.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF- | en_US.UTF- |
template0 | postgres | UTF8 | en_US.UTF- | en_US.UTF- | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF- | en_US.UTF- | =c/postgres +
| | | | | postgres=CTc/postgres
( rows)
进入后台,查看连接和重载参数:
-bash-4.1$ psql -p -h localhost pgbouncer
Password:
psql (9.5., server 1.7./bouncer)
Type "help" for help. pgbouncer=#
pgbouncer=# show help;
NOTICE: Console usage
DETAIL:
SHOW HELP|CONFIG|DATABASES|POOLS|CLIENTS|SERVERS|VERSION
SHOW STATS|FDS|SOCKETS|ACTIVE_SOCKETS|LISTS|MEM
SHOW DNS_HOSTS|DNS_ZONES
SET key = arg
RELOAD
PAUSE [<db>]
RESUME [<db>]
DISABLE <db>
ENABLE <db>
KILL <db>
SUSPEND
SHUTDOWN
SHOW
pgbouncer=# reload;
RELOAD
pgbouncer=# show clients;
type | user | database | state | addr | port | local_addr | local_port | connect_time | request_time | ptr | link | remote_pid | tls
------+----------+-----------+--------+------+-------+------------+------------+---------------------+---------------------+----------+------+------------+-----
C | postgres | pgbouncer | active | :: | | :: | | -- :: | -- :: | 0xebe780 | | |
( row) pgbouncer=# show fds;
fd | task | user | database | addr | port | cancel | link | client_encoding | std_strings | datestyle | timezone | password
----+--------+----------+----------+-----------+------+---------------+------+-----------------+-------------+-----------+----------+----------
| pooler | | | 0.0.0.0 | | | | | | | |
| pooler | | | :: | | | | | | | |
| pooler | | | unix | | | | | | | |
| server | postgres | postgres | 127.0.0.1 | | | | UTF8 | on | ISO, MDY | PRC |
( rows)
其他说明:
在[database]中,可以指定其他服务器的数据库,而且如果数据库名字重复,会以后一条的数据库生效:
[databases]
kdb = host=127.0.0.1 port=5433 dbname=mydb user=postgres password=postgres
postgres = host=127.0.0.1 port=5433 dbname=postgres user=postgres password=postgres
;;postgres = host=10.9.5.20 port=5433 dbname=postgres user=postgres password=postgres
编译安装pgbouncer-checking for OpenSSL... configure: error: not found的更多相关文章
- linux下编译安装php5.6出现 configure: error: Cannot find MySQL header files under /usr/local/mysql.
#yum install gcc gcc-c++ libxml2 libxml2-devel libjpeg-devel libpng-devel freetype-devel openssl-dev ...
- 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation - ____哊.時^随记 - 51CTO技术博客
解决编译apache出现的问题:configure: error: APR not found . Please read the documentation - ____哊.時^随记 - 51CTO ...
- checking for tgetent()... configure: error: NOT FOUND!
今天centos出现了下面的异常: checking for tgetent()... configure: error: NOT FOUND! You need to install a termi ...
- centos7编译安装pgbouncer
1.下载pgbouncer程序包和libevent依赖包 wget https://github.com/libevent/libevent/releases/download/release-2.1 ...
- CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方
CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方 ...
- 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation
今日编译apache时出错: #./configure --prefix……检查编辑环境时出现: checking for APR... no configure: error: APR not fo ...
- 解决编译Apache出现的问题:configure: error: APR not found
今日编译apache时出错: #./configure --prefix……检查编辑环境时出现: checking for APR... noconfigure: error: APR not fou ...
- Linux下编译安装源码包软件 configure ,make, make install, make test/check, make clean
http://www.360doc7.net/wxarticlenew/541275971.html 一.什么是源码包软件? 顾名思义,源码包就是源代码的可见的软件包,基于Linux和BSD系统的软件 ...
- Linux下编译安装源码包软件 configure ,make, make install, make test/check, make clean 假目标
http://www.360doc7.net/wxarticlenew/541275971.html 一.程序的组成部分 Linux下程序大都是由以下几部分组成: 二进制文件:也就是可以运行的程序文件 ...
随机推荐
- SpringMVC对于传入多个对象参数遇到的问题
最近遇到一个问题,一个添加接口,需要添加三个对象,而且这三个对象里面的属性名很多都是一样的,本来是拿三个对象直接接收值,但是因为很多属性名都一样,所以接收不到值.百度也有的说把这三个对象的参数重命名然 ...
- 机器学习:让我们彻底搞懂CNN【转】
本文转载自:http://115.com/182920/T1266078.html 机器学习:让我们彻底搞懂CNN 上世纪科学家们发现了几个视觉神经特点,视神经具有局部感受眼,一整张图的识别由多个局部 ...
- JAVA基础补漏--Collections工具类排序
Collections在对自定义对象进行排序时,自定义类需要对compareTo()函数进行重写. public class Student implements Comparable<Stud ...
- Spring IOC 源码解析(持续)
如何查看源码 Spring源码下载https://github.com/spring-projects/spring-framework/tags?after=v3.1.0.RC1 eclipse关联 ...
- SQL优化的若干原则
SQL语句:是对数据库(数据)进行操作的惟一途径:消耗了70%~90%的数据库资源:独立于程序设计逻辑,相对于对程序源代码的优化,对SQL语句的优化在时间成本和风险上的代价都很低:可以有不同的写法:易 ...
- android的wifi程序随笔作业
不用说,做前最好新建一个wifiadmin类,用来装载你所有的wifi打开关闭,wifi配置,连接情况等等wifi操作,然后main类里做一些button连接listview显示wifi网络连接等东西 ...
- 【链接】Eclipse的Debug调试技巧
Eclipse的Debug调试技巧大全 https://mp.weixin.qq.com/s/bORg9YxJiby2WenYRrXY-w 使用Eclipse调试Java程序的10个技巧 https: ...
- CDN专业一站式解决方案
调度,弱网加速,动态防御,无限节点(重)新技术
- springboot统一异常处理及返回数据的处理
一.返回code数据的处理 代码: Result.java /** * http请求返回的最外层对象 * Created by 廖师兄 * 2017-01-21 13:34 */ public cla ...
- 使用Bind读取配置到C#的实例
在之前的一篇二级域名绑定的文章<.Net Core 二级域名绑定到指定的控制器>中,有一个小的地方是关于读取Json文件的配置信息的,当时是用了读取文件流的方式,一直以来觉得该方法太Low ...