Skip to content

Commit b736f56

Browse files
committed
chore(addons) add postgresql-cluster-17
1 parent 4c37742 commit b736f56

52 files changed

Lines changed: 2624 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addons/index.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ entries:
4747
description: "PostgreSQL is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance."
4848
- version: 16
4949
description: "PostgreSQL is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance."
50+
- version: 17
51+
description: "PostgreSQL is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance."
5052
seaweedfs:
5153
- version: 3
5254
description: "SeaweedFS is a fast distributed storage system for blobs, objects, files, and data lake, for billions of files."
@@ -62,24 +64,24 @@ entries:
6264
pmm:
6365
- version: 2.41
6466
description: "Percona Monitoring and Management: an open source database monitoring, observability and management tool ."
65-
mongodb:
67+
mongodb:
6668
- version: 7.0
6769
description: "MongoDB is a document database designed for ease of application development and scaling."
68-
clickhouse:
70+
clickhouse:
6971
- version: 24
7072
description: "ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics."
71-
kvrocks:
73+
kvrocks:
7274
- version: 2.8
7375
description: "Apache Kvrocks is a distributed key value NoSQL database that uses RocksDB as storage engine and is compatible with Redis protocol."
7476
- version: "2.10"
7577
description: "Apache Kvrocks is a distributed key value NoSQL database that uses RocksDB as storage engine and is compatible with Redis protocol."
76-
yugabytedb:
78+
yugabytedb:
7779
- version: 2024
7880
description: "YugabyteDB is a high-performance distributed SQL database for powering global, internet-scale applications. "
79-
nessie:
81+
nessie:
8082
- version: "0.103"
8183
description: "Transactional Catalog for Data Lakes with Git-like semantics . "
82-
lakefs:
84+
lakefs:
8385
- version: "1.52"
8486
description: "LakeFS provides version control over the data lake, and uses Git-like semantics to create and access those versions. If you know git, you’ll be right at home with lakeFS. "
8587
victoriametrics:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
annotations:
2+
category: Database
3+
apiVersion: v2
4+
appVersion: "17"
5+
dependencies:
6+
- name: common
7+
repository: oci://registry.drycc.cc/charts
8+
version: ~1.1.1
9+
description: PostgreSQL (Postgres) is an open source object-relational database known for reliability and data integrity. ACID-compliant, it supports foreign keys, joins, views, triggers and stored procedures.
10+
engine: gotpl
11+
home: https://github.com/drycc/charts/tree/master/drycc/postgresql
12+
icon: https://drycc.com/assets/stacks/postgresql/img/postgresql-stack-220x234.png
13+
keywords:
14+
- postgresql
15+
- postgres
16+
- database
17+
- sql
18+
- replication
19+
- cluster
20+
- patroni
21+
maintainers:
22+
- email: zhang.eamon@hotmail.com
23+
name: zhangeamon
24+
name: postgresql
25+
sources:
26+
- https://github.com/drycc-addons/
27+
- https://www.postgresql.org/
28+
version: "17.6"
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
# Postgresql cluster addons
3+
## Plans
4+
5+
View and choose the service resource specifications you need.
6+
```
7+
# drycc resources:plans postgresql-cluster
8+
```
9+
### Resource specification list
10+
| Resource Specification | Cores | MEMORY | Storage SIZE |
11+
| :---: | :---: | :---: | :---: |
12+
| standard-10 | 1C | 2G | 10G |
13+
| standard-20 | 2C | 4G | 20G |
14+
| standard-50 | 2C | 8G | 50G |
15+
| standard-100 | 4C | 16G | 100G |
16+
| standard-200 | 8C | 32G | 200G |
17+
| standard-400 | 16C | 64G | 400G |
18+
| standard-800 | 32C | 128G | 800G |
19+
20+
In order to obtain a better experience, it is recommended not to exceed 80% usage of resource utilization for a long period of time. If there is a need for larger resource scale, please apply for private customization.
21+
22+
## Create Postgresql Cluster Service instance
23+
24+
- Create Postgresql service
25+
```
26+
# drycc resources:create postgresql-cluster:standard-10 `my_pg_001`
27+
```
28+
- View service status
29+
```
30+
# drycc resources:describe `my_pg_001`
31+
```
32+
- Bind service
33+
```
34+
# drycc resources:bind `my_pg_001`
35+
```
36+
- View resource status
37+
```
38+
# drycc resources:describe `my_pg_001`
39+
```
40+
41+
## Create Service with values file
42+
43+
`vim values.yaml`
44+
```
45+
# create or update pg instance template yaml
46+
networkPolicy.allowNamespaces:
47+
- mx-test1
48+
service.type: ClusterIP
49+
metrics.enabled: true
50+
backup:
51+
# whether BackUP should be enabled
52+
enabled: true
53+
# Cron schedule for doing base backups
54+
scheduleCronJob: "20 0 * * 0"
55+
Amount of base backups to retain
56+
retainBackups: 2
57+
s3:
58+
awsAccessKeyID: ""
59+
awsSecretAccessKey: ""
60+
walGS3Prefix: "s3://xx"
61+
awsEndpoint: "http://xxxx:9000"
62+
awsS3ForcePathStyle: "true"
63+
awsRegion: dx-1
64+
```
65+
```
66+
drycc resources:create postgresql-cluster:standard-10 `my_pg_001` -f ./values.yaml
67+
```
68+
69+
## Update Service
70+
### Create app user and database
71+
72+
- Login database web with admin user & password
73+
74+
- Change administrator initial password
75+
```
76+
ALTER USER administrator WITH ENCRYPTED PASSWORD 'newpassword';
77+
```
78+
- View total connections number in postgresql cluster;
79+
```
80+
show max_connections ;
81+
```
82+
- CREATE APP USER
83+
```
84+
CREATE USER `myuser` WITH CONNECTION LIMIT `conn limit` LOGIN ENCRYPTED PASSWORD 'password';
85+
GRANT `myuser` to administrator ;
86+
```
87+
- CREATE APP DATABASE
88+
```
89+
CREATE DATABASE `mydb` OWNER `myuser`;
90+
91+
```
92+
- CREATE EXTENSIONS
93+
```
94+
CREATE EXTENSION pg_buffercache;
95+
```
96+
97+
### Network Access
98+
99+
Default access allow policy: only namespace scope.
100+
101+
- allow `mx-test1` namespace access
102+
103+
`vim values.yaml `
104+
```
105+
networkPolicy.allowNamespaces:
106+
- mx-test1
107+
```
108+
```
109+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./values.yaml
110+
```
111+
112+
- Assign external network IP address
113+
114+
`vim values.yaml`
115+
```
116+
service.type: LoadBlancer
117+
```
118+
```
119+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./values.yaml
120+
```
121+
- View resource status
122+
```
123+
# drycc resources:describe `my_pg_001`
124+
```
125+
126+
### Manger backup your data `Very important`
127+
128+
`Strongly recommend enabling this feature.`
129+
`Strongly recommend enabling this feature.`
130+
`Strongly recommend enabling this feature.`
131+
132+
PG data backup use S3 as backenp store. Choose an independent storage space `outside of the current environment` as your backup space.
133+
134+
`vim values.yaml`
135+
```
136+
backup:
137+
# whether BackUP should be enabled
138+
enabled: true
139+
# Cron schedule for doing base backups
140+
scheduleCronJob: "20 0 * * 0"
141+
Amount of base backups to retain
142+
retainBackups: 2
143+
s3:
144+
awsAccessKeyID: DO9l771LqiwZkhhz
145+
awsSecretAccessKey: R3Dv0NEmJBo8JFdn1q8jz49ArWwpDjFn
146+
walGS3Prefix: mx-test
147+
```
148+
```
149+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./values.yaml
150+
```
151+
152+
You can modify multiple content at once, there is no need to modify part of it each time.
153+
154+
155+
## Destroy Service
156+
157+
- Unbind service first
158+
```
159+
# drycc resources:unbind `my_pg_001`
160+
```
161+
- Destroy service
162+
```
163+
# drycc resources:destroy `my_pg_001`
164+
```
165+
# 修改pg在容器中分配的动态共享内存不足的问题
166+
https://www.cnblogs.com/daniel-hutao/p/17903993.html
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Patroni can be accessed via port 5432 on the following DNS name from within your cluster:
2+
{{ template "patroni.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
3+
4+
To get your password for superuser run:
5+
6+
# superuser password
7+
PGPASSWORD_SUPERUSER=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "patroni.fullname" . }} -o jsonpath="{.data.password-superuser}" | base64 --decode)
8+
9+
# admin password
10+
PGPASSWORD_ADMIN=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "patroni.fullname" . }} -o jsonpath="{.data.password-admin}" | base64 --decode)
11+
12+
To connect to your database:
13+
14+
1. Run a postgres pod and connect using the psql cli:
15+
# login as superuser
16+
kubectl run -i --tty --rm psql --image=postgres \
17+
--env "PGPASSWORD=$PGPASSWORD_SUPERUSER" \
18+
--command -- psql -U postgres \
19+
-h {{ template "patroni.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local postgres
20+
21+
# login as admin
22+
kubectl run -i -tty --rm psql --image=postgres \
23+
--env "PGPASSWORD=$PGPASSWORD_ADMIN" \
24+
--command -- psql -U admin \
25+
-h {{ template "patroni.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local postgres

0 commit comments

Comments
 (0)