Support PostgreSQL 12
Change-Id: Ic1d4982a479c2154d7ddcc807d863e2a37fea506
This commit is contained in:
parent
5472d8a57c
commit
72524f9d85
@ -295,7 +295,7 @@ write_files:
|
||||
EOF
|
||||
|
||||
# NOTE(lxkong): Remove this when we support common cloud-init file for all datastores.
|
||||
for datastore in "mysql" "mariadb"
|
||||
for datastore in "mysql" "mariadb" "postgresql"
|
||||
do
|
||||
sudo cp ${common_cloudinit} /etc/trove/cloudinit/${datastore}.cloudinit
|
||||
done
|
||||
|
@ -12,37 +12,14 @@ cat > "/etc/sysctl.d/10-postgresql-performance.conf" << _EOF_
|
||||
# but the Python interpreter may require it on smaller flavors.
|
||||
# We therefore stick with the heuristic overcommit setting.
|
||||
vm.overcommit_memory=0
|
||||
|
||||
_EOF_
|
||||
|
||||
cat > "/etc/rc.local" << _EOF_
|
||||
#!/bin/bash
|
||||
apt-get --allow-unauthenticated -y install libpq-dev postgresql-12 postgresql-server-dev-12 postgresql-client-12
|
||||
|
||||
# See 'http://www.postgresql.org/docs/9.6/static/kernel-resources.html'
|
||||
# Postgres 9.6 added support for THP. Using huge pages reduces overhead when
|
||||
# using large contiguous chunks of memory, like PostgreSQL does.
|
||||
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
|
||||
echo never > /sys/kernel/mm/transparent_hugepage/defrag
|
||||
fi
|
||||
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
|
||||
echo always > /sys/kernel/mm/transparent_hugepage/enabled
|
||||
fi
|
||||
|
||||
exit \$?
|
||||
|
||||
_EOF_
|
||||
|
||||
apt-get --allow-unauthenticated -y install postgresql-9.6 postgresql-contrib-9.6 postgresql-server-dev-9.6
|
||||
|
||||
sed -i "s/external_pid_file =.*/external_pid_file = '\/var\/run\/postgresql\/postgresql.pid'/" /etc/postgresql/9.6/main/postgresql.conf
|
||||
|
||||
# The script will create a postgresql-9.6 image for user to use.
|
||||
# From Postgresql >9.4, pg_rewind is in the main source tree. But, the default location is
|
||||
# /usr/lib/postgresql/<version>/bin/pg_rewind. So, there need create a symlink from that
|
||||
# location to /usr/bin
|
||||
ln -s /usr/lib/postgresql/9.6/bin/pg_rewind /usr/bin/pg_rewind
|
||||
pgsql_conf=/etc/postgresql/12/main/postgresql.conf
|
||||
sed -i "/listen_addresses/c listen_addresses = '*'" ${pgsql_conf}
|
||||
|
||||
systemctl restart postgresql
|
||||
|
||||
# Install the native Python client.
|
||||
apt-get --allow-unauthenticated -y install libpq-dev python-dev
|
||||
pip2 install psycopg2
|
||||
pip3 install psycopg2
|
||||
|
@ -3,10 +3,10 @@
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
[ -n "${RELEASE}" ] || die "RELEASE must be set to a valid Ubuntu release (e.g. trusty)"
|
||||
[ -n "${DIB_RELEASE}" ] || die "RELEASE must be set to a valid Ubuntu release (e.g. trusty)"
|
||||
|
||||
cat <<EOL > /etc/apt/sources.list.d/postgresql.list
|
||||
deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}-pgdg main
|
||||
deb http://apt.postgresql.org/pub/repos/apt/ ${DIB_RELEASE}-pgdg main
|
||||
EOL
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
sed -i "s/PIDFile=\/run\/postgresql\/%i.pid/PIDFile=\/var\/run\/postgresql\/postgresql.pid/" /lib/systemd/system/postgresql@.service
|
||||
|
Loading…
Reference in New Issue
Block a user