diff --git a/inventory/host_vars/db-koji02.phx2.fedoraproject.org b/inventory/host_vars/db-koji02.phx2.fedoraproject.org new file mode 100644 index 0000000000..e84096ad90 --- /dev/null +++ b/inventory/host_vars/db-koji02.phx2.fedoraproject.org @@ -0,0 +1,49 @@ +--- +nm: 255.255.255.0 +gw: 10.5.125.254 +dns: 10.5.126.21 +volgroup: /dev/vg_guests +eth0_ip: 10.5.125.48 +vmhost: bvirthost12.phx2.fedoraproject.org +datacenter: phx2 + +ks_url: http://infrastructure.phx2.fedoraproject.org/repo/rhel/ks/kvm-rhel-7 +ks_repo: http://infrastructure.phx2.fedoraproject.org/repo/rhel/RHEL7-x86_64/ + +# This is a generic list, monitored by collectd +databases: +- koji + +# This is a more strict list, to be made publicly available +dbs_to_backup: +- koji + +# These are normally group variables, but in this case db servers are often different +lvm_size: 300000 +mem_size: 32768 +num_cpus: 24 +fas_client_groups: sysadmin-dba,sysadmin-noc,sysadmin-veteran + +# kernel SHMMAX value +kernel_shmmax: 68719476736 + +# +# Only allow postgresql access from the frontend node. +# +custom_rules: [ +'-A INPUT -p tcp -m tcp -s 10.5.125.59 --dport 5432 -j ACCEPT', +'-A INPUT -p tcp -m tcp -s 10.5.125.60 --dport 5432 -j ACCEPT', +'-A INPUT -p tcp -m tcp -s 10.5.125.61 --dport 5432 -j ACCEPT', +'-A INPUT -p tcp -m tcp -s 10.5.125.62 --dport 5432 -j ACCEPT', +'-A INPUT -p tcp -m tcp -s 10.5.126.41 --dport 5432 -j ACCEPT', +] + +# +# Large updates pushes cause lots of db threads doing the tag moves, so up this from default. +# +nrpe_procs_warn: 600 +nrpe_procs_crit: 700 + +db_backup_dir: ['/backups'] +shared_buffers: "8GB" +effective_cache_size: "24GB" diff --git a/inventory/inventory b/inventory/inventory index 841bb14248..fd5327731c 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -293,6 +293,7 @@ db03.phx2.fedoraproject.org db-fas01.phx2.fedoraproject.org db-datanommer02.phx2.fedoraproject.org db-koji01.phx2.fedoraproject.org +db-koji02.phx2.fedoraproject.org db-qa01.qa.fedoraproject.org db-qa02.qa.fedoraproject.org db-qa03.qa.fedoraproject.org diff --git a/roles/postgresql_server/tasks/main.yml b/roles/postgresql_server/tasks/main.yml index d53d461a4a..61b6ef0533 100644 --- a/roles/postgresql_server/tasks/main.yml +++ b/roles/postgresql_server/tasks/main.yml @@ -90,13 +90,24 @@ - config - postgresql +- name: postgresql recover.conf template (standby only) + template: dest=/var/lib/pgsql/data/resovery.conf src=recovery.conf + when: inventory_hostname.startswith('db-koji02') + notify: + - restart postgresql + tags: + - config + - postgresql + - name: Ensure postgres has a place to backup to file: dest=/backups state=directory owner=postgres + when: inventory_hostname.startswith('db-koji02') tags: - postgresql - name: Copy over backup scriplet copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755 + when: inventory_hostname.startswith('db-koji02') tags: - postgresql diff --git a/roles/postgresql_server/templates/postgresql.conf b/roles/postgresql_server/templates/postgresql.conf index 3ee4d0bccc..46a5562b48 100644 --- a/roles/postgresql_server/templates/postgresql.conf +++ b/roles/postgresql_server/templates/postgresql.conf @@ -505,3 +505,11 @@ default_text_search_config = 'pg_catalog.english' # # Number of concurrent i/o operations at the same time. The default is 1. effective_io_concurrency = 1 + +{% if ansible_hostname.startswith("db-koji01") %} +wal_level = 'hot_standby' +max_wal_senders = 10 +wal_keep_segments = 100 +{% elif ansible_hostname.startswith("db-koji02") %} +hot_standby = on +{% endif %} diff --git a/roles/postgresql_server/templates/recovery.conf b/roles/postgresql_server/templates/recovery.conf new file mode 100644 index 0000000000..69f7927ec8 --- /dev/null +++ b/roles/postgresql_server/templates/recovery.conf @@ -0,0 +1,3 @@ +standby_mode = 'on' +primary_conninfo = 'host=10.5.125.48 port=5432 user=replication password={{ koji_db_replication_password }} +trigger_file= '/var/lib/pgsql/trigger_file'