Rocky Linux 9で稼働するPostgreSQLの起動と停止を行います。
記事の目次
PostgreSQLの起動状態を確認する!
PosgtreSQLの起動状態を確認します。
# systemctl status postgresql ● postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-04-19 06:20:04 JST; 5min ago Process: 2710 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS) Main PID: 2713 (postmaster) Tasks: 8 (limit: 11062) Memory: 17.0M CPU: 100ms CGroup: /system.slice/postgresql.service ├─2713 /usr/bin/postmaster -D /var/lib/pgsql/data ├─2714 "postgres: logger " ├─2716 "postgres: checkpointer " ├─2717 "postgres: background writer " ├─2718 "postgres: walwriter " ├─2719 "postgres: autovacuum launcher " ├─2720 "postgres: stats collector " └─2721 "postgres: logical replication launcher "
PostgreSQLを停止する!
PosgtreSQLを停止します。
# systemctl stop postgresql # systemctl status postgresql ○ postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: inactive (dead) since Wed 2023-04-19 06:29:05 JST; 2s ago Duration: 9min 1.227s Process: 2710 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS) Process: 2713 ExecStart=/usr/bin/postmaster -D ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 2713 (code=exited, status=0/SUCCESS) CPU: 139ms
PostgreSQLを起動する!
PosgtreSQLを起動します。
# systemctl start postgresql # systemctl status postgresql ● postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-04-19 06:30:13 JST; 1s ago Process: 2808 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS) Main PID: 2810 (postmaster) Tasks: 8 (limit: 11062) Memory: 16.9M CPU: 42ms CGroup: /system.slice/postgresql.service ├─2810 /usr/bin/postmaster -D /var/lib/pgsql/data ├─2811 "postgres: logger " ├─2813 "postgres: checkpointer " ├─2814 "postgres: background writer " ├─2815 "postgres: walwriter " ├─2816 "postgres: autovacuum launcher " ├─2817 "postgres: stats collector " └─2818 "postgres: logical replication launcher "
PostgreSQLを再起動する!
PosgtreSQLを再起動します。
# systemctl restart postgresql # systemctl status postgresql ● postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-04-19 06:31:33 JST; 1s ago Process: 2823 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS) Main PID: 2825 (postmaster) Tasks: 8 (limit: 11062) Memory: 16.9M CPU: 48ms CGroup: /system.slice/postgresql.service ├─2825 /usr/bin/postmaster -D /var/lib/pgsql/data ├─2826 "postgres: logger " ├─2829 "postgres: checkpointer " ├─2830 "postgres: background writer " ├─2831 "postgres: walwriter " ├─2832 "postgres: autovacuum launcher " ├─2833 "postgres: stats collector " └─2834 "postgres: logical replication launcher "
おわりに
Rocky Linux 9で稼働するPostgreSQLの起動と停止は、Systemdで行うことができます。
参考情報
関連記事
参考書籍(Amazon)