问题
We had a problem with our hard drive which contains the data folder for postgres database we repaired that hard and move the data folder to new hard drive now when we try to start our db container we get following error.
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | FATAL: bogus data in lock file "postmaster.pid": ""
I tried to remove the postmaster.pid file but then I get the following error,
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | LOG: database system was interrupted; last known up at 2020-04-07 18:03:04 UTC
db_1 | LOG: invalid primary checkpoint record
db_1 | LOG: invalid secondary checkpoint record
db_1 | PANIC: could not locate a valid checkpoint record
db_1 | LOG: startup process (PID 28) was terminated by signal 6: Aborted
db_1 | LOG: aborting startup due to startup process failure
app_db_1 exited with code 1
we really need the data and we do not have any backup what we should do my docker-compose.yml
contains the following contents for db container,
db:
image: postgres:9.4
volumes:
- /mnt/hdd4/postgresql/data:/var/lib/postgresql/data
- ./tmp:/tmp/docker
ports:
- "5432"
Please let me know if extra information is required.
回答1:
It seems like important parts of your database got destroyed by the disk problem. If you had a backup, that would be the time to restore it. If not, you had best hire a PostgreSQL consultant who is skilled with salvaging data from a corrupted database like this.
来源:https://stackoverflow.com/questions/61270018/fatal-bogus-data-in-lock-file-postmaster-pid-after-repairing-disk-and-changin