Logbook/WSL 上の postgresql が起動しなくなった
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* WSL 上の postgresql が起動しなくなった [#t5a80308]
原因: apt で自動インストールされた次期バージョンの postgr...
教訓: postgresql がある環境で 5433/tcp を常用しないほうが...
** あらすじ [#w886027f]
以下の構成で mastodon と misskey の開発環境を WSL 上に共...
pg (postgresql) は両者とも 16。
+----------------- localhost -----------------+
| |
| +--------------- WSL ---------------+ |
| | | |
| | +--------------+ +--------------+ | |
| | | ubuntu-mstdn | | ubuntu-misky | | |
| | | | | | | |
| | | ap: 3000/tcp | | ap: 3001/tcp | | |
| | | pg: 5432/tcp | | pg: 5433/tcp | | |
| | +--------------+ +--------------+ | |
| +-----------------------------------+ |
| |
+---------------------------------------------+
あるとき misskey の環境を立ち上げようとしたら DB に接続で...
psql で確認してみると、たしかにつながらない。
misskey@ubuntu-misky:~$ psql --port 5433
psql: error: connection to server on socket "/var/run/po...
Is the server running locally and accepting conn...
** investigating [#w50565bd]
サービスは起動しているのかな?
root@ubuntu-misky:~# systemctl -a | grep postg
postgresql.service loaded inactive dead ...
postgresql@16-main.service loaded activating start...
system-postgresql.slice loaded active activ...
してなさそう。
こういうときの原因ってうっかりポートを干渉させてるとか、...
ポートの状態を見てみると、なぞのなにかが 5433/tcp を占用...
5432/tcp は隣の distro である ubuntu-mstdn の postgres だ...
root@ubuntu-misky:~# netstat -pantu
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
5433/tcp を使っているプロセスが知りたいけれど netstat -pa...
そういえばさっき ubuntu-mstdn で apt upgrade したときにや...
root@ubuntu-mstdn:~# apt list --installed | grep postg
postgresql-16/focal-pgdg,now 16.4-1.pgdg20.04+2 amd64 [i...
postgresql-17/focal-pgdg,now 17.0-1.pgdg20.04+1 amd64 [i...
postgresql-17 こんにちは、はじめまして。
root@ubuntu-mstdn:~# netstat -pantu
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
root@ubuntu-mstdn:~# ps 483
PID TTY STAT TIME COMMAND
483 ? Ss 0:00 /usr/lib/postgresql/17/bin/p...
こいつだ。
** 対応 [#ycd858c2]
ubuntu-mstdn の postgres をさっさと 17 に移行して 5433/tc...
けれど、1年後には同じことが起こるのが目に見えているので u...
*** postgresql [#he937c29]
ポート変更 5433 → 5442
root@ubuntu-misky:~# vim /etc/postgresql/16/main/postgre...
## 64行目
- port = 5433
+ port = 5442
サービス起動
root@ubuntu-misky:~# systemctl daemon-reload
root@ubuntu-misky:~# systemctl start postgresql.service
稼動確認
root@ubuntu-misky:~# systemctl -a | grep postg
postgresql.service loaded active exited ...
postgresql@16-main.service loaded active running ...
system-postgresql.slice loaded active active ...
root@ubuntu-misky:~# netstat -pantu
tcp 0 0 127.0.0.1:5442 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
*** misskey [#j5876683]
db ポート変更 5433 → 5442
$ sudo -u misskey -i
misskey@ubuntu-misky:~$ vim live/.config/default.yml
db:
host: localhost
- port: 5433
+ port: 5442
仮想環境むずかしい。
終了行:
* WSL 上の postgresql が起動しなくなった [#t5a80308]
原因: apt で自動インストールされた次期バージョンの postgr...
教訓: postgresql がある環境で 5433/tcp を常用しないほうが...
** あらすじ [#w886027f]
以下の構成で mastodon と misskey の開発環境を WSL 上に共...
pg (postgresql) は両者とも 16。
+----------------- localhost -----------------+
| |
| +--------------- WSL ---------------+ |
| | | |
| | +--------------+ +--------------+ | |
| | | ubuntu-mstdn | | ubuntu-misky | | |
| | | | | | | |
| | | ap: 3000/tcp | | ap: 3001/tcp | | |
| | | pg: 5432/tcp | | pg: 5433/tcp | | |
| | +--------------+ +--------------+ | |
| +-----------------------------------+ |
| |
+---------------------------------------------+
あるとき misskey の環境を立ち上げようとしたら DB に接続で...
psql で確認してみると、たしかにつながらない。
misskey@ubuntu-misky:~$ psql --port 5433
psql: error: connection to server on socket "/var/run/po...
Is the server running locally and accepting conn...
** investigating [#w50565bd]
サービスは起動しているのかな?
root@ubuntu-misky:~# systemctl -a | grep postg
postgresql.service loaded inactive dead ...
postgresql@16-main.service loaded activating start...
system-postgresql.slice loaded active activ...
してなさそう。
こういうときの原因ってうっかりポートを干渉させてるとか、...
ポートの状態を見てみると、なぞのなにかが 5433/tcp を占用...
5432/tcp は隣の distro である ubuntu-mstdn の postgres だ...
root@ubuntu-misky:~# netstat -pantu
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
5433/tcp を使っているプロセスが知りたいけれど netstat -pa...
そういえばさっき ubuntu-mstdn で apt upgrade したときにや...
root@ubuntu-mstdn:~# apt list --installed | grep postg
postgresql-16/focal-pgdg,now 16.4-1.pgdg20.04+2 amd64 [i...
postgresql-17/focal-pgdg,now 17.0-1.pgdg20.04+1 amd64 [i...
postgresql-17 こんにちは、はじめまして。
root@ubuntu-mstdn:~# netstat -pantu
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
root@ubuntu-mstdn:~# ps 483
PID TTY STAT TIME COMMAND
483 ? Ss 0:00 /usr/lib/postgresql/17/bin/p...
こいつだ。
** 対応 [#ycd858c2]
ubuntu-mstdn の postgres をさっさと 17 に移行して 5433/tc...
けれど、1年後には同じことが起こるのが目に見えているので u...
*** postgresql [#he937c29]
ポート変更 5433 → 5442
root@ubuntu-misky:~# vim /etc/postgresql/16/main/postgre...
## 64行目
- port = 5433
+ port = 5442
サービス起動
root@ubuntu-misky:~# systemctl daemon-reload
root@ubuntu-misky:~# systemctl start postgresql.service
稼動確認
root@ubuntu-misky:~# systemctl -a | grep postg
postgresql.service loaded active exited ...
postgresql@16-main.service loaded active running ...
system-postgresql.slice loaded active active ...
root@ubuntu-misky:~# netstat -pantu
tcp 0 0 127.0.0.1:5442 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5433 0.0.0.0:* ...
tcp 0 0 127.0.0.1:5432 0.0.0.0:* ...
*** misskey [#j5876683]
db ポート変更 5433 → 5442
$ sudo -u misskey -i
misskey@ubuntu-misky:~$ vim live/.config/default.yml
db:
host: localhost
- port: 5433
+ port: 5442
仮想環境むずかしい。
ページ名: