Premier jet écriture doc
This commit is contained in:
parent
d8c73e385f
commit
fc2aa7560e
|
@ -0,0 +1,107 @@
|
|||
---
|
||||
title: Howto Patroni
|
||||
categories: databases
|
||||
...
|
||||
|
||||
* Documentation : <https://patroni.readthedocs.io/en/latest/>
|
||||
* Dépôt Github : <https://github.com/zalando/patroni>
|
||||
|
||||
[Patroni](https://github.com/zalando/patroni) est un outil qui permet de créer votre propre système de haute disponibilité, utilisant Python, et s’appuyant sur un stockage distribué comme etcd, Zookeeper, Consul ou Kubernetes.
|
||||
Cela permet aux administrateurs de base de données, de déployer des clusters PostgreSQL de manière simple et rapide.
|
||||
|
||||
**ATTENTION : Documentation en cours d'écriture !**
|
||||
|
||||
# Installation
|
||||
|
||||
En Debian 11 la version de Patroni est la 2.0.2, on installe simplement le paquet `patroni` :
|
||||
|
||||
~~~
|
||||
# apt install patroni
|
||||
~~~
|
||||
|
||||
# Configuration
|
||||
|
||||
La syntaxe de la configuration de Patroni est en Yaml.
|
||||
|
||||
Le paquet Debian installe une configuration de base dans `/etc/patroni/config.yml.in` et dans `/etc/patroni/dcs.yml` mais nous préférons créer notre propre fichier de configuration dans `/etc/patroni/config-patroni.yml`
|
||||
|
||||
Voici un exemple de configuration dans `/etc/patroni/config-patroni.yml` :
|
||||
|
||||
~~~
|
||||
scope: cluster-foo
|
||||
name: cluster-foo1
|
||||
|
||||
restapi:
|
||||
listen: 10.0.0.1:8008
|
||||
connect_address: 10.0.0.1:8008
|
||||
|
||||
etcd:
|
||||
hosts: 10.0.0.1:2379,10.0.0.2:2379,10.0.0.3:2379
|
||||
|
||||
bootstrap:
|
||||
dcs:
|
||||
ttl: 30
|
||||
loop_wait: 10
|
||||
retry_timeout: 10
|
||||
maximum_lag_on_failover: 1048576
|
||||
postgresql:
|
||||
use_pg_rewind: true
|
||||
use_slots: true
|
||||
parameters:
|
||||
wal_level: replica
|
||||
hot_standby: "on"
|
||||
wal_keep_segment: 8
|
||||
max_wal_senders: 5
|
||||
max_relication_slots: 5
|
||||
checkpoint_timeout: 30
|
||||
|
||||
initdb:
|
||||
- encoding: UTF8
|
||||
- data-checksums
|
||||
|
||||
pg_hba:
|
||||
- host replication repl 127.0.0.1/32 md5
|
||||
- host replication repl 10.0.0.1/0 md5
|
||||
- host replication repl 10.0.0.2/0 md5
|
||||
- host replication repl 10.0.0.3/0 md5
|
||||
- host all all 0.0.0.0/0 md5
|
||||
|
||||
users:
|
||||
admin:
|
||||
password: passforadmin
|
||||
options:
|
||||
- createrole
|
||||
- createdb
|
||||
repl:
|
||||
password: passforrepl
|
||||
options:
|
||||
- replication
|
||||
|
||||
postgresql:
|
||||
listen: 10.0.0.1:5432
|
||||
connect_address: 10.0.0.1:5432
|
||||
bin_dir: /usr/lib/postgresql/13/bin/
|
||||
data_dir: /home/cluster-foo1
|
||||
pgpass: /tmp/cluster-foo1-pgpass
|
||||
authentication:
|
||||
replication:
|
||||
username: repl
|
||||
password: passforrepl
|
||||
superuser:
|
||||
username: admin
|
||||
password: passforadmin
|
||||
parameters:
|
||||
unix_socket_directories: '/tmp'
|
||||
|
||||
tags:
|
||||
nofailover: false
|
||||
noloadbalance: false
|
||||
clonefrom: false
|
||||
nosync: false
|
||||
~~~
|
||||
|
||||
La configuration se découpe en plusieurs parties que nous allons décrire.
|
||||
|
||||
- `restapi` : configuration de l'API REST de Patroni
|
||||
- `listen` : IP et port d'écoute de l'API REST
|
||||
- `connect_address` : IP et port de connexion à l'API REST
|
Loading…
Reference in New Issue