postgresql: Update setup-disks to not use RAID.

Do not RAID the disks together.  This was previously done when they
were spinning media, for reliability; running them on an SSD obviates
this sufficiently.  This means that updating the initramfs is also not
necessary.
This commit is contained in:
Alex Vandiver 2020-05-29 16:12:20 -07:00 committed by Tim Abbott
parent b537563bc1
commit 481613a344
1 changed files with 3 additions and 13 deletions

View File

@ -1,18 +1,11 @@
#!/bin/sh #!/bin/sh
umount /mnt umount /mnt
yes | mdadm --create /dev/md0 --raid-devices=2 --level=1 /dev/xvdb /dev/xvdc
# Add disk to mdadm.conf so it will be enabled on boot
mdadm --examine --scan | sed 's/ metadata=1.2//; s/ name.*//; s|md/0|md0|' >> /etc/mdadm/mdadm.conf
blockdev --setra 4096 /dev/xvdb LOCALDISK=/dev/nvme0n1
blockdev --setra 4096 /dev/xvdc
blockdev --setra 4096 /dev/md0
echo deadline > /sys/block/xvdb/queue/scheduler
echo deadline > /sys/block/xvdc/queue/scheduler
mkfs.xfs /dev/md0 mkfs.xfs $LOCALDISK
echo "/dev/md0 /srv xfs nofail,noatime,barrier 1 1" >> /etc/fstab echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >> /etc/fstab
mount /srv mount /srv
# TODO use systemctl instead of pg_ctlcluster on CentOS # TODO use systemctl instead of pg_ctlcluster on CentOS
@ -30,6 +23,3 @@ pg_ctlcluster 9.5 main start
# Disable /mnt line for /dev/xvdb # Disable /mnt line for /dev/xvdb
umount /mnt umount /mnt
sed -i 's|^/dev/xvdb|#/dev/xvdb|' /etc/fstab sed -i 's|^/dev/xvdb|#/dev/xvdb|' /etc/fstab
# Update the initrd so we can use the new array post-boot
update-initramfs -u