Pgadmin4 Web UI访问出现500 Internal Server Error的原因排查求助
Pgadmin4 Web UI访问出现500 Internal Server Error的原因排查求助
大家好,我是PostgreSQL的新手,最近在CentOS 8服务器上安装了PostgreSQL 13,同时配置了PGAdmin4的Web UI和桌面UI模式。桌面端运行完全正常,但访问Web UI的时候却碰到了Internal Server Error,具体错误信息如下:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
我已经做了以下排查:
- Apache和PostgreSQL服务都正常运行
- 防火墙已经开放了这两个服务对应的端口,PostgreSQL的5432端口监听状态如下:
[root@XXXXXX-testing-server ~]# ss -tulpn | grep 5432 tcp LISTEN 0 128 0.0.0.0:5432 0.0.0.0:* users:(("postmaster",pid=1485,fd=6)) tcp LISTEN 0 128 [::]:5432 [::]:* users:(("postmaster",pid=1485,fd=7))
之后我查看了/var/log/httpd/error_log,发现了这些关键错误:
[Fri Sep 08 15:31:38.438903 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] mod_wsgi (pid=2114): Failed to exec Python script file '/usr/pgadmin4/web/pgAdmin4.wsgi'. [Fri Sep 08 15:31:38.439004 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] mod_wsgi (pid=2114): Exception occurred processing WSGI script '/usr/pgadmin4/web/pgAdmin4.wsgi'. [Fri Sep 08 15:31:38.443337 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] Traceback (most recent call last): [Fri Sep 08 15:31:38.443412 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgAdmin4.wsgi", line 36, in <module> [Fri Sep 08 15:31:38.443417 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] from pgAdmin4 import app as application [Fri Sep 08 15:31:38.443424 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgAdmin4.py", line 104, in <module> [Fri Sep 08 15:31:38.443427 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] app = create_app() [Fri Sep 08 15:31:38.443432 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgadmin/__init__.py", line 550, in create_app [Fri Sep 08 15:31:38.443435 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] driver.init_app(app) [Fri Sep 08 15:31:38.443441 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgadmin/utils/driver/__init__.py", line 27, in init_app [Fri Sep 08 15:31:38.443444 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] DriverRegistry.load_modules(app) [Fri Sep 08 15:31:38.443459 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgadmin/utils/driver/registry.py", line 20, in load_modules [Fri Sep 08 15:31:38.443461 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] from . import psycopg3 as module [Fri Sep 08 15:31:38.443468 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/__init__.py", line 21, in <module> [Fri Sep 08 15:31:38.443471 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] import psycopg [Fri Sep 08 15:31:38.443476 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/__init__.py", line 9, in <module> [Fri Sep 08 15:31:38.443479 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] from . import pq # noqa: F401 import early to stabilize side effects [Fri Sep 08 15:31:38.443484 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/pq/__init__.py", line 114, in <module> [Fri Sep 08 15:31:38.443487 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] import_from_libpq() [Fri Sep 08 15:31:38.443492 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] File "/usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg/pq/__init__.py", line 106, in import_from_libpq [Fri Sep 08 15:31:38.443495 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] raise ImportError( [Fri Sep 08 15:31:38.443509 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] ImportError: no pq wrapper available. [Fri Sep 08 15:31:38.443511 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] Attempts made: [Fri Sep 08 15:31:38.443515 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'c' implementation: /usr/pgadmin4/venv/lib64/python3.9/site-packages/psycopg_c/pq.cpython-39-x86_64-linux-gnu.so: undefined symbol: PQpipelineStatus [Fri Sep 08 15:31:38.443518 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary' [Fri Sep 08 15:31:38.443520 2023] [wsgi:error] [pid 2114:tid 139876901840640] [remote 192.168.1.1:59963] - couldn't import psycopg 'python' implementation:
我尝试安装了相关的Python库,但显示已经存在:
[root@XXXXXXXX-testing-server ~]# pip3.6 install psycopg2-binary Requirement already satisfied: psycopg2-binary in /usr/local/lib64/python3.6/site-packages (2.9.7)
现在有点困惑,这个错误到底是什么原因导致的呢?有没有大佬能帮忙分析一下?
备注:内容来源于stack exchange,提问作者Dhanushka Ekanayake
相关产品推荐
相关产品推荐

