title: Postgresql Replication stopped unexpectedly Slave server's service is not starting. How can I Resume replication?
body: <p>Postgres Replication was working fine with Postgresql version 9.5.
  when the template of a DB with 10gb of data was created and then the slave server stopped. Its Postgres service is not starting now. Can you suggest how to reconfigure the replication?
  I had tried to reinstall and did the same procedure of replication but the service was not running after copying the data folder from the master server except the conf files.
  These are the steps I followed:
  In Master:- </p>
  
  <pre><code>*C:\Programfiles\PostgreSql\9.5\data\postgresql.conf
  Modifications:
  listen_addresses = '*'
  wal_level = hot_standby
  max_wal_senders = 1
  wal_keep_segments = 5
  * C:\Programfiles\PostgreSql\9.5\data\pg_hba.conf
      Add:                                
  host    replication     postgres        x.x.x.x/32         trust
  </code></pre>
  
  <p>In Slave:</p>
  
  <pre><code>'*C:\Programfiles\PostgreSql\9.5\data\postgresql.conf'
      'hot_standby = on'
  </code></pre>
  
  <p>Then create a file called recovery.conf under the path </p>
  
  <pre><code>‘C:\Programfiles\PostgreSql\9.5\data\’  and add:'
  'standby_mode = 'on'
  'primary_conninfo = 'host=x.x.x.x port=5432  user=postgres'  
  'password=*****''
  'trigger_file = 'E:\replication\trigger.txt'    
  </code></pre>
  
  <p>In Master:
    Start the Postgresql Service.
      Open Sql Shell(psql) type the command</p>
  
  <pre><code>select pg_start_backup('base backup');
  </code></pre>
  
  <p>Then copy all the contents of data directory excluding postmaster.pid, and all configuration files(.conf) to Slave system’s data directory
  Now type the command</p>
  
  <pre><code>select pg_stop_backup();
  </code></pre>
  
  <p>Kindly suggest a method to resume this replication.</p>
  
  <p>This is the error log</p>
  
  <pre><code>2018-07-30 15:26:57 +04 FATAL:  the database system is starting up
  2018-07-30 15:26:57 +04 LOG:  database system was interrupted while in 
  recovery at log time 2018-07-07 12:21:38 +04
  2018-07-30 15:26:57 +04 HINT:  If this has occurred more than once some data 
  might be corrupted and you might need to choose an earlier recovery target.
  2018-07-30 15:26:58 +04 FATAL:  the database system is starting up
  2018-07-30 15:26:59 +04 FATAL:  the database system is starting up
  2018-07-30 15:27:00 +04 FATAL:  the database system is starting up
  2018-07-30 15:27:00 +04 LOG:  entering standby mode
  2018-07-30 15:27:00 +04 LOG:  redo starts at 6F/5B387B70
  2018-07-30 15:27:01 +04 LOG:  consistent recovery state reached at 
  6F/5BD384F0
  2018-07-30 15:27:01 +04 WARNING:  page 4 of relation base/16394/27254 does 
  not exist
  2018-07-30 15:27:01 +04 CONTEXT:  xlog redo Heap2/VISIBLE: cutoff xid 0
  2018-07-30 15:27:01 +04 PANIC:  WAL contains references to invalid pages
  2018-07-30 15:27:01 +04 CONTEXT:  xlog redo Heap2/VISIBLE: cutoff xid 0
  2018-07-30 15:27:01 +04 LOG:  database system is ready to accept read only 
  connections
  2018-07-30 15:27:01 +04 FATAL:  role "WIN-6QQN9PM6AUG$" does not exist
  2018-07-30 15:27:01 +04 LOG:  startup process (PID 2808) was terminated by         
  exception 0xC0000409
  2018-07-30 15:27:01 +04 HINT:  See C include file "ntstatus.h" for a 
  description of the hexadecimal value.
  2018-07-30 15:27:01 +04 LOG:  terminating any other active server processes
  </code></pre>