1) Install Apache HBase
Download Apache HBase (version 1.2.6 was used for the purposes of this tutorial) and extract it. As stated above, we will set up a standalone version of HBase, which means that HBase itself and Apache Zookeeper run in a single JVM, and data is stored in the local filesystem instead of HDFS. Normally we would authenticate users via Kerberos, but as we are just running HBase in standalone mode, we will focus solely on authorization in this series of tutorials. Start HBase via:
- bin/start-hbase.sh
- bin/hbase shell
- create 'data', 'colfam1', 'colfam2'
- put 'data', 'row1', 'colfam1:col1', 'val1'
- put 'data', 'row1', 'colfam2:col1', 'val2'
- scan 'data'
2) Install the Apache Ranger HBase plugin
Download Apache Ranger and verify that the signature is valid and that the message digests match. Extract and build the source, and copy the resulting plugin to a location where you will configure and install it, e.g.:
- mvn clean package assembly:assembly -DskipTests
- tar zxvf target/ranger-1.0.0-SNAPSHOT-hbase-plugin.tar.gz
- mv ranger-1.0.0-SNAPSHOT-hbase-plugin ${ranger.hbase.home}
- POLICY_MGR_URL: Set this to "http://localhost:6080"
- REPOSITORY_NAME: Set this to "cl1_hbase".
- COMPONENT_INSTALL_DIR_NAME: The location of your Apache HBase installation
3) Configure authorization policies in the Apache Ranger Admin UI
The next step is to create some authorization policies for Apache HBase in the Apache Ranger admin service. Please refer to this blog post for information on how to install the Apache Ranger admin service. Assuming the admin service is already installed, start it via "sudo ranger-admin start". Open a browser and log on to "localhost:6080" with the credentials "admin/admin".
Create a new HBase service, adding the following configuration items to the default values:
- Service Name: cl1_hbase
- Username/Password: admin
- hbase.zookeeper.quorum: localhost
Now we will add a new authorization policy to test access to HBase. Under "Settings + Users/Groups" add two new users called "alice" and "bob", and also create these new users in your local system. Now we can create a new authorization policy to grant "alice" the "Read" permission for the "data" table (all column families and columns).
4) Testing authorization in HBase
The policy we have created above will get downloaded and enforced by the Ranger HBase plugin we installed into HBase. Restart HBase before proceeding further (if it was running with the Ranger plugin before downloading the policy which granted the user running HBase "admin" privileges, then HBase might not be working properly). Now start the shell as "alice" and try to read the table we created earlier:
- sudo -E -u alice bin/hbase shell
- scan 'data'
- put 'data', 'row1', 'colfam1:col1', 'val3'
It’s been a amazing article. It’s provide lot’s of information, I really enjoyed to read this. thank u so much
ReplyDeletefor your sharing
big data hadoop course in chennai with placement
best institute for big data in chennai
best hadoop training in chennaii