helm启动postgre-stolon

1. 安装文件准备

  • chart包
    旧的url: https://github.com/helm/charts ,下载 charts-master,里边包含stolon目录。
    新的url:https://artifacthub.io/
  • 安装文档
    找到stolon目录,下边有安装文档和所有可以覆盖的变量。

2. 设置

根据条件修改values.yaml文件

  • 存储大小
.........
persistence:
enabled: true
storageClassName: ""
accessModes:
- ReadWriteOnce
# 修改存储大小
size: 30Gi
..........
  • 账号密码
superuserUsername: "stolon"
## password for the superuser (REQUIRED if superuserSecret is not set)
superuserPassword: "1Wxxx"
replicationUsername: "repluser"
## password for the replication user (REQUIRED if replicationSecret is not set)
replicationPassword: "1Wxxx"
  • 最大连接数
pgParameters:
#修改最大连接数
max_connections: "1000"
..........
  • poxy对外提供服务
proxy:
replicaCount: 2
annotations: {}
resources: {}
priorityClassName: ""
service:
# type: ClusterIP
type: NodePort
# loadBalancerIP: ""
annotations: {}
ports:
proxy:
port: 5432
targetPort: 5432
nodePort: 31013
protocol: TCP

3. 安装

# kubectl create namespace stolon
# cd charts-master/stable/stolon
# helm install -n stolon ./

4. 查看

查看启动的pod如下

# kubectl get pod -n stolon
NAME READY STATUS RESTARTS AGE
stolon-create-cluster-rc4lq 0/1 Completed 0 15m
stolon-keeper-0 1/1 Running 0 15m
stolon-keeper-1 1/1 Running 0 10m
stolon-proxy-8956f45f9-p58kw 1/1 Running 0 15m
stolon-proxy-8956f45f9-x2dlw 1/1 Running 0 15m
stolon-sentinel-5885bf6c65-2gj7w 1/1 Running 0 15m
stolon-sentinel-5885bf6c65-64jn9 1/1 Running 0 15m

说明:

  • keeper:他负责管理PostgreSQL的实例汇聚到由sentinel(s)提供的clusterview。实际的postgresql实例也在这个pod里。
  • sentinel:负责发现并且监控keeper,并且计算最理想的clusterview。
  • proxy:客户端的接入点。它强制连接到右边PostgreSQL的master并且强制关闭连接到由非选举产生的master。

【FAQ】

1)修改最大连接数

1)修改chart中values.yaml中变量为合适值
2)helm upgrade
3)删除stolon-keeper-0 和 stolon-keeper-1 ,等待自动重启后即可
4)查看最大连接数命令:

> show max_connections;

在这里插入图片描述

posted on   运维开发玄德公  阅读(31)  评论(0编辑  收藏  举报  

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示