当前位置:论坛首页 > Linux面板 > 求助

【已完成】PostgreSQL管理器中服务无法启动

发表在 Linux面板2024-1-12 10:09 [复制链接] 10 513

为了能快速了解并处理您的问题,请提供以下基础信息:
面板、插件版本:

Linux面板8.0.51
系统版本:

系统:Ubuntu 23.04 (Lunar Lobster) x86_64(Py3.7.8)

问题描述:

PostgreSQL管理器中服务无法启动
相关截图(日志、错误):

如下图,一直显示为暂停状态。
点击修复,会执行成功,但是没有效果。

进入设置会显示需要安装 or 正在安装

Snipaste_2024-01-12_10-08-27.png

如果进行安装,错误如下:

Snipaste_2024-01-12_10-09-15.png
看了下对应文件的内容:
Snipaste_2024-01-12_10-09-32.png


使用道具 举报 只看该作者 回复
发表于 2024-1-12 10:44:38 | 显示全部楼层
2.0 和 2.2 、1.7版本均存在此问题
使用道具 举报 回复 支持 反对
发表于 2024-1-12 12:22:04 | 显示全部楼层
宝塔用户_mcsiwa 发表于 2024-1-12 10:44
2.0 和 2.2 、1.7版本均存在此问题

正常,如果您那边还是不行的话,论坛私信提供我下面板机器,我看看。
5.png
使用道具 举报 回复 支持 反对
发表于 2024-1-12 13:37:23 | 显示全部楼层
谢花郎 发表于 2024-1-12 12:22
正常,如果您那边还是不行的话,论坛私信提供我下面板机器,我看看。

