我在Redhat 7.1上安装了postgresql数据库,并决定将数据库移动到逻辑卷内的ISCSI设备(LUN)上,并安装在机器的起始位置(xfs格式)。 挂载点是/ var / lib / pgsql
在服务器启动时,postgresql.service处于失败状态。
在messages.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.
当我login服务器时,如果它尝试手动启动数据库:systemctl start postgresql – >确定(并且我不丢失任何数据,数据库可用)
我认为这是一个在启动过程中的顺序问题:networking服务必须启动,然后iscsi,然后lvm等…所以我试图强制依赖/usr/lib/systemd/system/postgresql.service添加“后= lvm-pgscan.service iscsi.service“等…但结果是一样的:
failure in starting postgresql systemd: Starting Remote File Systems (Pre) systemd: Reached Remote File Systems (Pre) systemd: mounting /var/lib/pgsql systemd: starting PostgreSQL database server kernel sdb: unknown partition table postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty kernel: xfs (dm-4): Mounting V4 Filesystem postgresql.service: control process exited, code=exited status=1 Failed to start PostgreSQL database server. Unit postgresql.service entered failed state sd 2:0:0:0: [sdb] attached SCSI disk starting LVM2 PV scan on device 8:16 kernel: xfs (dm-3): Ending clean mount systemd: Mounted /var/lib/pgsql Starting Remote File Systems Reached target Remote File Systems
有任何想法吗?
Hej所有,
我已经通过编辑'/usr/lib/systemd/system/postgresql-9.5.service'并添加'After = remote-fs.target'来解决它(RHEL 7.2)
希望这可以帮助。
最好,蒂姆。
要确保在安装iSCSI卷后启动PostgreSQL,请执行以下操作:
cat >/etc/systemd/system/postgresql.service <<EOF .include /lib/systemd/system/postgresql.service [Unit] After=remote-fs.target EOF
这适用于任意服务(MongoDB,MySQL …)和任何types的远程访问(NFS,Samba …)。