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

Commissioning the HBase Phoenix Sample Program

Updated on 2024-12-10 GMT+08:00

HBase allows users to access HBase services by invoking JDBC interfaces through Phoenix. Commission the HBase Phoenix sample program. By default, the HBase has been connected to the Phoenix service in the cluster. For details about the connection procedure, see Configuring Phoenix for HBase.

Running and Commissioning Applications on Windows

  1. For details about how to set up the Windows development environment and modify the public configuration of the sample program, see 1 to 3.
  2. Modify the sample project.

    1. Modify the jaas.conf file in the src/main/resources directory of the sample project, where the keyTab and principal parameter correspond to the path for storing user authentication credentials and the username, respectively. Skip this step for a cluster with Kerberos authentication disabled.
    Client {
      com.sun.security.auth.module.Krb5LoginModule required
      useKeyTab=true
      keyTab="D:\\sample_project\\src\\hbase-examples\\hbase-java-examples\\src\\main\\resources\\user.keytab"
      principal="hbaseuser"
      useTicketCache=false
      storeKey=true
      debug=true;
    };
    2. Modify the hbaseclient.properties file in the src/main/resources directory of the sample project. user.name, userKeytabName, and krb5ConfName indicate the username created in and the file names obtained in Preparing an HBase Application Development User. Skip this step for a cluster with Kerberos authentication disabled.
    user.name=hbaseuser
    userKeytabName=user.keytab
    krb5ConfName=krb5.conf
    #for phoenix
    #confiugration for security cluster.
    jaasConfName=jaas.conf

  3. In a development environment (for example, Eclipse), right-click PhoenixExample and choose Run > PhoenixExample.main() to run the application project.

    NOTE:

    If error message "Message stream modified (41)" is displayed, the JDK version may be incorrect. Change the JDK version in the sample code to a version earlier than 8u_242 or delete the renew_lifetime = 0m configuration item from the krb5.conf configuration file.

  4. After the HBase application is run, you can check the application running status by viewing the running result.

    If the following information is displayed, the application runs successfully.

    2020-03-13 14:54:13,369 INFO  [main] client.HBaseAdmin: Operation: CREATE, Table Name: default:TEST, procId: 60 completed
    2020-03-13 14:54:14,269 INFO  [main] examples.PhoenixExample: 1
    2020-03-13 14:54:14,270 INFO  [main] examples.PhoenixExample: John
    2020-03-13 14:54:14,270 INFO  [main] examples.PhoenixExample: 100000
    2020-03-13 14:54:14,271 INFO  [main] examples.PhoenixExample: 1980-01-01
    2020-03-13 14:54:14,464 INFO  [main] client.HBaseAdmin: Started disable of TEST
    2020-03-13 14:54:15,199 INFO  [main] client.HBaseAdmin: Operation: DISABLE, Table Name: default:TEST, procId: 62 completed
    2020-03-13 14:54:15,521 INFO  [main] client.HBaseAdmin: Operation: DELETE, Table Name: default:TEST, procId: 64 completed

Commissioning Phoenix on Linux

To commission Phoenix in a Linux environment, an ECS that can communicate with the cluster network must be available. For details, see Preparing a Local Application Development Environment.

  1. Modify the sample. Change the value of enablePhoenix in the sample code TestMain to true to enable the Phoenix sample program interface.

    /**
     * Phoenix Example
     * if you would like to operate hbase by SQL, please enable it,
     * and you can reference the url ("https://support.huaweicloud.com/devg-mrs/mrs_06_0041.html").
     * step:
     * 1.login
     * 2.operate hbase by phoenix.
     */
    boolean enablePhoenix = false;
    if (enablePhoenix) {
      PhoenixExample phoenixExample;
      try {
        phoenixExample = new PhoenixExample(conf);
        phoenixExample.testSQL();
      } catch (Exception e) {
        LOG.error("Failed to run Phoenix Example, because ", e);
      }
    }

  2. Run the mvn package command to generate a JAR file, for example, hbase-examples-mrs-2.0.jar. Obtain the JAR file from the target directory in the project directory, and upload it to the /opt/client/Hbase/hbase/lib directory.
  3. Run the JAR file.

    1. Before running the JAR file on the Linux client, run the following command to switch to the client directory as the user that is used for installation:

      cd $BIGDATA_CLIENT_HOME/HBase/hbase

      NOTE:

      $BIGDATA_CLIENT_HOME indicates the client installation directory.

    2. Run the following command:

      source $BIGDATA_CLIENT_HOME/bigdata_env

    3. Copy the phoenix-hbase, phoenix-core, and htrace-core-3.1.0-incubating.jar packages obtained after decompressing HBase Phoenix APIs to the /opt/client/HBase/hbase/lib directory.
    4. Copy the JAR package generated in 2 and the krb5.conf and user.keytab files obtained in Preparing an HBase Application Development User to the HBase/hbase/conf directory in the client running environment, for example, /opt/client/HBase/hbase/conf. Create the hbaseclient.properties file in the /opt/client/HBase/hbase/conf directory. In the file, user.name corresponds to the new user hbaseuser, and the values of userKeytabName and krb5ConfName correspond to the authentication-related file names obtained in Preparing an HBase Application Development User (skip this step if Kerberos authentication is not enabled for the cluster).
      user.name=hbaseuser
      userKeytabName=user.keytab
      krb5ConfName=krb5.conf

  4. Execute the JAR file program.

    hbase com.huawei.bigdata.hbase.examples.TestMain /opt/client/HBase/hbase/conf

    com.huawei.bigdata.hbase.examples.TestMain is used as an example. Use the actual code instead.

    /opt/client/HBase/hbase/conf corresponds to the path of files such as user.keytab and krb5.conf mentioned above.

    NOTE:

    If error message "Message stream modified (41)" is displayed, the JDK version may be incorrect. Change the JDK version in the sample code to a version earlier than 8u_242 or delete the renew_lifetime = 0m configuration item from the krb5.conf configuration file.

  5. After the Phoenix application is run, you can check the application running status by viewing the running result.

    2020-03-14 16:20:40,192 INFO  [main] client.HBaseAdmin: Operation: CREATE, Table Name: default:TEST, procId: 923 completed
    2020-03-14 16:20:40,806 INFO  [main] examples.PhoenixExample: 1
    2020-03-14 16:20:40,807 INFO  [main] examples.PhoenixExample: John
    2020-03-14 16:20:40,807 INFO  [main] examples.PhoenixExample: 100000
    2020-03-14 16:20:40,807 INFO  [main] examples.PhoenixExample: 1980-01-01
    2020-03-14 16:20:40,830 INFO  [main] client.HBaseAdmin: Started disable of TEST
    2020-03-14 16:20:41,574 INFO  [main] client.HBaseAdmin: Operation: DISABLE, Table Name: default:TEST, procId: 925 completed
    2020-03-14 16:20:41,831 INFO  [main] client.HBaseAdmin: Operation: DELETE, Table Name: default:TEST, procId: 927 completed

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