![postgresql 시작 실패](https://rvso.com/image/83712/postgresql%20%EC%8B%9C%EC%9E%91%20%EC%8B%A4%ED%8C%A8.png)
저는 Redhat 7.1에 postgresql 데이터베이스를 설치했고, 머신 시작 시 마운트된 논리 볼륨(xfs 형식) 내부의 ISCSI 장치(LUN)에 데이터베이스를 이동하기로 결정했습니다. 마운트 지점은 /var/lib/pgsql입니다.
서버 부팅 시 postgresql.service는 failed 상태입니다.
message.log에서:
systemd: mounting /var/lib/pgsql
starting PostgreSQL database server
kernel sdv: unknown partition table
sd 2:0:0:0: [sdb] attached SCSI disk
xfs (dm-4): Mounting V4 Filesystem
postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty
postgresql.service: control process exited, code=exited status=1
Failed to start PostgreSQL database server.
서버에 로그온했을 때 데이터베이스를 수동으로 시작하려고 하면 : systemctl start postgresql
--> OK(데이터가 손실되지 않으며 데이터베이스를 사용할 수 있습니다)
부팅 과정의 순서 문제인 것 같습니다. 네트워크 서비스를 시작한 다음 iscsi, lvm 등을 시작해야 합니다.
그래서 "After=lvm-pgscan.service iscsi.service" 등을 추가하여 /usr/lib/systemd/system/postgresql.service에 대한 종속성을 강제로 시도했지만 아무것도 변경되지 않았습니다.
어떤 아이디어가 있나요?
답변1
코멘트 문자열에 따르면 상황이 수정된 /usr/lib/systemd/system/postgresql.service
것으로 보입니다. After=local-fs.target
나에게 힌트는 다음과 같은 메시지였습니다.
postgresql-check-db-dir: "/var/lib/pgsql/data"가 없거나 비어 있습니다.
이는 postgres가 /var
마운트되기 전에 시작을 시도했음을 의미합니다. 제한 을 추가하면 after
systemd는 postgres를 시작하기 전에 로컬 파일 시스템이 마운트될 때까지 기다리게 됩니다.