Resolving PostgreSQL and CMS Issues During CMS Upgrade
Issue Summary
This issue occurs during CMS upgrades (e.g., from CMS 8.0 to CMS 8.0.2), where the backend PostgreSQL database is also upgraded. During the upgrade process, the unix_socket_directories path in the PostgreSQL configuration (postgresql.conf) may change, and required directories may be missing. This results in PostgreSQL failing to start, causing the Database Service and other CMS services to stop functioning.
Environment Details
Scenarios Where This Issue Occurs
1. CMS Upgrade:
When upgrading CMS (e.g., from CMS 8.0 to CMS 8.0.2), the PostgreSQL version is upgraded (e.g., from PostgreSQL 14.5 to PostgreSQL 14.10).
The unix_socket_directories path in postgresql.conf changes from /tmp to /opt/VRTSsfmcs/tmp/psql
2. Missing Directory:
The directory specified unix_socket_directories does not exist in the upgraded environment, causing PostgreSQL to fail with a FATAL error:
FATAL: could not create lock file "/opt/VRTSsfmcs/tmp/psql/.s.PGSQL.5636.lock": No such file or directory
3. Library Path Issues:
The LD_LIBRARY_PATH environment variable is not set, causing PostgreSQL to fail due to missing libraries.
4. Permission Issues:
Incorrect ownership or permissions on the PostgreSQL data directory (/var/opt/VRTSsfmcs/db/data) prevents PostgreSQL from starting.
Steps to Resolve
cat /var/opt/VRTSsfmcs/db/data/postgresql.conf | egrep -i "unix_socket_directories|listen_addresses"
Example configuration:
listen_addresses = 'localhost' # what IP address(es) to listen on
unix_socket_directories = '/opt/VRTSsfmcs/tmp/psql'
create a user & group if they don't exist
# groupadd -g 99999 -o habdbsync
# useradd -g habdbsync -u 99999 -o habdbsync -s /bin/bash -m -d /var/opt/VRTSsfmh/home
# chown habdbsync:habdbsync /var/opt/VRTSsfmh/home
# mkdir -p /opt/VRTSsfmcs/tmp/psql
# chown -R habdbsync:habdbsync /opt/VRTSsfmcs/tmp/psql
# chmod 700 /opt/VRTSsfmcs/tmp/psql
Ensure the PostgreSQL data directory has the correct ownership and permissions:
# chown -R habdbsync:habdbsync /var/opt/VRTSsfmcs/db/data
# chmod 700 /var/opt/VRTSsfmcs/db/data
If libraries are missing, export the LD_LIBRARY_PATH to include the PostgreSQL library path:
# export LD_LIBRARY_PATH=/opt/VRTSsfmcs/pgsql/lib
# echo $LD_LIBRARY_PATH
Restart the PostgreSQL service using the appropriate command:
# /opt/VRTSsfmcs/config/adm/vxsfmcsdb start
Verify the database logs to ensure the service is started successfully:
# tail -f /var/opt/VRTSsfmcs/db/data/db_logs/SFMdb3-03.dblog
Test connectivity to the database using the psql command:
# /opt/VRTSsfmcs/pgsql/bin/psql "dbname=SFMdb3 host=localhost user=habdbsync password= port=5636"
Example query to verify the database is operational:
# select * from habdbsync.p_sf_task where STATE='RUNNING';
Check the status of all CMS services to ensure they are running:
# /opt/VRTSsfmcs/bin/vomsc --status ALL | grep -i server101
Example output:
Web Server (server101).........................................................[RUNNING]
Authentication Service (server101).............................................[RUNNING]
Messaging Service (server101)..................................................[RUNNING]
Database Service (server101)...................................................[RUNNING]
SNMP Trap Service (server101)..................................................[RUNNING]
Key Changes Made
Directory Creation
Configuration Updates
in postgresql.conf to point to /opt/VRTSsfmcs/tmp/psqlLibrary Path
Permissions
Service Restart
Final Verification
Database Connectivity
# /opt/VRTSsfmcs/pgsql/bin/psql "dbname=SFMdb3 host=localhost user=habdbsync password= port=5636"
CMS Services
# /opt/VRTSsfmcs/bin/vomsc --status ALL | grep -i server101
Additional Notes
LD_LIBRARY_PATH
# source ~/.bashrc
Future Updates
path changes in future updates, ensure the directory exists and is properly configured.Conclusion
This issue arises during CMS upgrades when the backend PostgreSQL database is upgraded, leading to changes in the unix_socket_directories parameters. In PostgreSQL 14.5, the default path is /tmp, whereas in PostgreSQL 14.10, it is updated to /opt/VRTSsfmcs/tmp/psql. To resolve the issue, the missing directory was created, permissions were updated, and the correct library path was configured. To ensure consistency across environments, it is recommended to standardize the unix_socket_directories configuration, verify directory existence, set appropriate permissions, and confirm service functionality. PostgreSQL and CMS services are now running as expected.
HOW-To - Resolving PostgreSQL and CMS Issues during CMS Upgrade
Feedback submitted!