- cluster의 disk 사용량이 39-55%까지 차이남
- rebalancing을 함
- 오차 범위 1%로 리밸런싱 완료
설명
1. cluster의 disk 사용량이 39-55%까지
sudo -u hdfs hdfs balancer
[-policy (policy)]
[-threshold <threshold>]
[-blockpools (comma-separated list of blockpool ids)]
[-include [-f (hosts-file) | (comma-separated list of hosts)]]
[-exclude [-f (hosts-file) | (comma-separated list of hosts)]]
[-idleiterations (idleiterations)]
[-runDuringUpgrade]
2. rebalancing을 함
# 노드간 데이터 차이가 1% 이하가 될 때 까지 밸런싱
hdfs balancer -Ddfs.balancer.max-size-to-move=107374182400 -idleiterations -1 -policy datanode -threshold 1
- 오차 범위 1%
- 1번만 검사
- 최대 밸런싱 이동 사이즈는 100GB
[-threshold <threshold>] | 1.0 ~100.0 사이의 수를 입력하여 어느 정도까지 node 간 balancing을 수행 할 것인지 설정한다. 기본 값은 10.0 으로 각 노드들을 10% 미만으로 차이가 날 때까지 balancing 수행한다. |
[-idleiterations <idleiterations>] | hdfs balacer가 더 이상 balancing할 block이 없을 때까지 반복적으로 balancer를 수행한다. 기본 값은 5인데, 이동할 block이 없더라도 5번의 검사를 진행한다. |
dfs.datanode.balance.bandwidthPerSec 기본값 10485760(10MB)
3. 오차 범위 1%로 리밸런싱 완료
5시간이 걸렸고, 확인은 hdfs ui를 이용했음. 어렸을 때 디스크 조각 모음하는 기분이었음
나는 디스크 간의 밸런싱은 진행하지 않고, 노드간의 밸런싱만 진행했다. 각 차이는 아래와 같음
diskbalancer vs balancer
balancer : 여러 데이터노드 간(inter nodes in multiple datanodes) 데이터 불균형이 일어났을 때 불균형을 해소시켜줌. → 작업 예정
diskbalancer : 하나의 데이터 노드(in a single datanode)에 여러개의 disks 가 있는 경우, disk 간 데이터 불균형이 일어났을 때 불균형을 해소시켜줌.
Diskbalander 공식 문서 : "Diskbalancer is a command line tool that distributes data evenly on all disks of a datanode.
This tool is different from Balancer which takes care of cluster-wide data balancing." "Diskbalancer 는 하나의 데이터 노드의 모든 디스크 상에 있는 데이터를 고르게 분배되도록 만드는 명령어 도구이다.이 툴은 클러스터 상의 데이터를 고르게 분배해주는(클러스터 전체 데이터의 균형을 관리하는) Balancer 와는 다르다."
참고 : https://eyeballs.tistory.com/280
밸런싱 설정
dfs.disk.balancer.enabled | This parameter controls if diskbalancer is enabled for a cluster. if this is not enabled, any execute command will be rejected by the datanode.The default value is false. |
dfs.disk.balancer.max.disk.throughputInMBperSec | This controls the maximum disk bandwidth consumed by diskbalancer while copying data. If a value like 10MB is specified then diskbalancer on the average will only copy 10MB/S. The default value is 10MB/S. |
dfs.disk.balancer.max.disk.errors | sets the value of maximum number of errors we can ignore for a specific move between two disks before it is abandoned. For example, f a plan has 3 pair of disks to copy between , and the first disk set encounters more than 5 errors, then we abandon the first copy and start the second copy in the plan. The default value of max errors is set to 5. |
dfs.disk.balancer.block.tolerance.percent | The tolerance percent specifies when we have reached a good enough value for any copy step. For example, f you specify 10% then getting close to 10% of the target value is good enough. |
dfs.disk.balancer.plan.threshold.percent | The percentage threshold value for volume Data Density in a plan. If the absolute value of volume Data Density which is out of threshold value in a node, it means that the volumes corresponding to the disks should do the balancing in the plan. The default value is 10. |
Property | Default | Background Mode | Fast Mode |
dfs.datanode.balance.max.concurrent.moves | 5 | # of disks | 4 x (# of disks) |
dfs.balancer.moverThreads | 1000 | use default | 20,000 |
dfs.balancer.max-size-to-move | 10737418240(10 GB) | 1073741824 (1GB) | 107374182400 (100 GB) |
dfs.balancer.getBlocks.min-block-size | 10485760 (10 MB) | use default | 104857600 (100 MB) |