HBase无法给用户赋权,并报错。
问题背景描述:
测试环境,hdfs被format过。很多基于hdfs的环境都受到了影响。hbase也受到了影响。但是hbase在master启动的过程中,只要hdfs上有/hbase目录
建表之后,在赋权的时候,发现有错误
hbase(main):001:0> user_permission
User Namespace,Table,Family,Qualifier:Permission
ERROR: DISABLED: Security features are not available
hbase(main):001:0> grant 'test_user', 'RWXCA' , 'test_table'
ERROR: DISABLED: Security features are not available
Here is some help for this command:
Grant users specific rights.
Syntax : grant <user>, <permissions> [, <@namespace> [, <table> [, <column family> [, <column qualifier>]]]
hbase(main):002:0> hbase:acl
NoMethodError: undefined method `hbase' for #<Object:0x2a37210>
2.以开始以为语法有错误,不会啊,很简单的语法。经过测试几个命令发现,但凡和权限相关的命令,都失败了
百度到一些建议,需要检查参数,在确认下面几个参数都设置正确的情况下,问题依旧
hbase.master.keytab.file
hbase.master.kerberos.principal
hbase.regionserver.keytab.file
hbase.regionserver.kerberos.principal
hbase.coprocessor.master.classes
hbase.coprocessor.region.classes
hbase.security.authorization
3.百度到以下链接,其中有介绍:
参考链接
https://community.hortonworks.com/questions/50984/security-features-not-available-in-hbase-kerberize.html
It seems your hbase:acl table is not created.
can you check hbase-site.xml at master side as well it should have:-
<property>
<name>hbase.coprocessor.master.classes</name>
<value>org.apache.Hadoop.hbase.security.access.AccessController</value>
</property>
try restarting your cluster as postStartMaster step should create this table, once you are able to do scan 'hbase:acl' , you will not see above error "ERROR: DISABLED:Security features are not available"
4.下面这句话,提醒了我,是不是hbase:acl丢失了?
try restarting your cluster as postStartMaster step should create this table, once you are able to do scan 'hbase:acl'
5.一检查,发现真没了
6.正常的情况应该是
7.问题原因找到了,开始找解决办法吧。继续百度(search技术文档,特别怀念google)
如何重建hbase:acl呢?安装过程中hbase并没有任何特殊设置,只要在hdfs上创建一个/hbase目录,启动hbase master就会自动创建需要的文件。为什么重启几次,都没有重新创建这个acl表呢?
查看hbase master log,可以看到错误“The table hbase:acl does not exist in meta but has a znode. run hbck to fix inconsistencies.” 通过命令hbase hbck检查,没有错误。问题也没有解决
2018-02-24 16:41:40,011 INFO [testserver:16000.activeMasterManager] master.HMaster: Master has completed initialization
2018-02-24 16:41:40,016 INFO [testserver:16000.activeMasterManager] quotas.MasterQuotaManager: Quota support disabled
2018-02-24 16:41:40,062 INFO [testserver:16000.activeMasterManager] master.HMaster: Client=null/null create 'hbase:acl', {NAME => 'l', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0', CACHE_DATA_IN_L1 => 'true', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '8192', IN_MEMORY => 'true', BLOCKCACHE => 'true'}
2018-02-24 16:41:40,200 WARN [ProcedureExecutorThread-1] procedure.CreateTableProcedure: The table hbase:acl does not exist in meta but has a znode. run hbck to fix inconsistencies.
2018-02-24 16:41:40,202 ERROR [testserver:16000.activeMasterManager] master.HMaster: Coprocessor postStartMaster() hook failed
org.apache.hadoop.hbase.TableExistsException: hbase:acl
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.prepareCreate(CreateTableProcedure.java:300)
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:107)
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:58)
at org.apache.hadoop.hbase.procedure2.StateMachineProcedure.execute(StateMachineProcedure.java:107)
at org.apache.hadoop.hbase.procedure2.Procedure.doExecute(Procedure.java:427)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execProcedure(ProcedureExecutor.java:999)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execLoop(ProcedureExecutor.java:803)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execLoop(ProcedureExecutor.java:756)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.access$200(ProcedureExecutor.java:75)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor$1.run(ProcedureExecutor.java:441)
2018-02-24 16:41:40,496 INFO [ProcedureExecutorThread-1] procedure2.ProcedureExecutor: Rolledback procedure CreateTableProcedure (table=hbase:acl) id=2 owner=hbase state=ROLLEDBACK exec-time=299msec exception=org.apache.hadoop.hbase.TableExistsException: hbase:acl
2018-02-24 16:46:05,790 INFO [LruBlockCacheStatsExecutor] hfile.LruBlockCache: totalSize=3.24 MB, freeSize=3.08 GB, max=3.08 GB, blockCount=0, accesses=0, hits=0, hitRatio=0, cachingAccesses=0, cachingHits=0, cachingHitsRatio=0,evictions=29, evicted=0, evictedPerRun=0.0
8.上面报错,既然已经明确说znode的问题,我们就去检查zookeeper上的情况吧。
确实看到,前面准备赋权,却失败的信息,记录在znode的acl路径下