问题
I.e. one cluster that has multiple apps and each app has different requirements in terms of where copies are located - can I set it up so to support these multiple apps?
回答1:
Yes, it is possible to do so.
CAUTION: Proceed at your own risk. Writing block placement strategy is extremely complicated and risky. It's seems a code smell that your apps need to determine how replicas are placed. Think about if you really really need to write block placement strategies. Having warned you, proceed if you want to know how to accomplish this. Typically this feature is used to control how well balanced a cluster is. E.g. one of the strategies that was built by one of the Hadoop vendors is to place blocks on the disk with the lowest percentage disk used.
Here's a bunch of resources for you to check out:
- SO post with the same problem: Modifying the block placement strategy of HDFS
- Another SO: how does hdfs choose a datanode to store
- Blog from 2009 when the feature was first released: HDFS block replica placement in your hands now!
来源:https://stackoverflow.com/questions/27992858/can-i-have-different-block-placement-policies-in-hdfs