opengauss5.0:guc修改参数

ALTER SYSTEM SET命令用于设置POSTMASTER、SIGHUP、BACKEND级别的GUC参数。此命令会将参数写入配置文件,不同级别生效方式有所不同。

openGauss=# alter system set synchronous_commit=on;
ERROR:  unsupport parameter: synchronous_commit
ALTER SYSTEM SET only support POSTMASTER-level, SIGHUP-level and BACKEND-level guc variable,
and it must be allowed to set in postgresql.conf.
openGauss=# select name,context from pg_settings where name like 'synchronous_commit';
        name        | context
--------------------+---------
 synchronous_commit | user
(1 row)

  • 此命令仅限初始用户和拥有sysadmin权限的用户才可使用。

  • 不同级别GUC参数生效时间如下:

    • POSTMASTER级别的GUC参数需要重启后才生效。
    • BACKEND级别的GUC参数需要会话重新连接后才生效。
    • SIGHUP级别的GUC参数立即生效(需要等待线程重新加载参数,实际略微有延迟)。

[omm@node2 ~]$ gs_guc set -D /opt/openGauss/data/dn -c "synchronous_commit=on" -N all
The gs_guc run with the following arguments: [gs_guc -D /opt/openGauss/data/dn -c synchronous_commit=on -N all set ].
Begin to perform the total nodes: 3.
Popen count is 3, Popen success count is 3, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
Command count is 3, Command success count is 3, Command failure count is 0.

Total instances: 3. Failed instances: 0.
ALL: Success to perform gs_guc!
 

重启数据库

[omm@node3 dn]$ gs_om -t restart
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Starting cluster.
======================================================================
Successfully started primary instance. Wait for standby instance.
======================================================================
.
Successfully started cluster.
======================================================================
cluster_state      : Normal
redistributing     : No
node_count         : 3
Datanode State
    primary           : 1
    standby           : 2
    secondary         : 0
    cascade_standby   : 0
    building          : 0
    abnormal          : 0
    down              : 0

Successfully started cluster.

 openGauss=# show synchronous_commit;
could not send data to server: 断开的管道
The connection to the server was lost. Attempting reset: Succeeded.
openGauss=# show synchronous_commit;
 synchronous_commit
--------------------
 on
(1 row)

你可能感兴趣的:(opengauss)