云原生容器内的一次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

相关推荐
鹤落晴春5 小时前
【K8s】从 ConfigMap 到 Argo CD:Kubernetes 配置管理链路
运维·云原生·容器·kubernetes
汇智信科5 小时前
基于 Jmis 框架的制度与流程管控系统设计与应用|项目全生命周期管理
大数据·人工智能·微服务·云原生·汇智信科
陈聪.10 小时前
Kubernetes 集群网络插件迁移:从 Flannel 到 Calico 实战总结
云原生·kubernetes
Spider Cat 蜘蛛猫13 小时前
微服务- 自动审核商家入驻
微服务·云原生·架构
陈聪.13 小时前
Kubernetes Service 与 Ingress 知识总结
云原生·容器·kubernetes
分布式存储与RustFS1 天前
RustFS 多协议接入全景:S3 之外,Swift/Keystone 与 SFTP/FTPS 怎么选
云原生·开源·对象存储·分布式存储·s3·rustfs·性能基准
分布式存储与RustFS1 天前
在 Kubernetes 上用 RustFS Operator 给 Tenant 开 KMS 加密:spec.encryption 实战
云原生·开源·对象存储·分布式存储·s3·rustfs·性能基准
Seoyoneh2 天前
呼叫中心系统云原生架构演进:传统自建与云端部署的技术实现对比分析
云原生·架构
2601_962218472 天前
万象生鲜系统订单全生命周期追踪实现生鲜企业订单业务数字化可视
大数据·运维·微服务·云原生·架构
分布式存储与RustFS2 天前
RustFS 1.0 GA 前的生产验收清单:从 rc.1 到 GA 该准备什么
云原生·开源·对象存储·分布式存储·s3·rustfs·性能基准