Arquivos pré -configurados ####################### postgresql.conf - Master #####################################
listen_addresses = '*' port = 5432 max_connections = 400 wal_level = hot_standby fsync = on checkpoint_segments = 10 checkpoint_timeout = 5min checkpoint_warning = 30s archive_mode = on archive_command ='rsync -a %p IP_SERVER:/home/postgres/replication/%f' max_wal_senders = 2 wal_sender_delay = 200ms wal_keep_segments = 20 pg_hba.conf - Master # IPv4 local connections: #host all all 127.0.0.1/32 trust host replication all ipSERVER 255.255.255.0 trust ################# Postgresql.conf - Slave#################################### listen_addresses = '*' port = 5432 max_connections = 400 wal_level = hot_standby archive_mode = on max_wal_senders = 2 hot_standby = on Recovery.conf - Slave standby_mode = 'on' primary_conninfo = 'host=IP_MASTER port=5432 user=postgres password=senha' restore_command = 'cp /home/postgres/replication/%f %p' trigger_file = '/tmp/trigger.pgsql.5432' Emerson Martins DBA Jr Itec/AL 82 9123-5504 82 9668-1283 Em 11 de janeiro de 2012 21:40, Emerson Martins <emersonmarti...@gmail.com>escreveu: > Um dia desses meu slave deu pau..Recriei assim..Seguintes passos. > > *Servidor master* > > Su - postgres > > 1 - Inicializa o Backup > > /usr/local/pgsql/bin/psql -c "SELECT pg_start_backup('replication');" > > 2 - Envia através do rsync a copia das bases e arquivos do master > rsync -av --exclude pg_xlog --exclude postgresql.conf --exclude > postmaster.pid /postgresql/data/ 10.1.3.117:/postgresql/data/ > > 3 - Para o backup > /usr/local/pgsql/bin/psql -c "SELECT pg_stop_backup();" > > > *Servidor Slave* > > 1 - Copia os scripts preconfigurados para replicação > cd ../scripts_replication/ > cp pg_hba.conf postgresql.conf recovery.conf /postgresql/data/ > > 2 - Recria a pasta pg_xlog do slave > cd /postgresql/data > mkdir -p pg_xlog (necessário criar manualmente) > > 3 - Inicializa o Banco > /etc/init.d/rc.postgresql start > > 4- Para monitorar abrir outro terminal e verificar o arquivo serverlog > > tail -f serverlog > > LOG: replication connection authorized: user=postgres host=10.1.3.117 > port=42646 > Senha: > > LOG: database system was interrupted; last known up at 2011-10-10 > 10:26:43 BRT > FATAL: required WAL directory "pg_xlog" does not exist > LOG: startup process (PID 6220) exited with exit code 1 > LOG: aborting startup due to startup process failure > Senha: > LOG: database system was interrupted; last known up at 2011-10-10 > 10:26:43 BRT > LOG: creating missing WAL directory "pg_xlog/archive_status" > LOG: entering standby mode > LOG: restored log file "000000010000000000000033" from archive > LOG: redo starts at 0/33000020 > LOG: consistent recovery state reached at 0/34000000 > LOG: database system is ready to accept read only connections > cp: impossível obter estado de > "/home/postgres/replication/000000010000000000000034": Arquivo ou diretório > não encontrado > LOG: streaming replication successfully connected to primary > > > Emerson Martins > DBA Jr > Itec/AL > 82 9123-5504 > 82 9668-1283 > > > > Em 11 de janeiro de 2012 19:14, william felipe_welter > <wfeli...@gmail.com>escreveu: > > Este rsync ficou entre um pg_start_backup e pg_stop_backup ? >> O archive_mode esta on no master ? >> >> Em 11 de janeiro de 2012 18:25, Dauro Sobrinho >> <dauroadpostg...@gmail.com> escreveu: >> > rsync -av --exclude postmaster.pid --exclude postgresql.conf --exclude >> > pg_hba.conf --exclude backup_label --exclude pg_xlog/* >> > --exclude pg_log/* /bd/primario/ postgres@10.1.1.2:/bd/secundario >> > >> > >> > >> > >> > Em 11 de janeiro de 2012 17:21, Flavio Henrique Araque Gurgel >> > <fha...@gmail.com> escreveu: >> > >> >> > Postgresql - Principal >> >> > >> >> > listen_addresses = '*' >> >> > wal_level = hot_standby >> >> > >> >> > >> >> > max_wal_senders = 1 >> >> > wal_keep_segments = 40 >> >> > >> >> > >> >> > >> >> > Postgresql - Secundário >> >> > hot_standby=on >> >> > >> >> > Recovery - Secundário >> >> > >> >> > >> >> > standby_mode = on >> >> > primary_conninfo = 'host=ip_number port=port_number user=user >> >> > password=pass' >> >> > trigger_file = '/path/failover.trg' >> >> >> >> Como você fez a cópia do cluster? Usou pg_basebackup ou fez na mão? >> >> Se na mão, como fez? >> >> >> >> []s >> >> Flavio Gurgel >> >> _______________________________________________ >> >> pgbr-geral mailing list >> >> pgbr-geral@listas.postgresql.org.br >> >> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral >> > >> > >> > >> > >> > -- >> > Att, >> > >> > Dauro Lima Sobrinho >> > DBA PostgreSQL >> > DB2 Database Administrator for LUW - IBM Information Management >> > DB2 Certified Database Associate - IBM Information Management >> > DB2 Technical Mastery v2 - IBM Information Management >> > Informix Dynamic Server - IBM Information Management >> > SQL Server 2008 - Microsoft Certified Technology Specialist >> > >> > >> > _______________________________________________ >> > pgbr-geral mailing list >> > pgbr-geral@listas.postgresql.org.br >> > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral >> > >> >> >> >> -- >> William Felipe Welter >> ------------------------------ >> Consultor em Tecnologias Livres >> william.wel...@4linux.com.br >> www.4linux.com.br >> _______________________________________________ >> pgbr-geral mailing list >> pgbr-geral@listas.postgresql.org.br >> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral >> > >
_______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral