Apply recommended tweaks on Postgres images
Apply few recommended optimalizations on Postgres 9.3/9.4 redstack images. Implements: blueprint postgres-configuration-groups Change-Id: Ib7dad31dafdf97adb3200493b334ff93be93fc7b
This commit is contained in:
@@ -3,6 +3,31 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
|
cat > "/etc/sysctl.d/10-postgresql-performance.conf" << _EOF_
|
||||||
|
# See 'http://www.postgresql.org/docs/9.3/static/kernel-resources.html'
|
||||||
|
# for best practices.
|
||||||
|
# It is recommended to disable memory overcommit,
|
||||||
|
# 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_
|
||||||
|
# See 'http://www.postgresql.org/docs/9.3/static/kernel-resources.html'
|
||||||
|
# Disable Linux kernel transparent huge pages. This feature is not supported by
|
||||||
|
# by Postgres 9.3 and may negatively impact performance of the database.
|
||||||
|
if test -f /sys/kernel/mm/redhat_transparent_hugepage/defrag; then
|
||||||
|
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
|
||||||
|
fi
|
||||||
|
if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then
|
||||||
|
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit \$?
|
||||||
|
|
||||||
|
_EOF_
|
||||||
|
|
||||||
dnf install -y http://yum.postgresql.org/9.3/fedora/fedora-21-x86_64/pgdg-fedora93-9.3-2.noarch.rpm
|
dnf install -y http://yum.postgresql.org/9.3/fedora/fedora-21-x86_64/pgdg-fedora93-9.3-2.noarch.rpm
|
||||||
dnf install -y postgresql93-server postgresql93-contrib
|
dnf install -y postgresql93-server postgresql93-contrib
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,32 @@ set -e
|
|||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
cat > "/etc/sysctl.d/10-postgresql-performance.conf" << _EOF_
|
||||||
|
# See 'http://www.postgresql.org/docs/9.3/static/kernel-resources.html'
|
||||||
|
# for best practices.
|
||||||
|
# It is recommended to disable memory overcommit,
|
||||||
|
# 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_
|
||||||
|
# See 'http://www.postgresql.org/docs/9.3/static/kernel-resources.html'
|
||||||
|
# Disable Linux kernel transparent huge pages. This feature is not supported by
|
||||||
|
# by Postgres 9.3 and may negatively impact performance of the database.
|
||||||
|
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 never > /sys/kernel/mm/transparent_hugepage/enabled
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit \$?
|
||||||
|
|
||||||
|
_EOF_
|
||||||
|
|
||||||
apt-get -y install postgresql-9.3
|
apt-get -y install postgresql-9.3
|
||||||
|
|
||||||
# Install the native Python client.
|
# Install the native Python client.
|
||||||
|
|||||||
Reference in New Issue
Block a user