内网机器,无法提供。
日志如下:
  1. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  2. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  3. pgsql文件解压成功
  4. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
  5. 27950K .......... .......... .......... .......... .......... 99%  896K 0s
  6. 28000K .......... .......... .......... .......... .......... 99% 1.18M 0s
  7. 28050K .......... .......... .......... .......... .......... 99% 1.19M 0s
  8. 28100K .......... .........                                  100% 3.77M=24s

  9. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  10. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  11. pgsql文件解压成功
  12. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
  13. 27950K .......... .......... .......... .......... .......... 99%  896K 0s
  14. 28000K .......... .......... .......... .......... .......... 99% 1.18M 0s
  15. 28050K .......... .......... .......... .......... .......... 99% 1.19M 0s
  16. 28100K .......... .........                                  100% 3.77M=24s

  17. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  18. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  19. pgsql文件解压成功
  20. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
  21. 27950K .......... .......... .......... .......... .......... 99%  896K 0s
  22. 28000K .......... .......... .......... .......... .......... 99% 1.18M 0s
  23. 28050K .......... .......... .......... .......... .......... 99% 1.19M 0s
  24. 28100K .......... .........                                  100% 3.77M=24s

  25. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  26. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  27. pgsql文件解压成功
  28. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
  29. 27950K .......... .......... .......... .......... .......... 99%  896K 0s
  30. 28000K .......... .......... .......... .......... .......... 99% 1.18M 0s
  31. 28050K .......... .......... .......... .......... .......... 99% 1.19M 0s
  32. 28100K .......... .........                                  100% 3.77M=24s

  33. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  34. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  35. pgsql文件解压成功
  36. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
  37. 27950K .......... .......... .......... .......... .......... 99%  896K 0s
  38. 28000K .......... .......... .......... .......... .......... 99% 1.18M 0s
  39. 28050K .......... .......... .......... .......... .......... 99% 1.19M 0s
  40. 28100K .......... .........                                  100% 3.77M=24s

  41. 2024-01-12 13:35:31 (1.13 MB/s) - 已保存 ‘postgresql-14.2.tar.gz’ [28794023/28794023])

  42. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 64: [: 0: unexpected operator
  43. pgsql文件解压成功
  44. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 76: Syntax error: Bad fd number
复制代码
使用道具 举报 回复 支持 反对
发表于 2024-1-12 13:57:36 | 显示全部楼层
添加 set -x 之后:


  1. + [ 0 == 0 ]
  2. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 65: [: 0: unexpected operator
  3. + echo pgsql文件解压成功
  4. pgsql文件解压成功
  5. + user=postgres
  6. + group=postgres
  7. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 77: Syntax error: Bad fd number

  8. 2024-01-12 13:46:26 (1.14 MB/s) - 已保存 ‘postgresql-15.1.tar.gz’ [29778341/29778341])
复制代码
使用道具 举报 回复 支持 反对
发表于 2024-1-12 14:16:15 | 显示全部楼层
  1. #!/bin/bash
  2. #pgsql安装脚本
  3. install_dir=/www/server/pgsql
  4. pgsql_version=$1
  5. down_url=$2

  6. GetCpuStat(){
  7.         time1=$(cat /proc/stat |grep 'cpu ')
  8.         sleep 1
  9.         time2=$(cat /proc/stat |grep 'cpu ')
  10.         cpuTime1=$(echo ${time1}|awk '{print $2+$3+$4+$5+$6+$7+$8}')
  11.         cpuTime2=$(echo ${time2}|awk '{print $2+$3+$4+$5+$6+$7+$8}')
  12.         runTime=$((${cpuTime2}-${cpuTime1}))
  13.         idelTime1=$(echo ${time1}|awk '{print $5}')
  14.         idelTime2=$(echo ${time2}|awk '{print $5}')
  15.         idelTime=$((${idelTime2}-${idelTime1}))
  16.         useTime=$(((${runTime}-${idelTime})*3))
  17.         [ ${useTime} -gt ${runTime} ] && cpuBusy="true"
  18.         if [ "${cpuBusy}" == "true" ]; then
  19.                 cpuCore=$((${cpuInfo}/2))
  20.         else
  21.                 cpuCore=$((${cpuInfo}-1))
  22.         fi
  23. }

  24. cpuInfo=$(getconf _NPROCESSORS_ONLN)
  25. if [ "${cpuInfo}" -ge "2" ];then
  26.         GetCpuStat
  27. else
  28.         cpuCore="1"
  29. fi

  30. loongarch64Check=$(uname -a|grep loongarch64)
  31. if [ "${loongarch64Check}" ];then
  32.     loongarch64_dis="--disable-spinlocks"
  33.     loongarch64_build="--build=arm-linux"
  34. fi

  35. #进入软件的制定安装目录
  36. echo "进入目录/usr/local,下载pgsql文件"
  37. cd /usr/local
  38. #判断是否有postgre版本的安装包
  39. if [ -d postgresql* ];then
  40.         rm -rf /usr/local/postgresql*
  41.         echo "安装包删除成功"
  42. fi
  43. #判断是否有旧的编译文件
  44. if [ -d /usr/local/pgsql ];then
  45.         rm -rf /usr/local/pgsql
  46.         echo "旧的编译文件删除成功"
  47. fi

  48. #开始下载pgsql版本10.5并解压
  49. if [ ! -d /usr/local/src ];then
  50.         mkdir /usr/local/src
  51. fi

  52. cd /usr/local/src
  53. rm -rf post*
  54. wget $down_url
  55. if [ $? == 0 ];then
  56.         tar -zxf $pgsql_version -C /usr/local/
  57. fi

  58. echo "pgsql文件解压成功"
  59. #判断用户是否存在
  60. user=postgres
  61. group=postgres

  62. #create group if not exists
  63. egrep "^$group" /etc/group >& /dev/null
  64. if [ $? -ne 0 ];then
  65.     groupadd $group
  66. fi

  67. #create user if not exists
  68. egrep "^$user" /etc/passwd >& /dev/null
  69. if [ $? -ne 0 ];then
  70.     useradd -m $user -g $group
  71. fi

  72. echo "重命名postgresql并且进入安装目录"
  73. mv /usr/local/post* /usr/local/pgsql
  74. cd /usr/local/pgsql
  75. #-------------------------------安装pgsql------------------------------------
  76. echo "安装一些库文件"
  77. yum install -y zlib zlib-devel >& /dev/null
  78. echo "开始执行configure步骤"
  79. ./configure --prefix=$install_dir --without-readline ${loongarch64_dis} ${loongarch64_build}
  80. if [ $? == 0 ];then
  81.         echo "configure配置通过,开始进行make编译"
  82.         make -j $cpuCore
  83.         if [ $? == 0 ]
  84.         then
  85.                 echo "make编译通过,开始进行make install安装步骤"
  86.                 make install
  87.                 if [ $? != 0 ];then
  88.                         echo "make install安装失败"
  89.                 fi
  90.                 echo "安装成功"
  91.         else
  92.                 echo "make编译失败,检查错误。"
  93.         fi
  94. else
  95.         echo "configure检查配置失败,请查看错误进行安装库文件"
  96. fi
  97. echo "开始进行pgsql的配置"
  98. echo "给pgsql创建data目录"
  99. mkdir -p ${install_dir}/data
  100. mkdir -p ${install_dir}/logs
  101. echo "修改用户组"
  102. chown -R postgres:postgres ${install_dir}
  103. chmod -R 700   ${install_dir}/data

  104. echo "/www/server/pgsql/data" >/www/server/pgsql/data_directory
  105. echo "添加环境变量,进入postgres用户的家目录"
  106. cd /home/postgres
  107. if [ -f /home/postgres/.bash_profile ];then
  108.         /bin/cp /home/postgres/.bash_profile /home/postgres/.bash_profile.bak
  109.         echo "export PGHOME=${install_dir}" >> /home/postgres/.bash_profile
  110.         echo "export PGDATA=${install_dir}/data" >> /home/postgres/.bash_profile
  111.         echo "export PATH=${install_dir}/bin:\$PATH " >> /home/postgres/.bash_profile
  112.         echo "MANPATH=$PGHOME/share/man:$MANPATH" >> /home/postgres/.bash_profile
  113.         echo "LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH" >> /home/postgres/.bash_profile
  114.         source /home/postgres/.bash_profile
  115. fi
  116. if [ -f /home/postgres/.profile ];then
  117.         /bin/cp /home/postgres/.profile /home/postgres/.profile.bak
  118.         echo "export PGHOME=${install_dir}" >> /home/postgres/.profile
  119.         echo "export PGDATA=${install_dir}/data" >> /home/postgres/.profile
  120.         echo "export PATH=${install_dir}/bin:\$PATH " >> /home/postgres/.profile
  121.         echo "MANPATH=$PGHOME/share/man:$MANPATH" >> /home/postgres/.profile
  122.         echo "LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH" >> /home/postgres/.profile
  123.         source /home/postgres/.profile
  124. fi
  125. alias pg_start='pg_ctl -D $PGDATA -l ${install_dir}/logs/pgsql.log start'
  126. alias ps_stop='pg_ctl -D $PGDATA -l ${install_dir}/logs/pgsql.log stop'
  127. echo "切换至postgres用户来初始化数据库"
  128. su - postgres -c "${install_dir}/bin/initdb -D ${install_dir}/data"

  129. echo "启用慢查询SQL语句跟踪"
  130. cat >> ${install_dir}/data/postgresql.conf <<EOF
  131. logging_collector = on
  132. log_destination = 'stderr'
  133. log_directory = '${install_dir}/logs'
  134. log_filename = 'postgresql-%Y-%m-%d.log'
  135. log_statement = all
  136. log_min_duration_statement = 5000
  137. EOF

  138. su - postgres -c "${install_dir}/bin/postgres -D ${install_dir}/data >>${install_dir}/logs/pgsql.log 2>&1 &"
  139. echo "---------------------------------------------------------------------------------------"
  140. echo "---------------------------------------------------------------------------------------"
  141. echo "----------------------------SUCCESS INSTALLATION OF POSTGRESQL-------------------------"
复制代码
使用道具 举报 回复 支持 反对
发表于 2024-1-12 14:16:54 | 显示全部楼层

进入到/www/server/panel/plugin/pgsql_manager/目录下,将下面内容覆盖到pgsql_install.sh文件内再试试?
使用道具 举报 回复 支持 反对
发表于 2024-1-12 16:08:20 | 显示全部楼层
谢花郎 发表于 2024-1-12 14:16
进入到/www/server/panel/plugin/pgsql_manager/目录下,将下面内容覆盖到pgsql_install.sh文件内再试试 ...
  1. /www/server/panel/plugin/pgsql_manager/pgsql_install.sh: 19: Syntax error: "then" unexpected (expecting "}")
复制代码
使用道具 举报 回复 支持 反对
发表于 2024-1-16 09:27:09 | 显示全部楼层

现在还是不行吗?如果还是不行的话,您那边可以提供下Todesk远程连接通过论坛私信提供Todesk连接信息

其次也可通过论坛私信提供给我面板登录信息
使用道具 举报 回复 支持 反对
发表于 2024-1-19 15:11:35 | 显示全部楼层
谢花郎 发表于 2024-1-16 09:27
现在还是不行吗?如果还是不行的话,您那边可以提供下Todesk远程连接通过论坛私信提供Todesk连接信息

其 ...

问题依旧,因为当时需要使用,自己手工安装和管理了,不通过BT,工作正常。
使用道具 举报 回复 支持 反对
发表于 2024-1-29 11:41:58 | 显示全部楼层
您好,请问当前问题是否解决呢?如果当前问题还是未解决,您可以重新发帖反馈。
此帖子更改为已完成状态
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

企业版年付运维跟进群

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急问题处理

论坛响应时间:10分钟

问题处理方式:1对1处理(优先)

工作时间:白班:9:00 - 18:00

工作时间:晚班:18:00 - 24:00

立即付费处理
快速回复 返回顶部 返回列表