[pgpool-general: 8862] Re: pgpool cannot work inside systemd daemon service

Zhaoxun Yan yan.zhaoxun at gmail.com
Mon Jul 3 18:42:19 JST 2023


[Unit]
Description=run pgpool

[Service]
After=network.service
Type=simple
ExecStart=/bin/bash /root/pgpool.sh ## <-change run_XXX.sh
Restart=on-failure
RestartSec=3
## systemd bears daemon duty

[Install]
WantedBy=multi-user.target

  /root/pgpool.sh
/usr/bin/pgpool


And here is the running result (automatically killed by systemd):

Jul 03 17:36:48 yzx1 systemd[1]: Started run pgpool.
Jul 03 17:36:48 yzx1 systemd[1]: auto_pgpool.service: Deactivated
successfully.
Jul 03 17:36:51 yzx1 sshd[4558]: Invalid user shinken from 180.168.95.234
port 57152
Jul 03 17:36:51 yzx1 sshd[4558]: Received disconnect from 180.168.95.234
port 57152:11: Bye Bye [pr>
Jul 03 17:36:51 yzx1 sshd[4558]: Disconnected from invalid user shinken
180.168.95.234 port 57152 [>
Jul 03 17:37:28 yzx1 sshd[4561]: Invalid user admin from 43.154.95.120 port
60548
Jul 03 17:37:28 yzx1 sshd[4561]: Received disconnect from 43.154.95.120
port 60548:11: Bye Bye [pre>
Jul 03 17:37:28 yzx1 sshd[4561]: Disconnected from invalid user admin
43.154.95.120 port 60548 [pre>

On Mon, Jul 3, 2023 at 4:35 PM Bo Peng <pengbo at sraoss.co.jp> wrote:

> Hi,
>
> On Fri, 30 Jun 2023 15:02:56 +0800
> Zhaoxun Yan <yan.zhaoxun at gmail.com> wrote:
>
> > Hi guys!
> >
> > I want systemd to monitor pgpool and restart another once it found it is
> > dead. So here is this simple service named as auto_pgpool.service
> >
> > [Unit]
> > Description=run pgpool after auto_pgha service ## <-change run_XXX.sh
> >
> > [Service]
> > Type=simple
> > ExecStart=/usr/bin/pgpool ## <-change run_XXX.sh
> > Restart=on-failure
> > RestartSec=3
> > ## systemd bears daemon duty
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> > But it always failed and caused systemd to restart it again and again -
> *is
> > it a false positive? and how can I avoid it?*
> >
> > Jun 30 14:48:13 yzx1 systemd[1]: Started run pgpool after auto_pgha
> service
> > ## <-change run_XXX.sh.
> > ░░ Subject: A start job for unit auto_pgpool.service has finished
> > successfully
> > ░░ Defined-By: systemd
> > ░░ Support: https://access.redhat.com/support
> > ░░
> > ░░ A start job for unit auto_pgpool.service has finished successfully.
> > ░░
> > ░░ The job identifier is 10863.
> > Jun 30 14:48:13 yzx1 pgpool[5575]: pgpool-II version 4.4.3 (nurikoboshi),
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   A generic connection
> > pool/replication/load balance server for PostgreSQL
> > Jun 30 14:48:13 yzx1 pgpool[5575]: Usage:
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   pgpool [ -c] [ -f CONFIG_FILE ] [ -F
> > PCP_CONFIG_FILE ] [ -a HBA_CONFIG_FILE ]
> > Jun 30 14:48:13 yzx1 pgpool[5575]:          [ -n ] [ -D ] [ -d ]
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   pgpool [ -f CONFIG_FILE ] [ -F
> > PCP_CONFIG_FILE ] [ -a HBA_CONFIG_FILE ]
> > Jun 30 14:48:13 yzx1 pgpool[5575]:          [ -m SHUTDOWN-MODE ] stop
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   pgpool [ -f CONFIG_FILE ] [ -F
> > PCP_CONFIG_FILE ] [ -a HBA_CONFIG_FILE ] reload
> > Jun 30 14:48:13 yzx1 pgpool[5575]: Common options:
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -a, --hba-file=HBA_CONFIG_FILE
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       Set the path to
> > the pool_hba.conf configuration file
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       (default:
> > /usr/etc/pool_hba.conf)
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -f, --config-file=CONFIG_FILE
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       Set the path to
> > the pgpool.conf configuration file
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       (default:
> > /usr/etc/pgpool.conf)
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -k, --key-file=KEY_FILE
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       Set the path to
> > the pgpool key file
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       (default:
> > /root/.pgpoolkey)
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       can be over
> ridden
> > by PGPOOLKEYFILE environment variable
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -F, --pcp-file=PCP_CONFIG_FILE
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       Set the path to
> > the pcp.conf configuration file
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       (default:
> > /usr/etc/pcp.conf)
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -h, --help          Print this help
> > Jun 30 14:48:13 yzx1 pgpool[5575]: Start options:
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -C, --clear-oidmaps Clear query
> cache
> > oidmaps when memqcache_method is memcached
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       (If shmem,
> > discards whenever pgpool starts.)
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -n, --dont-detach   Don't run in
> > daemon mode, does not detach control tty
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -x, --debug-assertions   Turns on
> > various assertion checks, This is a debugging aid
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -D, --discard-status Discard
> > pgpool_status file and do not restore previous status
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -d, --debug         Debug mode
> > Jun 30 14:48:13 yzx1 pgpool[5575]: Stop options:
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   -m, --mode=SHUTDOWN-MODE
> > Jun 30 14:48:13 yzx1 pgpool[5575]:                       Can be "smart",
> > "fast", or "immediate"
> > Jun 30 14:48:13 yzx1 pgpool[5575]: Shutdown modes are:
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   smart       quit after all clients
> > have disconnected
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   fast        quit directly, with
> proper
> > shutdown
> > Jun 30 14:48:13 yzx1 pgpool[5575]:   immediate   the same mode as fast
> > *Jun 30 14:48:13 yzx1 systemd[1]: auto_pgpool.service: Main process
> exited,
> > code=exited, status=1/FAILURE*
>
> It seems "pgpool" command failed.
> Could you run run_XXX.sh script to start pgpool?
>
> > ░░ Subject: Unit process exited
> > ░░ Defined-By: systemd
> > ░░ Support: https://access.redhat.com/support
> > ░░
> > ░░ An ExecStart= process belonging to unit auto_pgpool.service has
> exited.
> > ░░
> > ░░ The process' exit code is 'exited' and its exit status is 1.
> > Jun 30 14:48:13 yzx1 systemd[1]: auto_pgpool.service: Failed with result
> > 'exit-code'.
> > ░░ Subject: Unit failed
> > ░░ Defined-By: systemd
> > ░░ Support: https://access.redhat.com/support
> > ░░
> > ░░ The unit auto_pgpool.service has entered the 'failed' state with
> result
> > 'exit-code'.
> > Jun 30 14:48:16 yzx1 systemd[1]: auto_pgpool.service: Scheduled restart
> > job, restart counter is at 167.
>
>
> --
> Bo Peng <pengbo at sraoss.co.jp>
> SRA OSS LLC
> TEL: 03-5979-2701 FAX: 03-5979-2702
> URL: https://www.sraoss.co.jp/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20230703/b94429ad/attachment.htm>


More information about the pgpool-general mailing list