zoukankan      html  css  js  c++  java
  • postgresql修改配置生效方法

    PostgreSQL查看及设置参数、单位、描述等信息

    查看参数的默认单位

    select name, unit from pg_settings;
    

      

    查看参数允许的枚举

    select name, enumvals from pg_settings;
    

      

    设置参数

    方式一:在 postgresql.conf设置

    方式二:在启动时传递参数:postgres -c log_connections=yes -c log_destination=’syslog’

    在 psql 里查看及设置参数

    查看:show postgresql.conf中的参数名;
    设置:set postgresql.conf中的参数名 TO 参数值 | set postgresql.conf中的参数名=参数值
    

      

    对于配置服务器,,太多时候我们在Linux中做的操作是,配置*.conf文件,然后重启服务。而很多服务都具有reload功能,而但是具体到某个配置,有时候直接说出需不需要重启服务而使得配置生效,这并不是一件容易的事情。

    但是,postgresql却讲这部分能用在数据表中显式的告诉了我们:

    postgres# select name, context from pg_settings;

    name context
    archive_command

    sihup

    archive_mode postmaster
    block_size internal
    log_connections backend
    log_min_duration_statement superuser
    search_patch user
    • internal: 编译期间的设置,只有重新编译才能生效。

    • postmaster: 只有服务重启才能生效。

    • sighup: 给服务器发送HUP信号会是服务器重新加载postgresql.conf配置,可以立即生效。

    • backend: 与sighup类似,但是不影响正在运行的会话,只在新会话中生效

    • superuser: 使用superuser(如postgres)才能更改,不用重新加载所有配置即可生效。

    • user: 单个会话用户可以在任意时间做修改,只会影响该会话。

    重新加载数据库配置的方法有三种:

    1. 用超级用户运行

    postgres=# SELECT pg_reload_conf();


    2. 用UNIX的kill手动发起HUP信号

    $kill -HUP PID

     

    3.使用pg_ctl命令触发SIGHUP信号

    $pg_ctl reload

    http://blog.51cto.com/geekbin/1398671

  • 相关阅读:
    Java Output流写入包装问题
    SpringBoot项目单元测试不经过过滤器问题
    SpringSecurity集成启动报 In the composition of all global method configuration, no annotation support was actually activated 异常
    JWT jti和kid属性的说明
    Maven 排除依赖
    第五章 基因概念的发现
    第三章 孟德尔遗传的拓展
    第二章 孟德尔遗传
    第一章 引言
    GWAS全基因组关联分析
  • 原文地址:https://www.cnblogs.com/ryanzheng/p/9576978.html
Copyright © 2011-2022 走看看