English 中文(简体)
Postgresql 9. 0 默认在 bg 中运行
原标题:Postgresql 9.0 is running in bg by default

我发现后gresql v9. 0. 7 在 bg 模式下默认运行, 当它启动时( 命令在下面) 。 早些时候, 当我们使用后gresql v7. 4.2 时, 它曾经以前景模式运行 。

我使用的是自由的8.2 64位环境。 Postgresql v9. 0.7 是用OUT_XML、OOUT_GETTEXT和OUT_GNUGEOPT 选项设置的 。

c670e04:rkananth 16] /usr/local/bin/postgres --version postgres (PostgreSQL) 9.0.7

c670e04:rkananth 7] setenv PGDATA /data/db/postgres/
c670e04:rkananth 11] /data/bin/runas pgsql /usr/local/bin/postgres
c670e04:rkananth 12] ps -A | grep post
65165  ??  Ss     0:00.01 /usr/local/bin/postgres
65167  ??  Ss     0:00.00 postgres: writer process    (postgres)
65168  ??  Ss     0:00.00 postgres: wal writer process    (postgres)
65169  ??  Ss     0:00.00 postgres: autovacuum launcher process    (postgres)
65170  ??  Ss     0:00.00 postgres: stats collector process    (postgres)
65224   0  S+     0:00.00 grep post

c670e04:rkananth 14] ps -p 65165 -o ppid
 PPID
    1
c670e04:rkananth 15] ps 1
  PID  TT  STAT      TIME COMMAND
    1  ??  SLs    0:00.17 /sbin/init --
c670e04:rkananth 16] 

有没有办法逼迫它浮出水面?

查看上述日志时, 它显示服务器处理母程序设置为 1 ( init) 是服务器以 bg 模式运行时的预期行为吗?

然而,9.0.7的文档默认地说,它应该出现在前台。 为什么在我的案例中没有发生这种情况,可能是虫子?

Update 1: /data/bin/runas is not introducing any behavior change, tested without it. Same behavior is is also seen in v8.3 and on Freebsd 7.2 32-bit environment.

服务器进程成为 PID 1 ( init) 的子进程, 看起来像任何应用程序的标准行为 。

现在的问题是,我能否让Postgres 指示他们不要以守护者的身份运行?

Update 2: Got the solution it is the config "silent_mode = off" (By default it is on) will make it to run in foreground and process runs as child process of the shell. With this the question is answered. ( Source - http://postgresql.1045698.n5.nabble.com/BUG-4381-Postgresql-daemon-won-t-stay-in-the-foreground-td2127518.html )

问题回答

事实上,如页页上所述, posgres 应停留在前层:

By default postgres starts in the foreground and prints log messages to the standard error stream. In practical applications postgres should be started as a background process, perhaps at boot time.

最有可能的是 runas 命令是 posgres 进程的守护程序。 从以 pgsql 用户开头的外壳运行 posgres /code> :

root# su - pgsql
pgsql$ setenv PGDATA /data/db/postgres/
pgsql$ /usr/local/bin/postgres

如果您不喜欢将贝壳理解为 pgsql 用户, 您也可以尝试使用 su(1) sudo(8)

现在我想知道为什么您需要 < code> posgres 来在前景中运行。 您真的有很好的理由吗?





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签