云原生容器内的一次pg_repack排错和解决过程

postgresql的pg_repack 这个cronjob一直执行不了。

排错过程:

  1. 用命令 kubectl describe job pg-repack-scheduler-manual-wv82r -n xxx没有查看用有用信息
  2. 想办法进它启动的pod查看,于是在执行pg_repack.sh命令前,先加一个睡眠时间,如下:
yaml 复制代码
- command:
  - sh
  - -c
  - sleep 60000 && ./pg_repack.sh
  1. run cronjob, 进入其起来后的pod, 手动执行./pg_repack.sh,可以看到报错信息是pg_repack 和postgresal数据库里面的版本不匹配
html 复制代码
pg_repack failed with error: program 'pg_repack 1.4.7' does not match database library 'pg_repack 1.4.8'

解决过程

  1. 将Dockerfile中的pg_repack下载地址改掉

  2. 用podman 重新构建image,并上传到远程仓库.(如果是docker,命令中直接把podman换成docker就行了)

powershell 复制代码
podman build -t gxxx.io/xxx/pg-repack:1.4.8-13.5 .
podman images
podman push gxxx.io/xxx/pg-repack:1.4.8-13.5

注意,如果在执行pg_repack命令时,如:pg_repack --dry-run --table category_aspects,遇到如下错误

ERROR: pg_repack failed with error: You must be a superuser to use pg_repack

此时,可以在命令后面加-k 参数掠过superuser检查pg_repack --dry-run --table category_aspects -k

相关推荐
阿里云云原生11 小时前
阿里云 STAROps 全域智能运维平台发布!从“被动救火”到“主动自治”
云原生
35岁程序员的自救之路12 小时前
AiBBS - 面向下一个十年的AI + 云原生社区系统
人工智能·云原生
珂玥c13 小时前
k8s集群ingress碎碎念
云原生·容器·kubernetes
平行云16 小时前
实时云渲染平台数据通道,支持3D应用文件上传下载分享无缝交互
linux·unity·云原生·ue5·gpu算力·实时云渲染·像素流送
姚不倒17 小时前
Go 进阶实战:实现泛型数据验证器
云原生·golang
容器魔方18 小时前
华为云云容器引擎CCE 2026-Q1优化升级,全面进化您的云原生体验!
大数据·分布式·云原生·容器·云计算
数据与后端架构提升之路18 小时前
论云原生层次架构在自动驾驶云控平台中的应用
云原生·架构·自动驾驶
云游牧者19 小时前
K8S-Ingress流量治理全解-Traefik从入门到实战完全指南
云原生·中间件·容器·kubernetes·ingress·traefik
阿里-于怀19 小时前
告别 Ingress Nginx:云原生 API 网关 Gateway API 使用指引
nginx·云原生·gateway
AI云原生19 小时前
容器网络模型与服务发现:从踩坑到精通,Kubernetes 网络问题排查全指南
服务器·网络·云原生·容器·kubernetes·云计算·服务发现