postgresql Postgres.app 配置(端口和其他选项)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13211508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 00:31:44  来源:igfitidea点击:

Postgres.app configuration (port and other options)

postgresqlpostgres.app

提问by Igor Artamonov

I just installed Postgres.app on my Mac, and I need to make some specific configuration to server. For example I want to use different port, not 5432.

我刚刚在我的 Mac 上安装了 Postgres.app,我需要对服务器进行一些特定的配置。例如我想使用不同的端口,而不是 5432。

I found that it have postgresql.confat ~/Library/Application\ Support/Postgres/var/postgresql.conf, but even if I change value of port =to something other, it listen on 5432 after server restart.

我发现它有postgresql.confat ~/Library/Application\ Support/Postgres/var/postgresql.conf,但即使我将 的值更改port =为其他值,它也会在服务器重新启动后侦听 5432。

Seems that this postgresql.confisn't used by Postgress.app. Where it stores server configuration files?

似乎postgresql.confPostgress.app 没有使用它。它在哪里存储服务器配置文件?

回答by Paul

The postgresql.conf-file at ~/Library/Application\ Support/Postgres/var/isused by Postgres.app. The only problem: if you change the port in that file, that change will notbe reflected in the menu-bar. So the elephant over there will still say "Running on Port 5432", although postgres might be running on, for example, port 5433. (Mac OS X 10.8.2, Server.app 2.2, Postgres.app 9.2.2.0)

在postgresql.conf文件在~/Library/Application\ Support/Postgres/var/使用Postgres.app。唯一的问题:如果更改端口在该文件中,这一变化将不会反映在菜单栏。所以那边的大象仍然会说“在端口 5432 上运行”,尽管 postgres 可能正在运行,例如,端口 5433。(Mac OS X 10.8.2,Server.app 2.2,Postgres.app 9.2.2.0)

回答by kyrre

I can see the output from ps aux |grep post/Applications/Postgres.app/Contents/MacOS/bin/postgres -D /Users/chenc26/Library/Application Support/Postgres/var -p5432 So I think there must be some config in this app to specify the CLI parameter which ignore the value from config file.

我可以看到ps aux |grep post/Applications/Postgres.app/Contents/MacOS/bin/postgres -D /Users/chenc26/Library/Application Support/Postgres/var -p5432 的输出所以我认为这个应用程序中必须有一些配置来指定忽略配置文件中的值的 CLI 参数。

回答by Epigene

I'm running a Mavericks 10.9.3 and opening Postgres app v9.3 config via nano ~/Library/Application\ Support/Postgres/var-9.3/postgresql.confand uncommenting the port = 5432line, then changing it to, say, 5433 did the trick for me. (Restarting the app was required, as the config file mentions). Afterwards the app correctly displays that it is running on port 5433.

我正在运行 Mavericks 10.9.3 并通过打开 Postgres 应用程序 v9.3 配置nano ~/Library/Application\ Support/Postgres/var-9.3/postgresql.conf并取消注释该port = 5432行,然后将其更改为 5433 对我有用。(如配置文件所述,需要重新启动应用程序)。之后应用程序正确显示它正在端口 5433 上运行。

回答by Mike Sherrill 'Cat Recall'

If correctly changing the content of postgresql.conf, then restarting the PostgreSQL server doesn't change the port it's listening on, you're almost certainly editing the wrong postgresql.conf.

如果正确更改了 postgresql.conf 的内容,那么重新启动 PostgreSQL 服务器并不会更改它正在侦听的端口,那么您几乎可以肯定编辑了错误的 postgresql.conf。

On other platforms, PostgreSQL puts a copyof its default version of postgresql.conf in the data directory. So you're liable to find at least two copies of all the configuration files somewhere on your computer--usually one in the directory where the distribution or source was downloaded or uncompressed, and one in the data directory. On your Mac, if you're using version 9.1, the data directory mightbe

在其他平台上,PostgreSQL 将其默认版本的 postgresql.conf的副本放在数据目录中。因此,您很可能会在计算机的某处找到至少两份所有配置文件的副本——通常一份在下载或解压缩分发或源的目录中,另一份在数据目录中。在 Mac 上,如果您使用的是 9.1 版,则数据目录可能

/Library/PostgreSQL/9.1/data/

Check for a postgresql.conf there. If you find one, consider making a copy of it to replace the one you edited. (So the one you edited will again be an unedited version.)

在那里检查 postgresql.conf。如果您找到了,请考虑制作一份副本以替换您编辑过的那个。(因此,您编辑过的将再次成为未编辑的版本。)