我在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.当我登录到服务器上时,如果它尝试手动启动数据库: systemctl start postgresql -> OK (而且我没有丢失任何数据,数据库是可用的)
我认为这是启动过程中的一个顺序问题:网络服务必须启动,然后是iscsi,然后是lvm等等.因此,我试图强制依赖/usr/lib/systemd/system/postgresql.service,添加“After=lvm-pgcan.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有什么想法吗?
发布于 2016-05-13 08:39:49
要确保在挂载PostgreSQL卷之后启动iSCSI,请执行以下操作:
cat >/etc/systemd/system/postgresql.service <<EOF
.include /lib/systemd/system/postgresql.service
[Unit]
After=remote-fs.target
EOF这适用于任意服务(MongoDB,MySQL.)任何类型的远程访问(NFS,Samba.)。
发布于 2016-04-25 17:11:39
我在服务器(RHEL7.2)上通过编辑/usr/lib/systemd/system/postgresql-9.5.service和添加After=remote-fs.target来解决这个问题
https://serverfault.com/questions/757892
复制相似问题