postgres 서버가 시작되지 않고 로그가 생성되지 않습니다. 문제를 해결하는 방법은 무엇입니까?

postgres 서버가 시작되지 않고 로그가 생성되지 않습니다. 문제를 해결하는 방법은 무엇입니까?

우분투 12.04 서버에서 postgres 9.3 인스턴스를 시작합니다.

~# service postgresql start 

 * The PostgreSQL server failed to start. Please check the log output.
                                                                     [fail]

시작에 실패했지만 로그가 남지 않습니다. 이 파일은 비어 있습니다.

tail /var/log/postgresql/postgresql-9.3-main.log 

이 디렉토리에는 다른 파일이 없습니다: /var/log/postgresql/

이 문제를 해결하는 가장 좋은 방법은 무엇입니까?

답변1

디버그를 활성화한 상태에서 수동으로 실행해 보세요. 이렇게 하면 포그라운드에서 실행되고 오류 메시지가 표준 오류로 인쇄되는 동시에 자세한 내용도 증가됩니다.

나는 이것이 Ubuntu의 PostgreSQL 9.3에 대한 올바른 명령줄이라고 생각하지만 약간의 조정이 필요할 수 있습니다(참고: 가독성을 위해 줄이 분할되어 있습니다. 원하는 경우 백슬래시 없이 한 줄로 다시 결합할 수 있습니다).

/usr/lib/postgresql/9.3/bin/postgres -d 3 -D /var/lib/postgresql/9.3/main \
   -c config_file=/etc/postgresql/9.3/main/postgresql.conf

시작은 바이너리의 위치입니다 postgres. 그런 다음 디버그를 활성화하고 레벨 3으로 설정합니다(이를 위나 아래로 조정하여 자세한 정도를 높이거나 낮출 수 있습니다). 다음으로 시작할 데이터 디렉터리와 구성 파일을 지정합니다. 내 생각에는 이것이 Ubuntu Server 12.04의 기본값이어야 한다고 생각합니다.

문제가 어디에 있는지 판단하는 데 충분한 정보를 제공할 수 있기를 바랍니다.

답변2

@christopher의 답변을 바탕으로 :

우분투에서 postgres 12를 사용하여 다음을 실행했습니다.

# with my custom data dir:
/usr/lib/postgresql/12/bin/postgres -d 3 -D /media/ssd1/pg_data -c config_file=/etc/postgresql/12/main/postgresql.conf

# with default config:
/usr/lib/postgresql/12/bin/postgres -d 3 -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf

내 경우에는 다음과 같은 문제가 발생했습니다.

2020-06-02 15:27:45.468 GMT [2522] LOG:  skipping missing configuration file "/media/ssd1/pg_data/postgresql.auto.conf"
2020-06-02 17:27:45.469 CEST [2522] FATAL:  data directory "/media/ssd1/pg_data" has wrong ownership
2020-06-02 17:27:45.469 CEST [2522] HINT:  The server must be started by the user that owns the data directory.
2020-06-02 17:27:45.469 CEST [2522] DEBUG:  shmem_exit(1): 0 before_shmem_exit callbacks to make
2020-06-02 17:27:45.469 CEST [2522] DEBUG:  shmem_exit(1): 0 on_shmem_exit callbacks to make
2020-06-02 17:27:45.469 CEST [2522] DEBUG:  proc_exit(1): 0 callbacks to make
2020-06-02 17:27:45.469 CEST [2522] DEBUG:  exit(1)

나는 유용한 정보가 없었고 결과도 나오지 않았습니다 sudo cat /var/log/postgresql/postgresql-12-main.log .sudo systemctl start postgresql

관련 정보