Updated on 2025-04-14 GMT+08:00

Commissioning the HBase Application in the Local Windows Environment

Scenario

After the code development is complete, you can run the application in the Windows development environment.

If the network between the local and the cluster service plane is normal, you can perform the commissioning on the local host.

  • If IBM JDK is used in the Windows development environment, the application cannot be run in the Windows environment.
  • You need to set the mapping between the host names and IP addresses of the access nodes in the hosts file on the local host where the sample code is run. The host names and IP addresses must be mapped one by one.

Commissioning the HBase Application in the Local Windows Environment

  1. Click Reimport All Maven Projects in the Maven window on the right of the IDEA to import the Maven project dependency.

    Figure 1 reimport projects

  2. Compile and run an application.

    Place the configuration file directory and modify the code to match the login user. See Figure 2.

    Figure 2 Directory list of hbase-example to be compiled
    1. Compile an application.
      • Method 1:

        Choose Maven > Sample project name > Lifecycle > clean and double-click clean to run the clean command of Maven.

        Choose Maven > Sample project name > Lifecycle > compile, double click compile to run the compile command of Maven.

        Figure 3 clean and compile tools of Maven
      • Method 2:
        Go to the directory where the pom.xml file is located in the Terminal window in the lower part of the IDEA, and run the mvn clean compile command to compile the pom.xml file.
        Figure 4 Enter mvn clean compile in the IDEA Terminal text box.

        After the compilation is complete, the message "Build Success" is displayed and the target directory is generated.

        Figure 5 Compilation completed
    2. Run the program.

      Right-click the TestMain.java file and choose Run'TestMain.main() from the shortcut menu.

      Figure 6 Run the application.

Viewing Windows Commissioning Results

After an HBase application is run, you can check the running result through one of the following methods:

  • Viewing the IntelliJ IDEA running result.
  • Viewing HBase logs.
  • Logging in to the HBase WebUI, see More Information > External Interfaces > WebUI.
  • Using HBase Shell command, see More Information > External Interfaces > Shell.

The results of each sample program are as follows:

  • The following information is displayed in the running results:
    ...
    2020-09-09 22:11:48,496 INFO  [main] example.TestMain: Entering testCreateTable.
    2020-09-09 22:11:48,894 INFO  [main] example.TestMain: Creating table...
    2020-09-09 22:11:50,545 INFO  [main] example.TestMain: Master: 10-1-131-140,16000,1441784082485
    Number of backup masters: 1
      10-1-131-130,16000,1441784098969
    Number of live region servers: 3
      10-1-131-150,16020,1441784158435
      10-1-131-130,16020,1441784126506
      10-1-131-140,16020,1441784118303
    Number of dead region servers: 0
    Average load: 1.0
    Number of requests: 0
    Number of regions: 3
    Number of regions in transition: 0
    2020-09-09 22:11:50,562 INFO  [main] example.TestMain: Lorg.apache.hadoop.hbase.NamespaceDescriptor;@11c6af6
    2020-09-09 22:11:50,562 INFO  [main] example.TestMain: Table created successfully.
    2020-09-09 22:11:50,563 INFO  [main] example.TestMain: Exiting testCreateTable.
    2020-09-09 22:11:50,563 INFO  [main] example.TestMain: Entering testMultiSplit.
    2020-09-09 22:11:50,630 INFO  [main] example.TestMain: MultiSplit successfully.
    2020-09-09 22:11:50,630 INFO  [main] example.TestMain: Exiting testMultiSplit.
    2020-09-09 22:11:50,630 INFO  [main] example.TestMain: Entering testPut.
    2020-09-09 22:11:51,148 INFO  [main] example.TestMain: Put successfully.
    2020-09-09 22:11:51,148 INFO  [main] example.TestMain: Exiting testPut.
    2020-09-09 22:11:51,148 INFO  [main] example.TestMain: Entering createIndex.
    ...

    In the Windows environment, the following exception occurs but does not affect services.

    java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

  • Log description

    The log level is INFO by default and more detailed information can be viewed by changing the log level (DEBUG, INFO, WARN, ERROR, and FATL). You can modify the log4j.properties file to change log levels, for example:

    hbase.root.logger=INFO,console
    ...
    log4j.logger.org.apache.zookeeper=INFO
    #log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
    log4j.logger.org.apache.hadoop.hbase=INFO
    # Make these two classes DEBUG-level. Make them DEBUG to see more zk debug.
    log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=INFO
    log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher=INFO
    ...