2

Is it possible to prioritize which devices are for writes/reads in mdadm RAID1 setup? I'd like to write to both devices for fault tolerance (AWS EBS and local storage SSD), but read mostly from local SSDs to improve latency and avoid excessive AWS I/O fees?

Above setup is for MySQL data. Ideally, queries would be handled by the local SSD serving as cache, but writes would go to both EBS and SSD devices.

Follow up: I found this article http://tansi.info/hybrid/ Does anybody see a problem if HDD was replaced by EBS in above setup?

Answer: the exact setup is described here http://hatim.eu/2014/05/25/leveraging-ssd-ephemeral-disks-in-ec2-part-2/

2
  • Mirroring drives over the WAN with mdadm seems like a recipe for disaster and you'd want to use something like DRBD, GlusterFS, or some other approach to disaster recovery and hot-spares.
    – tgharold
    Jun 9 '16 at 18:09
  • 1. It's not over WAN (EBS is ultra low-latency interlink). 2. What I'm pointing at isn't far off from this setup: tansi.info/hybrid The only difference, AFAIK is I'm going with EBS as opposed to HDD.
    – Slawomir
    Jun 9 '16 at 21:02
3

You can use -W option when creating the array. From the manual:

-W, --write-mostly
              subsequent devices listed in a --build, --create, or --add  com‐
              mand will be flagged as 'write-mostly'.  This is valid for RAID1
              only and means that the 'md'  driver  will  avoid  reading  from
              these devices if at all possible.  This can be useful if mirror‐
              ing over a slow link.

To further optimize your setup, give a look to --write-behind also.

1
  • that's exactly what I have done. Flagging as answered since it's the closest to what I wanted.
    – Slawomir
    Jun 10 '16 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.