# Postgresql-HA 배포 ## 1. 배포 방법 ### 1) 배포시 주의 사항 - 해당 차트 배포 시 `postgresql.resource.limits.memory`에 대한 설정을 반드시 해야한다. 설정하지 않을 시 배포가 되지 않는다. ### 2) 배포 방법 ``` sh git clone https://github.com/paasup/service-catalog.git cd charts/postgresql-ha helm upgrade postgresql ./ -f custom-values.yaml --install -n platform --create-namespace ``` ## 2.custom-values.yaml 설명 - custom-values.yaml에 정의된 값에 대한 설명이다. ### 1) 전역 설정 - private 환경 배포시 사용한다. | Name | 설명 | 기본값 | | ---------------------- | ------------------------------------------------------------ | ------ | | `global.imageRegistry` | 오프라인 설치 시에 설정.
paasup 설치시에는 "paasup.io"으로 설정 | `""` | ### 2) Postgresql 설정 - 해당 차트의 기본 배포설정은 싱글 배포이다. - HA 배포를 원할 시 `postgresql.replicaCount`를 2이상으로 설정하고 [pgpool](#ha-배포)에 대한 추가 설정이 필요하다. | Name | 설명 | 기본값 | | --------------------------- | ------------------------------------------------------------ | ----------------------- | | `postgresql.image.tag` | postgresql 실행 시 사용할 이미지의 tag를 설정.
helm 차트의 기본값을 사용. 버전 변경 시에는 차트 변경을 우선 고려하고 변경 불가 상황에서만 변경. | "" | | `postgresql.username` | postgresql의 username | 'postgres' | | `postgresql.password` | postgresql의 password | 'postgres' | | `postgresql.repmgrUsername` | repmgr의 username | 'postgres' | | `postgresql.repmgrPaasword` | repmgr의 password | 'postgres' | | `postgresql.replicaCount` | postgresql pod에 대한 replicas 설정.
기본 값은 싱글 배포를 위해 1로 되어 있다. 2 이상 설정 시 ha 구성을 위하여 pgpool의 설정이 필요하다. | 1 | | `postgresql.maxConnections` | postgresql의 Maximum connections 설정 | `"100"` | | `postgresql.sharedPreloadLibraries` | Shared preload libraries (comma-separated list) | `"repmgr, pgaudit, pg_stat_statements"` | | `postgresql.initdbScripts` | initdb scripts. 예시는 custom-values.yaml 참고 | `{}` | | `postgresql.extraEnvVars` | postgresql의 pod에 추가할 환경 변수.
기본 설정은 timezon 환경변수가 추가되어 있음 | custom-values.yaml 참고 | | `postgresql.resources` | postgresql의 pod의 cpu, memory 설정. | custom-values.yaml 참고 | | `postgresql.tolerations` | postgresql의 pod 배포를 위한 toleration. | [] | | `postgresql.nodeSelector` | postgresql의 pod가 배포되는 node 설정. | {} | ### 3) pgpool 설정 #### 싱글 배포 시 설정(기본 설정) | Name | 설명 | 기본값 | | ---------------------- | ------------------------------------------------------------ | -------------- | | `pgpool.adminPassword` | pgpool의 관리자 패스워드. | `"postgresql"` | | `pgpool.replicaCount` | pgpool pod에 대한 replica 수.
`postgresql.replicaCount`가 2 이상일 때, custom-values.yaml에서 `replicaCount: 0`을 주석처리하고 그 아래 있는 설정에 대한 주석을 해제한다. | `0` | #### HA 배포 - `postgresql.replicaCount`가 2 이상일 때 사용한다. (기본은 주석처리되어 있음) - `postgresql.maxConnections`에 따라서 다음과 같이 설정한다. - `pgpool.maxPool * pgpool.numInitChildren < postgresql.maxConnections` | Name | 설명 | 기본값 | | ----------------------------- | ------------------------------------------------------------ | ----------------------- | | `pgpool.adminPassword` | pgpool의 관리자 패스워드. | `"postgresql"` | | `pgpool.replicaCount` | pgpool pod에 대한 replica 수.
`custom-values.yaml에서 `replicaCount: 0`을 주석처리하고
그 아래 있는 설정에 대한 주석을 해제한다. | `2` | | `pgpool.authenticationMethod` | pgpool authentication method. PSQL < 14일 때는 'md5'로 설정. | `"scram-sha-256"` | | `postgresql.maxPool` | pgpool의 각 child 프로세스가 유지하는 Postgresql에 대한 최대 연결 수 | 4 | | `postgresql.numInitChildren` | pgpool가 prefork하는 child 프로세스 수. | 32 | | `postgresql.resources` | pgpool의 pod의 cpu, memory 설정. | custom-values.yaml 참고 |