HBase:用於安全操作的客戶端配置

首先,參考以下內容,並確保您的基礎 HDFS 配置是安全的。

較新版本的 Apache HBase(> = 0.92)支持客戶端的可選 SASL 身份驗證。另請參閱 Matteo Bertozzi 關於瞭解 Apache HBase 中的用戶身份驗證和授權的文章。

本小章介紹如何設置 Apache HBase 和客戶端以連接到安全 HBase 資源。

Hadoop 認證配置

要使用強身份驗證運行 HBase RPC,您必須設置hbase.security.authentication為kerberos。在這種情況下,您還必須在 core-site.xml 中設置hadoop.security.authentication為kerberos。否則,您將對 HBase 使用強身份驗證,但不會對基礎 HDFS 使用強身份驗證,否則會取消任何收益。

Kerberos KDC

您需要有一個可用的 Kerberos KDC。

將以下內容添加到每個客戶端上的 hbase-site.xml 文件中:

<code><property>
<name>hbase.security.authentication/<name>
<value>kerberos/<value>
/<property>/<code>

客戶端環境必須通過 kinit 命令從 KDC 或 keytab 登錄到 Kerberos,然後才能與 HBase 群集通信。

請注意,如果客戶端和服務器端站點文件中的 hbase.security.authentication 不匹配,則客戶端將無法與群集進行通信。

一旦將 HBase 配置為安全 RPC,就可以選擇配置加密通信。為此,請將以下內容添加到每個客戶端上的 hbase-site.xml 文件中:

<code><property>
<name>hbase.rpc.protection/<name>
<value>privacy/<value>
/<property>/<code>

此配置屬性也可以在每個連接的基礎上進行設置。將其設置為 Configuration 提供給 Table:

<code>Configuration conf = HBaseConfiguration.create(); 
Connection connection = ConnectionFactory.createConnection(conf);
conf.set("hbase.rpc.protection", "privacy");
try (Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(TableName.valueOf(tablename)))
{
.... do your stuff
}/<code>

對於加密通信,預計會有大約 10% 的性能損失。


分享到:


相關文章: