postgresql_disk_filling_report/intervention.md
2023-10-28 09:07:13 +02:00

51 lines
2.1 KiB
Markdown

# intervention 20231027
My first action was check the shared drive where `archive_commad` is supposed to be sending _WAL_ files (archivelog): `\\10.6.1.3\archivelog`.
That share does *not* exist anymore.
I check both servers for the existance of such drive and noone of them has that share.
Then I look for a place to write archivelogs, I saw that servers have a `R:\` drive with plenty of space.
So I decided to use a cross copy between both servers, that is:
* Primary will copy to backup as: `\\10.6.1.3\R$\postgresql`
* Backup will copy to primary as: `\\10.6.0.3\R$\postgresql`
Using that approach it's a best practice to get archived from each other, and solve switchover/failover issues in the future.
Then I tried adding a network drive, mapping the shared `R:\` in to `Z:\` as:
* primary's `Z:\` as: `\\10.6.1.3\R$\postgresql`
* backup's `Z:\` as : `\\10.6.0.3\R$\postgresql`
My idea at that stage was have a unique `postgresql.conf` because `archive_command` will be the same for both servers:
```conf
archive_command = 'copy "%p" "Z:\\archivelog\\%f"'
```
This setting also create a good configuration, We will not care about switchover/failover in terms of config changes.
The problem here
I modified postgresql.conf so archivecommand is:
archive_command = 'copy "%p" "Z:\\archivelog\%f
```conf
#archive_command = 'copy "%p" "\\\\10.6.1.3\\\archivelog\\%f"' # command to use to archive a logfile segment
archive_command = 'copy "%p" "\\\\10.6.1.3\\\R\$\\postgresql\\archivelog\\%f"'
#archive_command = 'copy "%p" "Z:\\archivelog\\%f"'
#archive_command = 'copy "%p" "R:\\postgresql\\local\\archivelog\\%f"'
```
I tried many options but nothing works, it was related to windows permissions. I tried copying from the powershell with admin user and the copy from one server to the other worked.
I tried adding permissions (as much as I could remember) but nothing worked.
So At the end I decided to archive locally on "R:"
So both server are archiving into "R:\postgresql\local\archivelog"
I restarted the master instance of postgresql because of this, to apply the new setup.