HBase無法給使用者賦權的解決方案

來源:互聯網
上載者:User

HBase無法給使用者賦權的解決方案

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路徑下

hbase zkcli
[zk: 192.168.0.72:2181,192.168.0.73:2181,192.168.0.74:2181(CONNECTED) 3] ls /hbase
[meta-region-server, acl, backup-masters, table, draining, region-in-transition, running, table-lock, balancer, master, tokenauth, namespace, hbaseid, online-snapshot, replication, splitWAL, recovering-regions, rs, flush-table-proc]
[zk: 192.168.0.72:2181,192.168.0.73:2181,192.168.0.74:2181(CONNECTED) 4] ls /hbase/acl
[@test_user]

9.在zk上刪除/hbase的資訊,然後重啟hbase整個叢集,讓hbase自動重建acl表

[zk: 192.168.0.72:2181,192.168.0.73:2181,192.168.0.74:2181(CONNECTED) 6] rmr /hbase
[zk: 192.168.0.72:2181,192.168.0.73:2181,192.168.0.74:2181(CONNECTED) 7] ls /
[alert, kafka-manager-1.3.3.13, rmstore, yarn-leader-election, kafka10-dev2, livy, kafka10, kafka10-dev, dubbo, eos, alert_leader, election, DP, hadoop-ha, zookeeper, leader, user]
[zk: 192.168.0.72:2181,192.168.0.73:2181,192.168.0.74:2181(CONNECTED) 8] [hbase@testserver ~]$ exit

10.可以看到,檔案已經回來了

[hdfs@testserver ~]$ hdfs dfs -ls /hbase/data/hbase
Found 3 items
drwxrwx---  - hbase hadoop          0 2018-02-24 17:00 /hbase/data/hbase/acl
drwxrwx---  - hbase hadoop          0 2018-02-24 16:59 /hbase/data/hbase/meta
drwxrwx---  - hbase hadoop          0 2018-02-24 17:00 /hbase/data/hbase/namespace

11.acl表也可以查看了

hbase(main):004:0> scan 'hbase:acl'
ROW                                                COLUMN+CELL
test_table                                        column=l:hbase, timestamp=1519463374193, value=RWXCA
test_table_01                                      column=l:hbase, timestamp=1519463409831, value=RWXCA
user_01                                          column=l:hbase, timestamp=1519463393177, value=RWXCA
3 row(s) in 0.1600 seconds

遇到問題,在理解整體架構原理的情況下,有目的,有範圍的一步步檢查,終歸是可以解決的。

Ubuntu 14.04下HBase單機和偽分布式模式安裝配置  https://www.bkjia.com/Linux/2017-04/143048.htm
Hadoop+HBase搭建雲端儲存總結 PDF https://www.bkjia.com/Linux/2013-05/83844.htm
Ubuntu Server 14.04 下 Hbase資料庫安裝  https://www.bkjia.com/Linux/2016-05/131499.htm
HBase 結點之間時間不一致造成regionserver啟動失敗 https://www.bkjia.com/Linux/2013-06/86655.htm
深入理解HBase架構原理 https://www.bkjia.com/Linux/2017-01/139173.htm
Hadoop叢集安裝&HBase實驗環境搭建 https://www.bkjia.com/Linux/2013-04/83560.htm
基於Hadoop叢集的HBase叢集的配置 https://www.bkjia.com/Linux/2013-03/80815.htm‘
Hadoop安裝部署筆記之-HBase完全分布模式安裝 https://www.bkjia.com/Linux/2012-12/76947.htm
CentOS 6.4下HBase叢集安裝  https://www.bkjia.com/Linux/2016-11/137303.htm

HBase 的詳細介紹:請點這裡
HBase 的:請點這裡

本文永久更新連結地址:https://www.bkjia.com/Linux/2018-03/151441.htm

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.