1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| [root@Rocky8-2 ~]# cat > /lib/systemd/system/postgresql.service <<EOF [Unit] Description=PostgreSQL database server
[Service] Type=forking User=postgres Group=postgres ExecStart=/apps/pgsql/bin/pg_ctl start -D /pgsql/data -l /pgsql/log/logfile -s -w -t 300 ExecStop=/apps/pgsql/bin/pg_ctl stop -D /pgsql/data -s -m fast ExecReload=/apps/pgsql/bin/pg_ctl reload -D /pgsql/data -s TimeoutSec=300
[Install] WantedBy=multi-user.target
EOF
[root@Rocky8-2 ~]# cat /usr/lib/systemd/system/postgresql.service [Unit] Description=PostgreSQL database server
[Service] Type=forking User=postgres Group=postgres ExecStart=/apps/pgsql/bin/pg_ctl start -D /pgsql/data -l /pgsql/log/logfile -s -w -t 300 ExecStop=/apps/pgsql/bin/pg_ctl stop -D /pgsql/data -s -m fast ExecReload=/apps/pgsql/bin/pg_ctl reload -D /pgsql/data -s TimeoutSec=300
[Install] WantedBy=multi-user.target
[root@Rocky8-2 ~]# systemctl daemon-reload [root@Rocky8-2 ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:111 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:111 [::]:* LISTEN 0 128 [::]:22 [::]:* [root@Rocky8-2 ~]# systemctl start postgresql.service [root@Rocky8-2 ~]# systemctl status postgresql.service ● postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-08-16 17:09:56 CST; 10s ago Process: 2433 ExecStop=/apps/pgsql/bin/pg_ctl stop -D /pgsql/data -s -m fast (code=exited, status=0/SUCCESS) Process: 2430 ExecReload=/apps/pgsql/bin/pg_ctl reload -D /pgsql/data -s (code=exited, status=0/SUCCESS) Process: 2439 ExecStart=/apps/pgsql/bin/pg_ctl start -D /pgsql/data -l /pgsql/log/logfile -s -w -t 300 (code=exited, status=0/SUCCESS) Main PID: 2441 (postgres) Tasks: 6 (limit: 12160) Memory: 14.8M CGroup: /system.slice/postgresql.service ├─2441 /apps/pgsql/bin/postgres -D /pgsql/data ├─2442 postgres: checkpointer ├─2443 postgres: background writer ├─2445 postgres: walwriter ├─2446 postgres: autovacuum launcher └─2447 postgres: logical replication launcher
Aug 16 17:09:56 Rocky8-2.xcjyc.top systemd[1]: Starting PostgreSQL database server... Aug 16 17:09:56 Rocky8-2.xcjyc.top systemd[1]: Started PostgreSQL database server. [root@Rocky8-2 ~]# ss -ntlp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:111 0.0.0.0:* users:(("rpcbind",pid=832,fd=4),("systemd",pid=1,fd=88)) LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=900,fd=3)) LISTEN 0 244 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=2441,fd=6)) LISTEN 0 128 [::]:111 [::]:* users:(("rpcbind",pid=832,fd=6),("systemd",pid=1,fd=90)) LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=900,fd=4)) LISTEN 0 244 [::1]:5432 [::]:* users:(("postgres",pid=2441,fd=5))
|