- using Ansible command line:
 
ansible-playbook --connection=local --inventory 127.0.0.1, playbook.yml- using inventory:
 
127.0.0.1 ansible_connection=local| version: "3" | |
| services: | |
| pghero: | |
| environment: | |
| - 'DATABASE_URL=postgres://postgres:pgpasswd@postgres:5432/demo' | |
| ports: | |
| - '8080:8080' | |
| image: ankane/pghero | |
| depends_on: | |
| - postgres | 
| !#/usr/bin/env python | |
| sudo apt-get install virtualenv | |
| virtualenv --no-site-packages .venv | |
| source .venv/bin/activate | |
| pip install molecule ansible docker-py | |
| molecule init role -r role-name -d docker | 
| #!/usr/bin/env bash | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8 | |
| sudo apt update | |
| sudo apt-get install docker-ce docker-ce-cli containerd.io -y | |
| sudo usermod -aG docker $USER | |
| sudo pkill -u $USER #logout | |
| Swap file management must be set to manual first: | |
| wmic.exe computersystem where name="ComputerName " set AutomaticManagedPagefile=False [Enter] | |
| Then, we delete the swap file: | |
| wmic.exe pagefileset where name="c:\\pagefile.sys" delete [Enter] | |
| NOTE: Case sensitive AND the double backslashes are required. | 
| (LightWeight|ISATAP|WAN Miniport|Microsoft Kernel Debug|Teredo|Connection-QoS|Pseudo-Interface|Packet Scheduler|RAS Async Adapter) | 
| В PostgreSQL версий ниже 9.6 нет функции pg_blocking_pids, но блокирующий процесс можно вычислить, используя запросы к таблице блокировок. Запрос покажет две строки: одна транзакция получила блокировку (granted), другая - нет и ожидает. | |
| SELECT locktype, transactionid, pid, mode, granted | |
| FROM pg_locks | |
| WHERE transactionid IN ( | |
| SELECT transactionid FROM pg_locks WHERE pid = :blocked_pid AND NOT granted | 
ansible-playbook --connection=local --inventory 127.0.0.1, playbook.yml127.0.0.1 ansible_connection=local| [win] | |
| win-web1.localdomain | |
| [win:vars] | |
| ansible_user = Administrator | |
| ansible_password = password | |
| ansible_connection = winrm | |
| ansible_winrm_transport = basic | |
| ansible_winrm_server_cert_validation = ignore | 
WAL-E needs to be installed on all machines, masters and slaves.
Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:
archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
| # set -e errexit When set, the shell exits when a simple command in a command list exits non-zero (FALSE). This is not done in situations, where the exit code is already checked (if, while, until,||, &&) | |
| # set -x xtrace Режим отладки. Перед выполнением команды печатает её со всеми уже развернутыми подстановками и вычислениями. | |
| set -ex | |
| export HTTP_PROXY="http://" | |
| export HTTPS_PROXY="http://" | |
| export NO_PROXY="localhost,127.0.0.1" | |
| curl --proxy $HTTP_PROXY -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt update | |
| sudo apt-get install docker-ce docker-ce-cli containerd.io |