-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: could not open file "/var/lib/postgresql/13/main/postgresql.conf": No such file or directory #216
Comments
When restoring, pg_rman removes the 'include' directive which it previously added in the restored postgrsql.conf. But, the logic didn't consider the restored data doesn't have postgresql.conf. It happens when a user manages it in a directory different from the data directory using postgresql's guc parameter `data_directory`.
When restoring, pg_rman removes the 'include' directive which it previously added in the restored postgrsql.conf. But, the logic didn't consider the restored data doesn't have postgresql.conf. It happens when a user manages it in a directory different from the data directory using postgresql's guc parameter `data_directory`.
Hi, thanks for reporting the issue and sorry for replying.
No, we officially support that it works on RHEL.
No, as I said below. It doesn't assume the data directory doesn't have postgresql.conf.
Yes. To be precise, it adds the parameter into postgresql.conf in the restored data directory. So, if postgresql.conf is managed in a directory different from the data directory, it's not added by pg_rman. The error occurred when the restored data directory doesn't have the postgresql.conf because it doesn't assume the postgresql.conf is managed in a directory different from the data directory using the GUC I made a patch to solve the issue. But, there is one limitation. --recovery-target-time doesn't work because postgresql.conf is not managed in the restored data directory and pg_rman adds recovery-related parameters into postgresql.conf only in the directory. In the first place, I think it's better to manage the configuration files in the data directory without using the |
Thank you for your answer.
I tried the followings, then error was disappeared.
I will try to do further test, but the first problem seems to be cleared. So please go ahead.
I experienced the similar limitation. It seems that --recovery-target-time may not work during our test on pg_rman 1.3.14. I appreciate if the problems will be solved, and pg_rman works on ubuntu 18.04 LTS and 20.04 LTS. |
Thanks for trying.
The reason is that pg_rman can't know the path of your real postgresql.conf (/etc/postgresql/13/main/postgresql.conf) and just add the recovery-related parameters into the dummy postgresql.conf(/var/lib/postgresql/13/main/postgresql.conf). Since postgresql doesn't read the dummy configuration file, the recovery-related parameters don't work. There are two workaround ways now.
Ref. 19.5.5. Recovery Target
OK. I want to know other people's comment. At least, it's reasonable to avoid the error happened when the postgresql.conf doesn't exists although the limitation still exists. |
Sorry, I updated the above comments. |
Thank you for suggesting two workaround ways. I try them and expect you to create patch. During our test I want to confirm the curious phenomenon.
Does the restored database recover with (time1) stage ? Or (time2) stage (i.e. a part of table is deleted) ? The following is a part of log of 'pg_rman restore --debug'.
I found that after full backup (time1) is restored, online WAL files are also restored in last two lines.
Is this a specification, bug or miss operation ? |
Sorry, I updated above comment. (modified process 1 - 8)
If the I will investigate above further. |
Thanks for testing. At first, you need to use one of two workaround ways.
I think the reason is that you performed two workaround ways at the same time though I didn't test in my environments.
Yes. Because pg_rman doesn't specify reocvery_target_time in postgresql.conf if you execute without the -- Could you try again? Please test only one workaround way.
|
Hello, I tried test again using workaround 2 (symbolic links).
A part of log of 'pg_rman restore' command
|
Uhh.. I'm might missing something. Sorry. If you have postgresql's error log when starting up, please let me know. |
Though I may misunderstood something, pg_rman seems to work well even if using Could you share the postgresql.conf, the error log and test scripts? |
It would be nice if pg_rman officially supports Ubuntu. We have been pushing pg_rman to our customers since it's a great tool. If needed, we can help in testing it. |
Ishii-san, |
Thank you for sharing the test script. I checked it and noticed our miss operation. <line 49 in test.sh>
Between our process 5 and 6, I add the following command, and I confirmed that recovery was success, i.e (time1) stage was recovered. 5.a Remove data on data_directory Attached is our postgresql.conf and log file. I'm sorry that time zone of log file is UTC, and it makes you confuse, but it will not be necessary any more. Thank you very much for your help. |
Hi, Thanks for sharing your test results. I understood the workaround works for your environments.
OK. Out of curiosity, now there are other backup tools for postgresql. Is there any reason that you use pg_rman or recommend it to your customer? BTW, I made a PoC patch. If you have time, please test with your environments. Please build the branch( #217 ) and add --pgconf-path option when you restoring. You don't need to do the workarounds any more.
And if you have any comments or suggestions for the patch, please let me know. Welcome your comments. |
Thank you very much to create a PoC patch. I will test it with our environment. Reason to recommend pg_rman to customers
|
Most of our customers are Japanese. Comparing with other tools, there's more information in Japanese on it. Also pg_rman is easier to configure for small systems. |
Thanks for sharing the reason why you use pg_rman. I agree what you said. |
I tested PoC patch without workaround, and I add '--pgconf-path' option when restoring. It works well as far as I tested. In postgresql.conf, I tested both mode (with comment and without comment) There is a warning. Is this no problem ?
|
Thanks for quick testing!
Yes. This is the expected behavior if you remove the data directory. ref: https://ossc-db.github.io/pg_rman/index.html
|
merged |
<Label: Question>
On Ubuntu 18.04.6, pg_rman 1.3.8 worked well on PostgreSQL 11.5. But in case of pg_rman 1.3.14 and PostgreSQL 13.5 on ubuntu 18.04.6, the following error occurs after "pg_rman restore" is executed, Is pg_rman (above 1.3.12) supported on Ubuntu 18.04 ?
I use "pg_rman-1.3.14-pg13.tar.gz".
Log of "$ pg_rman restore --recovery-target-time '2022-01-19 11:02:16' --debug"
..
INFO: backup "2022-01-19 11:02:06" is valid
INFO: restoring WAL files from backup "2022-01-19 11:02:06"
INFO: restoring online WAL files and server log files
INFO: create pg_rman_recovery.conf for recovery-related parameters.
INFO: remove an 'include' directive added by pg_rman in postgresql.conf if exists
DEBUG: make temporary file "/var/lib/postgresql/13/main/postgresql.conf.pg_rman.tmp"
ERROR: could not open file "/var/lib/postgresql/13/main/postgresql.conf": No such file or directory
Actually "/var/lib/postgresql/13/main/postgresql.conf" doesn't exist, but
"/var/lib/postgresql/13/main/pg_rman_recovery.conf" exists, and
"/etc/postgresql/13/main/postgresql.conf" exits and it contains as follows;
data_directory = '/var/lib/postgresql/13/main'
archive_mode = on
archive_command = 'cp %p /mnt/backup/arclog/%f'
restore_command = 'cp /mnt/backup/arclog/%f %p'
Will "/var/lib/postgresql/13/main/postgresql.conf" be generated by pg_rman automatically ?
And will "include = 'pg_rman_recevery.conf' " directive be added into $PGDATA/postgresql.conf by pg_rman ?
I want to know the reason of error and correct operation for pg_rman 1.3.14. Since I'm confusing the behavior for PostgreSQL
12 above and for pg_rman 1.3.12 above.
I miss something ?
The text was updated successfully, but these errors were encountered: