RHEL 8环境下PostgreSQL 11的pg_isready工具获取及路径配置问询
pg_isready Location and PATH Questions Let me break this down for you based on your migration experience from Ubuntu to RHEL 8 with PostgreSQL 11:
1. Is pg_isready part of PostgreSQL 11 for RHEL 8? How to get it?
Yes, pg_isready is absolutely part of the PostgreSQL 11 client toolset for RHEL 8. The confusion here comes from differences in package structure between Ubuntu and RHEL's PGDG repository.
On Ubuntu, installing postgresql-client-11 drops all client tools (including pg_isready) directly into /usr/bin for easy access. But on RHEL 8, the postgresql11 package (even without postgresql11-server) installs all client tools to /usr/pgsql-11/bin/ instead. Only a handful of commonly used tools (like psql) get set up with soft links via the alternatives system to /usr/bin by default.
You already found pg_isready in /usr/pgsql-11/bin/—that means your installation worked correctly. The missing piece was just that this directory isn't in the default system PATH.
2. Will adding /usr/pgsql-11/bin to the system PATH cause issues?
Adding this directory to your PATH is generally safe, but there are a few considerations to keep things smooth:
- Avoid version conflicts: RHEL 8's default AppStream repository includes an older PostgreSQL version (usually 10). If you add
/usr/pgsql-11/binbefore/usr/binin your PATH, the PGDG PostgreSQL 11 tools will take precedence—which is exactly what you want for your migration. If you add it after/usr/bin, the system's older PostgreSQL tools would run first, which could lead to unexpected behavior. - Choose user-specific or system-wide access:
- For just your user account, add this line to your shell's config file (like
~/.bashrcor~/.zshrc):
Then runexport PATH="/usr/pgsql-11/bin:$PATH"source ~/.bashrcto apply the change immediately. - For all users on the system, create a new file at
/etc/profile.d/postgresql.shwith this content:
This will apply the PATH change on every user's login.export PATH="/usr/pgsql-11/bin:$PATH"
- For just your user account, add this line to your shell's config file (like
- Stick with the alternatives system (optional): If you prefer matching how
psqlis set up, you can manually addpg_isreadyto the alternatives chain. Run this command as root:
This creates a soft link fromsudo alternatives --install /usr/bin/pg_isready pg_isready /usr/pgsql-11/bin/pg_isready 100/usr/bin/pg_isreadyto the PGDG version, keeping consistency with your existingpsqlsetup.
Quick Recommendation
If you need access to most or all PostgreSQL 11 client tools, adding /usr/pgsql-11/bin to your PATH is the simplest solution. If you only need a few specific tools available system-wide, using the alternatives method is a cleaner approach.
内容的提问来源于stack exchange,提问作者Shawn

