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% 的性能损失。


分享到:


相關文章: