nickwallen opened a new pull request #1485: METRON-2219 Remove Legacy HBase 
Client
URL: https://github.com/apache/metron/pull/1485
 
 
   This change upgrades the core Enrichment components to work with HBase 
2.0.2.  This PR is for the `feature/METRON-2088-support-HDP-3.1` feature branch.
   
   This change should be tested in the CentOS 6 dev environment with HDP-2.6.  
These are backwards compatible HBase changes that require additional changes 
before everything can be compiled under HDP-3.1.
   
   ## Changes
   
   1. Updates the `SensorEnrichmentConfigController` to use the HBase 2.0.2 
APIs.  This component is part of the Enrichment Coprocessor mechanism.
   
   1. Updates the `HBaseCacheWriter` to use the HBase 2.0.2 APIs.  This 
component is part of the Enrichment Coprocessor mechanism.
   
   1. Removes the `LegacyHBaseClient` which uses the old, deprecated HBase 
APIs.  This was previously left in-place (in #1456) to allow the code base to 
continue to function as components were upgraded to HBase 2.0.2. 
   
   ```
   $ git diff apache/feature/METRON-2088-support-hdp-3.1 --stat
    
metron-interface/metron-rest/src/main/java/org/apache/metron/rest/config/HBaseConfig.java
                                         |  31 +++++---------
    
metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImpl.java
             |  23 +++++-----
    
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/config/HBaseConfigTest.java
                                     |  22 ++--------
    
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/config/TestConfig.java
                                          |  28 ------------
    
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/SensorEnrichmentConfigControllerIntegrationTest.java
 |  24 +++++++++++
    
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/SensorEnrichmentConfigServiceImplTest.java
         |   9 ++--
    
metron-platform/metron-hbase-server/src/main/java/org/apache/metron/hbase/coprocessor/EnrichmentCoprocessor.java
                  |  26 ++++-------
    
metron-platform/metron-hbase-server/src/main/java/org/apache/metron/hbase/coprocessor/HBaseCacheWriter.java
                       |  51 +++++++++++++++-------
    
metron-platform/metron-hbase/metron-hbase-common/src/main/java/org/apache/metron/hbase/client/LegacyHBaseClient.java
              | 337 
-----------------------------------------------------------------------------------------------------------------------------------------------
    
metron-platform/metron-hbase/metron-hbase-common/src/test/java/org/apache/metron/hbase/client/HBaseClientTest.java
                | 296 
-----------------------------------------------------------------------------------------------------------------------------
    10 files changed, 97 insertions(+), 750 deletions(-)
   ```
   
   ## Acceptance Testing
   
   ### Basics
   
     Verify data is flowing through the system, from parsing to indexing
   
     1. Launch the development environment.
           ```
           cd metron-deployment/development/centos6
           vagrant up
           ```
   
     1. Open Ambari and navigate to the Metron service 
http://node1:8080/#/main/services/METRON/summary
   
     1. Open the Alerts UI
   
     1. Verify alerts show up in the main UI - click the search icon (you may 
need to wait a moment for them to appear)
   
     1. Head back to Ambari and select the Kibana service 
http://node1:8080/#/main/services/KIBANA/summary
   
     1. Open the Kibana dashboard via the "Metron UI" option in the quick links
   
     1. Verify the dashboard is populating
   
   ### Enrichment Coprocessor
   
     1. Run the following command from the CLI - you should see the coprocessor 
in the table attributes. Ambari should set this up as part of the MPack 
installation.
         ```
         $ echo "describe 'enrichment'" | hbase shell
   
         Table enrichment is ENABLED
         enrichment, {TABLE_ATTRIBUTES => {coprocessor$1 => 
'hdfs://node1:8020/apps/metron/coprocessor/metron-hbase-server-0.7.2-uber.jar|org.apache.metron.hbase.
         coprocessor.EnrichmentCoprocessor||zookeeperUrl=node1:2181'}
         COLUMN FAMILIES DESCRIPTION
         {NAME => 't', VERSIONS => '1', EVICT_BLOCKS_ON_CLOSE => 'false', 
NEW_VERSION_BEHAVIOR => 'false', KEEP_DELETED_CELLS => 'FALSE', 
CACHE_DATA_ON_WRITE => '
         false', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS 
=> '0', REPLICATION_SCOPE => '0', BLOOMFILTER => 'ROW', CACHE_INDEX_ON_WRITE => 
'fa
         lse', IN_MEMORY => 'false', CACHE_BLOOMS_ON_WRITE => 'false', 
PREFETCH_BLOCKS_ON_OPEN => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 
'true', BLOCKSIZE
         => '65536'}
         1 row(s)
         Took 5.9128 seconds
         ```
   
     1. Before we start adding enrichments, let's verify the enrichment_list 
table is empty
   
     1. Go to Swagger
   
     1. Click the `sensor-enrichment-config-controller` option.
   
     1. Click the `GET 
/api/v1/sensor/enrichment/config/list/available/enrichments` option.
   
     1. And finally click the "Try it out!" button. You should see an empty 
array returned in the response body.
   
     1. Now, let's perform an enrichment load of some CSV data. We'll do this 
as the metron user
         ```
         su - metron
         source /etc/default/metron
         ```
   
     1. Download the Alexa 1m dataset:
         ```
         wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
         unzip top-1m.csv.zip
         head -10000 top-1m.csv > top-10k.csv
         ```
   
     1. Create an extractor.json for the CSV data by editing `extractor.json` 
and pasting in these contents:
         ```
         {
           "config": {
             "columns": {
               "domain": 1,
               "rank": 0
             },
             "indicator_column": "domain",
             "separator": ",",
             "type": "alexa"
           },
           "extractor": "CSV"
         }
         ```
   
     1. Import the data.
         ```
         $METRON_HOME/bin/flatfile_loader.sh -i /tmp/top-10k.csv -t enrichment 
-c t -e ./extractor.json
         # count data written and verify it's 10k
         echo "count 'enrichment'" | hbase shell
         ```
   
     1. Validate that the data was loaded.  Expect at least 10k records.
         ```
         echo "count 'enrichment'" | hbase shell
         ```
     1. Confirm that the enrichment added in the previous steps were 'found' by 
the coprocessor.
           * Go to Swagger. 
           * Click the `sensor-enrichment-config-controller` option.
           * Click the `GET 
/api/v1/sensor/enrichment/config/list/available/enrichments` option.
   
     1. Click the "Try it out!" button. You should see a array returned with 
the value of each enrichment type that you have loaded.
       ```
       [
         "user"
       ]
       ```
   
   
   ## Pull Request Checklist
   
   - [x] Is there a JIRA ticket associated with this PR? If not one needs to be 
created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
   - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
   - [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
   - [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
   - [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
   - [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
   - [x] Have you written or updated unit tests and or integration tests to 
verify your changes?
   - [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] Have you verified the basic functionality of the build by building and 
running locally with Vagrant full-dev environment or the equivalent?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to