wip
This commit is contained in:
@@ -24,7 +24,8 @@ RUN apt-get update && \
|
|||||||
chmod g-w,o-w /var/lib/postgresql
|
chmod g-w,o-w /var/lib/postgresql
|
||||||
|
|
||||||
COPY --chmod=600 --chown=postgres:postgres authorized_keys id_ed25519 /var/lib/postgresql/.ssh/
|
COPY --chmod=600 --chown=postgres:postgres authorized_keys id_ed25519 /var/lib/postgresql/.ssh/
|
||||||
COPY --chmod=600 --chown=postgres:postgres pgpool.conf pool_hba.conf pool_passwd /etc/pgpool2/
|
# COPY --chmod=600 --chown=postgres:postgres pgpool.conf pool_hba.conf pool_passwd /etc/pgpool2/
|
||||||
|
COPY --chmod=600 --chown=postgres:postgres pgpool.conf /etc/pgpool2/
|
||||||
COPY --chmod=755 entrypoint.sh /usr/local/bin/
|
COPY --chmod=755 entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["entrypoint.sh"]
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
|||||||
10
conf.yaml
Normal file
10
conf.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
backend_hostname0 = 'postgres1'
|
||||||
|
backend_port0 = 5432
|
||||||
|
backend_weight0 = 1
|
||||||
|
backend_data_directory0 = '/var/lib/postgresql/data'
|
||||||
|
backend_flag0 = 'ALLOW_TO_FAILOVER'
|
||||||
|
backend_hostname1 = 'postgres2'
|
||||||
|
backend_port1 = 5432
|
||||||
|
backend_weight1 = 1
|
||||||
|
backend_data_directory1 = '/var/lib/postgresql/data'
|
||||||
|
backend_flag1 = 'ALLOW_TO_FAILOVER'
|
||||||
@@ -4,6 +4,30 @@ set -Eeo pipefail
|
|||||||
|
|
||||||
sudo service ssh start
|
sudo service ssh start
|
||||||
|
|
||||||
|
{
|
||||||
|
printf "listen_addresses = '*'\n"
|
||||||
|
printf "port = 5432\n"
|
||||||
|
printf "unix_socket_directories = '/run'\n"
|
||||||
|
printf "pcp_socket_dir = '/run'\n"
|
||||||
|
printf "enable_pool_hba = off\n"
|
||||||
|
printf "allow_clear_text_frontend_auth = on\n"
|
||||||
|
printf "process_management_mode = 'dynamic'\n"
|
||||||
|
printf "backend_clustering_mode = 'raw'\n"
|
||||||
|
printf "health_check_timeout = 5\n"
|
||||||
|
printf "health_check_period = 5\n"
|
||||||
|
printf "health_check_user = 'pgpool'\n"
|
||||||
|
printf "health_check_password = '%s'\n" "$PGPOOL_PASSWORD"
|
||||||
|
|
||||||
|
IFS=':'
|
||||||
|
n=0
|
||||||
|
for backend in $PGPOOL_BACKEND
|
||||||
|
do
|
||||||
|
printf "backend_hostname%d = '%s'\n" $n $backend
|
||||||
|
printf "backend_port%d = 5432\n" $n
|
||||||
|
n=n + 1
|
||||||
|
done
|
||||||
|
} >> /etc/pgpool2/pgpool.conf
|
||||||
|
|
||||||
sudo service pgpool2 start
|
sudo service pgpool2 start
|
||||||
|
|
||||||
while true
|
while true
|
||||||
|
|||||||
15
pgpool.conf
15
pgpool.conf
@@ -1,3 +1,16 @@
|
|||||||
|
listen_addresses = '*'
|
||||||
|
port = 5432
|
||||||
|
unix_socket_directories = '/run'
|
||||||
|
pcp_socket_dir = '/run'
|
||||||
|
enable_pool_hba = off
|
||||||
|
allow_clear_text_frontend_auth = on
|
||||||
|
process_management_mode = 'dynamic'
|
||||||
|
backend_clustering_mode = 'raw'
|
||||||
|
health_check_timeout = 5
|
||||||
|
health_check_period = 5
|
||||||
|
health_check_user = 'pgpool'
|
||||||
|
health_check_password = .....
|
||||||
|
|
||||||
backend_clustering_mode = 'streaming_replication'
|
backend_clustering_mode = 'streaming_replication'
|
||||||
listen_addresses = '*'
|
listen_addresses = '*'
|
||||||
port = 5432
|
port = 5432
|
||||||
@@ -11,7 +24,7 @@ backend_port1 = 5432
|
|||||||
backend_weight1 = 1
|
backend_weight1 = 1
|
||||||
backend_data_directory1 = '/var/lib/postgresql/data'
|
backend_data_directory1 = '/var/lib/postgresql/data'
|
||||||
backend_flag1 = 'ALLOW_TO_FAILOVER'
|
backend_flag1 = 'ALLOW_TO_FAILOVER'
|
||||||
enable_pool_hba = on
|
|
||||||
logdir = '/var/log/postgresql'
|
logdir = '/var/log/postgresql'
|
||||||
sr_check_user = 'pgpool'
|
sr_check_user = 'pgpool'
|
||||||
sr_check_password = 'secret'
|
sr_check_password = 'secret'
|
||||||
|
|||||||
Reference in New Issue
Block a user