====== Replica PostgreSQL ====== ===== Slony ===== **[[http://slony.info/|Slony]]** è un sistema di replica asincrono da singolo master a slave multipli. Le principali limitazioni sono: * Richiede pl/pgSQL su tutti i database * Richiede una PKEY per ogni tabella * Bisogna dichiarare ogni tabella da copiare * Bisogna raggruppare in set le tabelle correlate (FOREIGN KEY) * Vengono propagate automaticamente solo le modifiche a tabelle e sequenze * Le modifiche allo schema devono essere propagate a mano * Le funzioni devono essere propagate a mano * Le view devono essere propagate a mano. * You should not directly use ''pg_dump'' to dump schemas on subscribers (slaves). ===== Pgpool-II ===== **[[http://pgpool.projects.postgresql.org/|Pggpool-II Home page]]** Come verificare se pgpool **è in esecuzione**: /etc/init.d/pgpool2 status Il file di configurazione è **''/etc/pgpool.conf''**. ^ port | Porta su cui accetta le connessioni. Default è **9999**, per presentarsi agli applicativi in modo trasparente si può usare **5432**. | ^ pcp_port | Porta per interfaccia di controllo PCP, default **9898**. | ^ log_statement | Print all statements to the log: **true** or **false**. | L'interfaccia di controllo via network di pgpool è **pcp**, normalmente in ascolto sulla porta **9898**. Il file di configurazione con login/password è **''/etc/pcp.conf''**. Per sapere **quanti nodi** sono nel pool, attached o detached (supponendo che postgres/postgres siano le credenziali): pcp_node_count 30 localhost 9898 postgres postgres 2 Per avere **informazioni su ciascun nodo** (si inizia a contare da zero): pcp_node_info 30 localhost 9898 postgres postgres 0 host3b 5432 2 1073741823.500000 Oltre al nome dell'host e la porta sulla quale viene contattato, il terzo parametro indica **lo stato del nodo**: * 0 - This state is only used during the initialization. PCP will never display it. * 1 - Node is up. No connections yet. * 2 - Node is up. Connections are pooled. * 3 - Node is down. L'ultimo parametro è il //normalized load balance weight//. ===== Pitr ===== La principale limitazione di Pitr è: //A PITR replica remains dormant until you apply logs and start up the database. You cannot use the database and apply updates simultaneously. It is like having a "standby server" which cannot be used without it ceasing to be "standby."//