简体   繁体   English

更改 ubuntu 上的默认 postgresql.conf 位置

[英]change default postgresql.conf location on ubuntu

I can't seem to find a way to change the default location of postgresql.conf file from /etc/postgresql/14/main/postgresql.conf to my/own/location/postgresql.conf .我似乎找不到将postgresql.conf文件的默认位置从/etc/postgresql/14/main/postgresql.conf更改为my/own/location/postgresql.conf方法。 I am running postgresql on Ubuntu server.我在 Ubuntu 服务器上运行 postgresql。 I tried changing it using the postgres command line as per the docs but it gives the following error:我尝试根据文档使用 postgres 命令行更改它,但出现以下错误:

postgres=# ALTER SYSTEM SET config_file='/my/loc/test/postgresql/14/main/postgresql.conf';
ERROR:  parameter "config_file" cannot be changed

any ideas?有任何想法吗?

The PostgreSQL documentation says: PostgreSQL 文档说:

This parameter can only be set on the postgres command line.此参数只能在postgres命令行上设置。

So you can only change it when you start the server with所以你只能在启动服务器时更改它

postgres -c config_file=...

This also gives you a clue how to go about it: you have to modify the systemd service file that starts PostgreSQL, ideally by creating a drop-in file in /etc .这也为您提供了有关如何 go 的线索:您必须修改启动 PostgreSQL 的 systemd 服务文件,最好是在/etc中创建一个插入文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM