Objective:This blog post explains how to resolve the HBase Regions issue where Regions are not assigned to any one/two of Regions Server, though Region Servers are up & running
In HBase, tables are split into regions and are served by the region servers. So all Region Severs will be assigned number of Regions depending upon size of Data available in Hbase. If any unexpected exit/failure at Service/Server level happens the regions normally assigned to other available Region Servers by Hbase Master and once failed Region Server is back online, regions started getting assigned by same Hbase Master.
If Regions have not being assigned or number of online / available regions are zero for any particular Regions Server of Hbase, user(s) will be facing issue/failure at Hbase read/write operations via jobs / application.
From Active Hbase Master Web UI address like:
To fix the issue where Regions are not being assigned or online regions is not visible at Hbase Master Web UI Hbase Master Web UI address like:
1.Login to shell in Hbase Master host using putty/terminal emulator
**sudo rights required, if Kerberos Security have been enabled
2.Authenticate user by generating Kerberos Ticket for Hbase
**Hbase user Kerberos ticket required as below command will be executed in hbase prompt
3.In $hbase shell execute "assign" command.
**Validate from Hbase Master Web UI, Regions will be started assigning for effected Region Server; depending of Data Size "assigning of regions" can take 15 to 30min
**Some cases executing "assign" command don't resolve the Region assigning issue.
4.If 'Step 4' fails, executing "balancer" command in hbase shell will help
5.Execute "hbase hbck" command out side of hbase shell OR "hbck" command inside hbase shell
** "hbase hbck" is a command-line tool that checks for region consistency and table integrity problems and repairs corruption.
6.Repair all inconsistencies and corruption at once, use the "-repair" option, which includes all the region and table consistency options.
Command: $hbase hbck -repair
7.[OPTIONAL STEPS] Some case "-repair" doesn't fix the inconsistency of Regions; hence user should try fixing Regions step by step mention below:
a.-fixAssignments repairs unassigned, incorrectly assigned or multiply assigned regions
Command: $hbase hbck -fixAssignments
b.-fixMeta removes rows from hbase:meta when their corresponding regions are not present in HDFS and adds new meta rows if regions are present in HDFS but not in hbase:meta.
Command: $hbase hbck -fixMeta
c.-repairHoles creates HFiles for new empty regions on the filesystem and ensures that the new regions are consistent.
Command: $hbase hbck -repairHoles
d.-fixHdfsOrphans repairs a region directory that is missing a region metadata file (the .regioninfo file).
Command: $hbase hbck -fixHdfsOrphans
**Regions are closed during repair.
8.Once fixing Hbase Regions have been completed with Step -6,Step -7,Step -8, below checks need to confirm
•Confirm online/available regions have been assigned to all Region Server through Active Hbase Master Web UI
- Confirm "
hbase hbck" from command prompt status replicate "0 inconsistencies detected"