openGauss GUC参数配置

openGauss GUC参数配置

启动 gsql 工具后,有以下两种方式查询 openGauss 数据库的 GUC 参数:

通过 SQL 查询

所有的 GUC 参数都存储在视图 pg_settings 中,我们可以通过 SQL 语句查询:

1
2
3
select * from pg_settings; # 查看所有 GUC 参数
select * from pg_settings where name='password_encryption_type'; # 查看 password_encryption_type 参数设置
select * from pg_settings where name like 'auth%'; # 查询参数名以 auth 开头的

查询结果:

1
2
3
4
           name           | setting | unit |                           category                           |             short_desc             |                                        extra_desc                                        | context | vartype |       source       | min_val | max_val | enumvals | boot_val | reset_val |               sourcefile                | sourceline
--------------------------+---------+------+--------------------------------------------------------------+------------------------------------+------------------------------------------------------------------------------------------+---------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------------------------------+------------
password_encryption_type | 0 | | Connections and Authentication / Security and Authentication | The encryption method of password. | This controls the encryption type of the password. A value of 2 uses the system default. | sighup | integer | configuration file | 0 | 2 | | 2 | 0 | /var/lib/opengauss/data/postgresql.conf | 870
(1 row)

password_encryption_type 参数说明

该字段决定采用何种加密方式对用户密码进行加密存储。修改此参数的配置不会自动触发已有用户密码加密方式的修改,只会影响新创建用户或修改用户密码操作。该参数属于 SIGHUP 类型参数,请参考表4-134中对应设置方法进行设置。

取值范围 0、1、2

  • 0 表示使用md5 方式对密码加密
  • 1表示采用sha256和md5两种方式分别对密码加密
  • 2表示采用sha256方式对密码加密

由查询结果可知,当前值为 0,即使用 md5 方式对密码加密;该项配置的源地址在 /var/lib/opengauss/data/postgressql.conf 的第 870 行。

通过 show 命令

此外,我们还可以通过 show 命令直接查询 GUC 参数:

1
2
show all; # 查询所有 GUC 参数
show password_encryption_type; # 查询 GUC 参数 password_encryption_type 的值

参考链接

  1. 配置GUC参数> 查看参数当前取值 - 华为云文档
  2. 数据仓库服务 GaussDB(DWS) - 华为云文档