Help Center> MapReduce Service> Component Operation Guide (Normal)> Using Storm> Submitting Storm Topologies on the Client
Updated on 2023-04-10 GMT+08:00

Submitting Storm Topologies on the Client

Scenario

You can submit Storm topologies on the cluster client to continuously process stream data. For clusters with Kerberos authentication enabled, users who submit topologies must be members of the stormadmin or storm group.

Prerequisites

The client has been updated.

Procedure

  1. Prepare the client based on service requirements. Log in to the node where the client is installed.

    Log in to the node where the client is installed based on the client location. For details, see Installing a Client.

  2. Run the following command to set the permissions on the topology JAR file:

    For example, run the following command to change the permissions on /opt/storm/topology.jar:

    chmod 600 /opt/storm/topology.jar

  3. Run the following command to switch to the client directory, for example, /opt/client.

    cd /opt/client

  4. Run the following command to configure environment variables:

    source bigdata_env

  5. If multiple Storm instances are installed, run the following command to load the environment variables of a specific instance when running the Storm command to submit the topology. Otherwise, skip this step. The following command uses the instance Storm-2 as an example.

    source Storm-2/component_env

  6. For clusters with Kerberos authentication enabled, run the following command to authenticate the user. For clusters with Kerberos authentication disabled, skip this step.

    kinit Storm user

  7. For versions earlier than MRS 3.x, run the following command to submit the Storm topology:

    storm jar Path of the topology package Class name of the topology Main method Topology name

    If the following information is displayed, the topology is submitted successfully.

    Finished submitting topology: topo1
    • To support sampling messages, add the topology.debug and topology.eventlogger.executors parameters.
    • Data processing methods vary with topologies. The topology in the example generates characters randomly and separates character strings. To query the processing status, enable the sampling function and perform operations according to Querying Storm Topology Logs.

  8. Run the following command to submit a topology task for MRS 3.x or later:

    storm jar topology-jar-path class input parameter list

    • topology-jar-path indicates the path of the JAR file of the topology.
    • class indicates the class name of the main method used by the topology.
    • Input parameter list includes input parameters of the main method used by the topology.

    For example, run the following command to submit the /opt/storm/topology.jar topology calculated by WordCount and use the topology name as the input parameter:

    storm jar /opt/storm/topology.jar com.huawei.storm.example.WordCountTopology topology1

    If the following information is displayed, the topology is submitted successfully:

    Finished submitting topology: topology1
    • The login authentication user must correspond to the loaded environment variable (component_env). Otherwise, an error occurs when you run the storm command to submit the topology task.
    • After the client environment variable is loaded and the corresponding user login succeeds, the user can run the Storm command on any Storm client to submit the topology task. After the command is executed, the successfully submitted topology is still in the Storm cluster of the user.
    • If the cluster domain name is changed, you need to reset the domain name before submitting the topology. Run the cql statement, for example, set "kerberos.domain.name" = "hadoop.huawei.com".

  9. Run the following command to query Storm topologies. For clusters with Kerberos authentication enabled, only users in the stormadmin or storm group can query all topologies.

    storm list