对Hive连接metastore数据库的密码进行加密处理

默认情况下,Hive连接metastore数据库的用户名和密码都是在hive-site.xml配置文件中明文设置的,存在安全隐患。生产环境中,这样做是不允许的,因此我们可以采用如下对密码进行加密处理的方式。

  1. Original configuration

    javax.jdo.option.ConnectionPassword
    xxxxxx
    password to use against metastore database

  2. Generate a JCEK file
    hadoop credential create javax.jdo.option.ConnectionPassword -provider jceks://file//usr/local/clo/ven/hive/conf/hive.jceks
    Enter password:
    Enter password again:
    javax.jdo.option.ConnectionPassword has been successfully created.
    org.apache.hadoop.security.alias.JavaKeyStoreProvider has been updated.

  3. View the new file
    -rwx------ 1 hbase hbase 522 Jan 30 04:39 hive.jceks

  4. Use the new file
    vi hive-site.xml


hadoop.security.credential.provider.path
jceks://file//usr/local/clo/ven/hive/conf/hive.jceks

  1. Remove the Hive Metastore password entry (javax.jdo.option.ConnectionPassword) from the Hive configuration. The CredentialProvider will be used instead.

  2. Restart Hive Metastore Server

重新启动Hive CLI,正常连接,说明配置成功。

你可能感兴趣的:(大数据)