pgpool-II的conn_info 指针的结构

main.c 中,有如下说明:

/*                                    
 * shmem connection info table                                    
 * this is a three dimension array. i.e.:                                    
 * con_info[pool_config->num_init_children][pool_config->max_pool][MAX_NUM_BACKENDS]                                    
 */                                    
ConnectionInfo *con_info;

从 pool_process_context 的代码中也可以看到这一点:

复制代码
/*                                    
 * Return pointer to i th child, j th connection pool and k th backend                                    
 * of connection info on shmem.                                    
 */                                    
ConnectionInfo *pool_coninfo(int child, int connection_pool, int backend){ 
                                    
    pool_log("Gao001…..child in pool_coninfo is: %d", child);
    if (child < 0 || child >= pool_config->num_init_children){
        pool_error("pool_coninfo: invalid child number: %d", child); 
        return NULL;                            
    }                                
                                    
    if (connection_pool < 0 || connection_pool >= pool_config->max_pool){ 
        pool_error("pool_coninfo: invalid connection_pool number: %d", 
connection_pool);
return NULL; } if (backend < 0 || backend >= MAX_NUM_BACKENDS){ pool_error("pool_coninfo: invalid backend number: %d", backend); return NULL; } return &con_info [ child*pool_config->max_pool*MAX_NUM_BACKENDS+ connection_pool*MAX_NUM_BACKENDS+ backend]; }
复制代码

我们可以把con_info的pool想象成这个样子:

复制代码
child--0                
    connection--pool--0            
            backend--0    
            backend--1    
    connection--pool--1            
            backend--0    
            backend--1    
    connection--pool--2            
            backend--0    
            backend--1    
    connection--pool--3            
            backend--0    
            backend--1    
                
child--1                
    connection--pool--0            
            backend--0    
            backend--1    
    connection--pool--1            
            backend--0    
            backend--1    
    connection--pool--2            
            backend--0    
            backend--1    
    connection--pool--3            
            backend--0    
            backend--1    
 ……                
                
child--127                
    connection--pool--0            
            backend--0    
            backend--1    
    connection--pool--1            
            backend--0    
            backend--1    
    connection--pool--2            
            backend--0    
            backend--1    
    connection--pool--3            
            backend--0    
            backend--1    
复制代码

从这个意义上说,pgpool-II并不是一个真正的connection pool,它只是一个child 对应几个连接(比如4个),各个child之间是不会混用某个 connection 的。







本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/08/10/2631945.html,如需转载请自行联系原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
pgpool-ii的配置可以通过源码安装或者使用yum安装来完成。如果选择源码安装,可以按照以下步骤进行配置: 1. 解压源码包:使用命令`tar -xvf pgpool-II-4.2.2.tar.gz`解压源码包。 2. 进入解压后的目录:使用命令`cd pgpool-II-4.2.2`进入解压后的目录。 3. 配置安装路径:使用命令`./configure --prefix=/usr/package/pgpool-II-4.2.2`配置安装路径。 4. 编译和安装:使用命令`make && make install`进行编译和安装。 如果选择使用yum安装,可以按照以下步骤进行配置: 1. 安装yum源:使用命令`yum install -y https://www.pgpool.net/yum/rpms/4.2/redhat/rhel-7-x86_64/pgpool-II-release-4.2-1.noarch.rpm`安装pgpool的yum源。 2. 安装pgpool:使用命令`yum install -y pgpool-II-pg11-devel.x86_64`安装pgpool。 3. 启用pgpool服务:使用命令`systemctl enable pgpool.service`启用pgpool服务。 无论是源码安装还是yum安装,配置文件都可以在`/usr/package/pgpool-II-4.2.2/etc`目录下找到。可以将`pgpool.conf.sample-stream`复制为`pgpool.conf`进行配置。 需要注意的是,从Pgpool-II 4.2版本开始,所有的配置都将通过`/etc/pgpool/`目录下的`pgpool_node_id`文件来区分节点。 另外,如果需要进行postgresql的配置流同步,可以先安装postgresql,然后根据具体需求进行配置。 希望以上信息对您有所帮助。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *2* *3* [pgpool-II的安装及配置读写分离的高可用pg集群](https://blog.csdn.net/qq_35997793/article/details/114028254)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值