Skip to content

Commit

Permalink
pgpool some working version
Browse files Browse the repository at this point in the history
  • Loading branch information
Irek Glownia committed Jun 30, 2021
1 parent 7e21e5a commit a1ff33d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ metadata:
data:
init_pool_passwd_file.sh: |
#!/bin/bash


set -x
set -o errexit
set -o nounset
set -o pipefail
Expand Down Expand Up @@ -177,20 +178,24 @@ data:

init_pcppass.sh: |
#!/bin/bash


set -x
set -o errexit
set -o nounset
set -o pipefail

echo "==> Started: $0"

echo "Generating $HOME/.pcppass file for Pgpool admin user (${PGPOOL_ADMIN_USERNAME})..."
echo "Generating .pcppass file for Pgpool admin user (${PGPOOL_ADMIN_USERNAME})..."

cat >>"$HOME/.pcppass"<<EOF
PCPPASSFILE=$(mktemp /tmp/.pcppass-XXXXX)
export PCPPASSFILE

cat >>"${PCPPASSFILE}"<<EOF
localhost:*:${PGPOOL_ADMIN_USERNAME}:${PGPOOL_ADMIN_PASSWORD}
EOF

chmod 600 $HOME/.pcppass
chmod 600 $PCPPASSFILE

echo "==> Completed: $0"

Expand Down Expand Up @@ -223,6 +228,15 @@ data:
# server for the changes to take effect, or use "pgpool reload". Some
# parameters require a server shutdown and restart to take effect.

#------------------------------------------------------------------------------
# BACKEND CLUSTERING MODE
# Choose one of: 'streaming_replication', 'native_replication',
# 'logical_replication', 'slony', 'raw' or 'snapshot_isolation'
# (change requires restart)
#------------------------------------------------------------------------------

backend_clustering_mode = 'streaming_replication'

#------------------------------------------------------------------------------
# CONNECTIONS
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -414,6 +428,8 @@ data:

log_connections = off
# Log connections
log_disconnections = off
# Log disconnections
log_hostname = off
# Hostname will be shown in ps status
# and in logs if connections are logged
Expand Down Expand Up @@ -494,14 +510,6 @@ data:
# The default is 'ABORT; DISCARD ALL'
reset_query_list = 'ABORT; DISCARD ALL'
#------------------------------------------------------------------------------
# REPLICATION MODE
#------------------------------------------------------------------------------
replication_mode = off
#------------------------------------------------------------------------------
# LOAD BALANCING MODE
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -756,7 +764,7 @@ data:
# Default is on.
# (change requires restart)
relcache_query_target = master # Target node to send relcache queries. Default is master (primary) node.
relcache_query_target = primary # Target node to send relcache queries. Default is master (primary) node.
# If load_balance_node is specified, queries will be sent to load balance node.
#------------------------------------------------------------------------------
# IN MEMORY QUERY MEMORY CACHE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ spec:
- name: pgpool-passwords
mountPath: /opt/bitnami/pgpool/secrets/pgpool_admin_password
subPath: pgpool_admin_password
- name: pgpool-config-files
- name: pgpool-config-dir
mountPath: /opt/bitnami/pgpool/conf/pgpool.conf
subPath: pgpool.conf
- name: pgpool-config-files
- name: pgpool-config-dir
mountPath: /opt/bitnami/pgpool/conf/pool_hba.conf
subPath: pool_hba.conf
- name: pgpool-shared-init-dir
Expand All @@ -99,8 +99,12 @@ spec:
{% else %}
image: {{ data.image.path }}
{% endif %}
command:
- /epiphany/scripts/init_pool_passwd_file.sh
command: ["/bin/sh", "-c"]
args:
- set -x;
/epiphany/scripts/init_pool_passwd_file.sh;
cp /epiphany/bitnami/pgpool/conf/pgpool.conf /opt/bitnami/pgpool/conf/ || echo "Error while copying pgpool.conf";
cp /epiphany/bitnami/pgpool/conf/pool_hba.conf /opt/bitnami/pgpool/conf/ || echo "Error while copying pool_hba.conf";
envFrom:
- configMapRef:
name: pgpool-container-env
Expand All @@ -113,6 +117,14 @@ spec:
subPath: pgpool_postgres_password
- name: pgpool-shared-init-dir
mountPath: /epiphany/shared_dir
- name: pgpool-config-files
mountPath: /epiphany/bitnami/pgpool/conf/pgpool.conf
subPath: pgpool.conf
- name: pgpool-config-files
mountPath: /epiphany/bitnami/pgpool/conf/pool_hba.conf
subPath: pool_hba.conf
- name: pgpool-config-dir
mountPath: /opt/bitnami/pgpool/conf
volumes:
- name: pgpool-init-scripts
configMap:
Expand All @@ -121,6 +133,8 @@ spec:
- name: pgpool-config-files
configMap:
name: pgpool-config-files
- name: pgpool-config-dir
emptyDir: {}
- name: pgpool-passwords
secret:
secretName: pgpool-passwords
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 connections:
host all all 0.0.0.0/0 scram-sha-256
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 scram-sha-256
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5

{% if specification.extensions.replication.enabled | default(false) %}
host replication {{ specification.extensions.replication.replication_user_name }} 0.0.0.0/0 scram-sha-256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ max_connections = 100 # (change requires restart)
# - Authentication -

#authentication_timeout = 1min # 1s-600s
password_encryption = scram-sha-256 # md5 or scram-sha-256
password_encryption = md5 # md5 or scram-sha-256
#db_user_namespace = off

# GSSAPI using Kerberos
Expand Down

0 comments on commit a1ff33d

Please sign in to comment.