We have recently setup streaming replication in our Postgres server (t01, t02). t01 is master and t02 is the slave. I want to understand the below two issues:
Recently our /var
directory of t01 server got full and app team was not able to access the application. My understanding was if t01 /var
was full, the connection should be made to t02 and application should start using that as t02 /var
was not full.
If we shutdown t01 server, will my application automatically use the t02 databases, Streaming replication will provide HA in this case or not?
No, PostgreSQL won't failover to the standby. Configuring failover properly is a hard problem, and you need specialized cluster software like Patroni to handle that.
As it is, you will have to fail over manually by running pg_ctl promote
on the standby to do it.
You will also have to configure your clients to use the new server. To avoid that, you could use a virtual IP address that you can move to the standby, or you have to setup the clients to try both servers.