El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Storm-HBase Development Guideline

Updated on 2022-08-16 GMT+08:00

Scenario

This topic applies only to the interaction between Storm and HBase of MRS. Determine the versions of the jar packages described in this chapter based on the actual situation.

Security login modes include ticket login and keytab file login, and the procedures for these two login modes are the same. The ticket login mode is an open-source capability and requires manual ticket uploading to prevent ticket expiration, which may cause reliability and usability problems. Therefore, the keytab file login mode is recommended.

Procedure for Developing an Application

  1. Verify that the Storm and HBase components have been installed and are running properly.
  2. Import storm-examples to the IntelliJ IDEA development environment. For details, see Environment Preparation.
  3. If security services are enabled in the cluster, perform the related configuration based on the login mode.

    • keytab mode: Obtain a Human-Machine user from the administrator for login to the FusionInsight Manager platform and authentication, and obtain the keytab file of the user.
    • Ticket mode: Obtain a Human-Machine user from the administrator for subsequent secure login, enable the renewable and forwardable functions of the Kerberos service, set the ticket update interval, and restart Kerberos and related components.
    NOTE:
    • The obtained user must belong to the storm group.
    • The default validity period of a user password is 90 days. Therefore, the validity period of the obtained keytab file is 90 days. To prolong the validity period of the keytab file, modify the user password policy and obtain the keytab file again.
    • The parameters for enabling the renewable and forwardable functions and setting the ticket update interval are on the System tab of the Kerberos service configuration page. The ticket update interval can be set to kdc_renew_lifetime or kdc_max_renewable_life based on the actual situation.

  4. Download and install the HBase client.
  5. Obtain the related configuration files using the following method.

    Go to the /opt/clientHbase/HBase/hbase/conf directory on the installed HBase client, and obtain configuration files core-site.xml, hdfs-site.xml, and hbase-site.xml.

    In keytab mode, obtain the keytab file by following 3. In ticket mode, no extra configuration file is required.

    NOTE:

    The obtained keytab file is named as user.keytab by default. A user can directory change the file name as required. However, the user must upload the changed file name as a parameter when submitting a task.

  6. Obtain the related JAR packages.

    • Go to the HBase/hbase/lib directory on the installed HBase client, and obtain the following JAR packages:
      • hbase-*.jar
      • hadoop-*.jar
      • jackson-core-asl-<version>.jar
      • jackson-mapper-asl-<version>.jar
      • commons-cli-<version>.jar
      • commons-io-<version>.jar
      • commons-lang-<version>.jar
      • commons-lang3-<version>.jar
      • commons-collections-<version>.jar
      • commons-configuration2-<version>.jar
      • guava-<version>.jar
      • protobuf-java-<version>.jar
      • netty-all-<version>.jar
      • zookeeper-<version>.jar
      • zookeeper-jute-<version>.jar
      • metrics-core-<version>.jar
      • commons-validator-<version>.jar
    • Go to the HBase/hbase/lib/client-facing-thirdparty directory in the HBase client installation directory, and obtain the commons-logging-<version>.jar package.
    • Go to the HBase/hbase/lib/jdbc directory in the HBase client installation directory, and obtain the htrace-core-<version>-incubating.jar package and the htrace-core4-<version>-incubating.jar package.
    • Obtain the following JAR packages from the sample project /src/storm-examples/storm-examples/lib:
      • storm-hdfs-<version>.jar
      • storm-autocreds-<version>.jar

IntelliJ IDEA Code Sample

Create a topology.

 public static void main(String[] args) throws Exception  
     { 
         Config conf = new Config(); 
         //Add the plugin required for kerberos authentication to the list. The security mode is mandatory.
         setSecurityConf(conf,AuthenticationType.KEYTAB);

         if(args.length >= 2) 
         { 
         //The default keytab file name is changed by the user. Specify a new keytab file name as a parameter.
         conf.put(Config.STORM_CLIENT_KEYTAB_FILE, args[1]); 
         } 
         //hbase client configuration. Only ¡°hbase.rootdir¡± configuration item is provided, which is optional. 
         Map<String, Object> hbConf = new HashMap<String, Object>(); 
         if(args.length >= 3) 
         { 
         hbConf.put("hbase.rootdir", args[2]); 
         } 
         //Mandatory parameter. If it is not set, it is left blank. 
         conf.put("hbase.conf", hbConf); 

         //Spout generates a random word. 
         WordSpout spout = new WordSpout(); 
         WordCounter bolt = new WordCounter(); 

         //HbaseMapper, which is used for parsing tuple content.
         SimpleHBaseMapper mapper = new SimpleHBaseMapper() 
                 .withRowKeyField("word") 
                 .withColumnFields(new Fields("word")) 
                 .withCounterFields(new Fields("count")) 
                 .withColumnFamily("cf"); 

         //HBaseBolt, the first parameter is a table name. 
         //withConfigKey("hbase.conf")Transfer the hbase client configuration to HBaseBolt.
         HBaseBolt hbase = new HBaseBolt("WordCount", mapper).withConfigKey("hbase.conf"); 


         // wordSpout ==> countBolt ==> HBaseBolt 
         TopologyBuilder builder = new TopologyBuilder(); 

         builder.setSpout(WORD_SPOUT, spout, 1); 
         builder.setBolt(COUNT_BOLT, bolt, 1).shuffleGrouping(WORD_SPOUT); 
         builder.setBolt(HBASE_BOLT, hbase, 1).fieldsGrouping(COUNT_BOLT, new Fields("word")); 
         //Run a command to submit the topology. 
         StormSubmitter.submitTopology(args[0], conf, builder.createTopology()); 
 }

Running the Application and Viewing Results

  1. Export the local JAR package. For details, see Packaging IntelliJ IDEA Code.
  2. Combine the configuration files and JAR packages obtained respectively in 5 and 6, and export a complete service JAR package. For details, see Packaging Services.
  3. Run a command to submit the topology.

    In keytab mode, if the user changes the keytab file name, for example, huawei.keytab, the changed keytab file name must be added to the command as a parameter for description. The submission command example is as follows (the topology name is hbase-test):

    storm jar /opt/jartarget/source.jar com.huawei.storm.example.hbase.SimpleHBaseTopology hbase-test huawei.keytab

    NOTE:
    • Before submitting source.jar in security mode, ensure that the Kerberos security login is implemented, and the login user and the user of the uploaded keytab file are the same user in keytab mode.
    • HBaseBolt in the preceding example does not provide the function for creating tables. Therefore, you must verify that necessary tables exist in HBase. If the tables do not exist, run the create 'WordCount', 'cf' statement to manually create HBase shell tables.
    • In HBase security mode, a user must have the permission to access related tables, column families, and columns. Therefore, the user must log in to the HBase cluster as an HBase administrator, run the grant command in HBase shell to apply for table access permission, such as WordCount, for the user, and submit the topology as the user.

  4. After the topology is submitted successfully, log in to the HBase cluster to view the topology.
  5. To log in with ticket mode, perform the following operations to regularly upload a ticket. The interval for uploading the ticket depends on the deadline for updating the ticket.

    1. Add the following content to a new line at the end of the Storm/storm-1.2.1/conf/storm.yaml file in the Storm client installation directory:

      topology.auto-credentials:

      - org.apache.storm.security.auth.kerberos.AutoTGT

    2. Run the ./storm upload-credentials hbase-test command.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback