Bu yazıyı okumadan önce, ssh ayarlarınızı yaptığınıza emin olun
Bu yazı PostgreSQL 11 ve PgBackRest 2.15 için yazılmıştır
Öncelikle aşağıdaki komut ile pgbackrest kuralım:
sudo apt-get install pgbackrest -y
Edit /var/lib/postgres/data/postgresql.conf: | |
# change IP on subscriber | |
listen_addresses = '*' | |
wal_level = logical | |
shared_preload_libraries = 'pglogical' | |
max_worker_processes = 16 | |
max_wal_senders = 16 | |
max_replication_slots = 16 | |
track_commit_timestamp = on |
server { | |
listen 80; | |
server_name example.com www.example.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name example.com www.example.com; |
sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'" | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'" | |
sudo systemctl stop postgresql | |
sudo su - postgres -c '/usr/lib/postgresql/9.6/bin/pg_upgrade -b /usr/lib/postgresql/9.3/bin -B /usr/lib/postgresql/9.6/bin \ | |
-d /var/lib/postgresql/9.3/main/ -D /var/lib/postgresql/9.6/main/ \ | |
-O "-c config_file=/etc/postgresql/9.6/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" --link' | |
sudo apt-get remove postgresql-9.3 -y |
## This will be fixed by | |
find /var/www -type d -exec chmod 755 {} \; | |
find /var/www -type f -exec chmod 644 {} \; |
# See https://wiki.postgresql.org/wiki/Using_pg_upgrade_on_Ubuntu/Debian for more information and warning! | |
# Check first | |
/usr/lib/postgresql/11/bin/pg_upgrade \ | |
-b /usr/lib/postgresql/9.6/bin \ | |
-B /usr/lib/postgresql/11/bin \ | |
-d /var/lib/postgresql/9.6/main \ | |
-D /var/lib/postgresql/11/main \ | |
-o ' -c config_file=/etc/postgresql/9.6/main/postgresql.conf' \ | |
-O ' -c config_file=/etc/postgresql/11/main/postgresql.conf' \ |
# Use envFrom to load Secrets and ConfigMaps into environment variables | |
apiVersion: apps/v1beta2 | |
kind: Deployment | |
metadata: | |
name: mans-not-hot | |
labels: | |
app: mans-not-hot | |
spec: | |
replicas: 1 |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Your app name', | |
home: Scaffold( |
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
------------ | |
-- Basics -- | |
------------ | |
-- Get indexes of tables |
# Sample haproxy postgresql master check | |
# | |
# haproxy listen: 5431 | |
# pg, instance #1 listen: 5432 (master node) | |
# pg, instance #2 listen: 5433 (replica node) | |
# external failover, promoting replica to master in case of failure | |
# passwordless auth for user web | |
# template1 database is accessible by user web | |
# | |
# haproxy will pass connection to postgresql master node: |