goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.95k stars 4.74k forks source link

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty #15512

Closed hanzhc closed 2 years ago

hanzhc commented 3 years ago

I use redhat7.6.I used docker-compose down -v to stop the harbor. when I used the command(docker-compose up -d) to start the harbor, I found the harbor-db maintained restarting all the time. I found the logs below:

2020-07-02T12:54:47.012973448Z The files belonging to this database system will be owned by user "postgres". 2020-07-02T12:54:47.013030445Z This user must also own the server process. 2020-07-02T12:54:47.013068962Z 2020-07-02T12:54:47.013222608Z The database cluster will be initialized with locale "en_US.utf8". 2020-07-02T12:54:47.013261425Z The default database encoding has accordingly been set to "UTF8". 2020-07-02T12:54:47.013281815Z The default text search configuration will be set to "english". 2020-07-02T12:54:47.013293326Z 2020-07-02T12:54:47.013303793Z Data page checksums are disabled. 2020-07-02T12:54:47.013313919Z 2020-07-02T12:54:47.013450079Z initdb: error: directory "/var/lib/postgresql/data" exists but is not empty 2020-07-02T12:54:47.013487706Z If you want to create a new database system, either remove or empty 2020-07-02T12:54:47.013501126Z the directory "/var/lib/postgresql/data" or run initdb 2020-07-02T12:54:47.013512379Z with an argument other than "/var/lib/postgresql/data".

I know someone solved the problem by upgrading the docker. But I can not do it. Can anyone help me?

wy65701436 commented 3 years ago

what's the harbor version? did you upgrade harbor recently?

Can you show the output of ls -la /data/database?

hanzhc commented 3 years ago

I installed the version 2.3.1 without upgrading. The result of the command that ls -la /data/database is below: IMG_5743

hanzhc commented 3 years ago

what's the harbor version? did you upgrade harbor recently?

Can you show the output of ls -la /data/database?

I installed the version 2.3.1 without upgrading. The result of the command that ls -la /data/database is below:

IMG_5743

wy65701436 commented 3 years ago

did you install Harbor recently? The log you attached is about 2020-07-02, is that correct? And what's the host os?

hanzhc commented 3 years ago

did you install Harbor recently? The log you attached is about 2020-07-02, is that correct? And what's the host os?

Yes ,It was recently installed. As for the time you mentioned,it is the fault of wrong server time. You can ignore it. I used redhat7.6.

wy65701436 commented 3 years ago

we found there may be a directory(/data/database) permission issue on centos, but not sure it's the same at redhat 7.6. See https://github.com/goharbor/harbor/issues/15464#issuecomment-909909558

Can you just provide the increamental log of postgres.log when to down & up Harbor? That's helpful for me to have a debug.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jinxbinder commented 2 years ago

我也遇到了这个问题 版本信息: docker-20.10.3 docker-compose 1.18.0 harbor: 2.5.1 我将harbor版本降低到2.1.6后解决,其他版本我没有进行尝试

github-actions[bot] commented 2 years ago

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.