include_dir

一个配置文件的指令,指定一个要包含的配置文件的目录

include_dir 是一个 配置文件 指令,用于指定一个要包含的配置文件的目录。

include_dirPostgreSQL 9.3 中被添加。

用法

该目录可以指定为绝对路径,也可以相对于包含 include_dir 的配置文件所在的目录。该目录必须存在,并且 PostgreSQL 运行的操作系统用户必须有权读取。一个配置文件可以包含多个 include_dir 指令。

该目录的内容将按如下方式处理:

  • 所有以 .conf 结尾的文件都将按文件名顺序读取。
    • 文件名顺序是 C 语言环境定义的顺序。
  • 以句点开头的文件不会被读取。
  • 任何被读取的文件本身可能包含 include_dir 指令。
  • 指定的 include_dir 目录不需要包含任何配置文件。

变更历史

示例

include_dir 的基本用法示例。

include_dir = 'conf.d'                  # include files ending in '.conf' from
                                        # a directory, e.g., 'conf.d'

如果尝试通过重新加载配置来指定一个不存在的目录,日志将包含类似以下的条目:

[2022-07-06 09:05:47 UTC]    LOG:  58P01: could not open configuration directory "/var/lib/pgsql/data/conf.d": No such file or directory
[2022-07-06 09:05:47 UTC]   F0000: configuration file "/var/lib/pgsql/datapostgresql.conf" contains errors; no changes were applied

如果 PostgreSQL 在 include_dir 包含无效目录时启动或重启,启动将失败,并显示类似以下的日志消息:

waiting for server to start....2022-07-06 09:14:38.689 GMT [18854] LOG:  could not open configuration directory "/var/lib/pgsql/data/conf.d": No such file or directory
2022-07-06 09:14:38.689 GMT [18854] FATAL:  configuration file "/var/lib/pgsql/data/postgresql.conf" contains errors
 stopped waiting
pg_ctl: could not start server
Examine the log output.

分类

配置

另请参阅

includeinclude_if_existspostgresql.conf

反馈

就“include_dir”提交任何评论、建议或更正,请点击 这里