runitを介してpostgresqlサーバーを正しく生成する方法

runitを介してpostgresqlサーバーを正しく生成する方法

私はVoidlinux、特にrunitを理解しようとしています。 Voidにはリポジトリにpostgresql v9があり、新しいものが必要で、ソースからv12をコンパイルしました。それはうまくいきますが、今はそれに対するrunitサービスを作成するのに苦労しています。ドキュメントを読み、Googleで検索した結果は次のとおりです。

# /etc/sv/postgresql/run
#!/bin/sh
exec chpst -u postgres /usr/local/pgsql/bin/pg_ctl -D /var/lib/postgresql/data -l /var/lib/postgresql/logfile start 2>&1
# I've also tried postmaster command, which doesn't work even as standalone, whereas I'm able to launch the server by hand with the command above

私も空のディレクトリを作成し、/run/runit/supervise.postgresqlそれを/etc/sv/postgresql(そしてそれなしで)接続してみました。

再起動するか、サービスを手動で開始しようとすると、次の出力が表示されます。

waiting for server to start.... done
server started
pg_ctl: another server might be running; trying to start server anyway
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.

その後、最後の4行は結果なしで無限ループで繰り返されます。コンテンツ/var/lib/postgresql/logfile:

2019-05-10 08:11:15.859 CEST [1138] FATAL:  lock file "postmaster.pid" already exists
2019-05-10 08:11:15.859 CEST [1138] HINT:  Is another postmaster (PID 760) running in data directory "/var/lib/postgresql/data"?
2019-05-10 08:11:16.964 CEST [1211] FATAL:  lock file "postmaster.pid" already exists
2019-05-10 08:11:16.964 CEST [1211] HINT:  Is another postmaster (PID 760) running in data directory "/var/lib/postgresql/data"?
2019-05-10 08:11:18.070 CEST [1215] FATAL:  lock file "postmaster.pid" already exists
2019-05-10 08:11:18.070 CEST [1215] HINT:  Is another postmaster (PID 760) running in data directory "/var/lib/postgresql/data"?

ありがとうございます。

ベストアンサー1

それで、ついに問題を解決し、同じ問題を経験している人のための答えがここにあります。このエラーは実際には非常に愚かでしたが、ロギングがvoidでどのように機能するかを理解した後にのみこのエラーが見つかりました.次の事実にSSL is not supported in this build気づきました。-lサービス実行コマンドのフラグは、不要なSSLを強制します。だから私が使用した実行可能ファイルは次のようになります。

# /etc/sv/postgresql/run:
#!/bin/sh
exec chpst -u postgres:postgres /usr/local/pgsql/bin/postgres -D '/var/lib/postgresql/data' 2>&1

/etc/sv/postgresql/logまた、フォルダを作成し、その中に次のコンテンツを含むファイル()を作成して、サービスのロギングを有効にします/etc/sv/postgresql/log/run

#!/bin/sh
exec logger -p daemon.info -t postgres

また、実際にログを保存するためにsyslogデーモンをインストールします(例:socklog-void)。

おすすめ記事