Postgres-xl集群修改最大连接数max_connections

       postgres-xl集群和postgres数据库一样,默认的max_connections设置为100;

       在postgres单机版数据库中,通过修改数据库安装目录下的postgresql.conf文件(本地位置参考:/var/lib/pgsql/9.4/data/postgresql.conf )中的max_connections设置即可;

      在postgres-xl集群中,则可以通过以下两种方式来修改max_connections:

      方法一:

      修改coordinator节点下的postgresql.conf(本地位置参考:/home/postgres/pgxc/nodes/coord/postgresql.conf )中的max_connections设置即可,多个coordinator节点时,各节点均需修改;不过这里需要注意的是,在该文件中可能有两个max_connections设置,以文本最后的配置为准:

# pg默认设置 
# - Connection Settings -
#listen_addresses = 'localhost'         # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
#port = 5432                            # (change requires restart)
max_connections = 1000                  # (change requires restart)

... ...
# pg自定义设置,一般位于文本最后
# Add settings for extensions here
#================================================
# Added to all the coordinator postgresql.conf
# Original: coordExtraConfig
log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
listen_addresses = '*'
max_connections = 1000

   方法二:    

   在postgres-xl的初始化脚本(pgxc_ctl/pgxc_ctl.conf)中,添加关于coordinator的额外配置,改方法不需要在每个节点中单独修改:

#---- Coordinators --------
...  ...
#---- Configuration files---
# Need these when you'd like setup specific non-default configuration
# These files will go to corresponding files for the master.
# You may supply your bash script to setup extra config lines and extra pg_hba.conf entries
# Or you may supply these files manually.
# 修改该变量指向CN节点下的postgresql.conf文件位置,既可以通过后面的bash脚本,将设置推送过去
coordExtraConfig=coordExtraConfig       

# Pleae note that the following sets up minimum parameters which you may want to change.
# You can put your postgresql.conf lines here.
cat > $coordExtraConfig <<EOF
#================================================
# Added to all the coordinator postgresql.conf
# Original: $coordExtraConfig
log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
listen_addresses = '*'
# 默认配置100,修改为自定义设置
max_connections = 100
EOF

    修改完成后,重启postgres-xl集群,通过pgadmin,可以查看到修改后的max_connections:

发布了8 篇原创文章 · 获赞 8 · 访问量 2万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览