Search code examples
javamultithreadingapacheapache-stormexecutorservice

Running Apache Storm in local mode connection errors


EDIT: So this got "solved" when I increase the sleep time but still get connection/timeout errors

59297 [Thread-14] ERROR o.a.s.d.s.ReadClusterState - Failed to Sync Supervisor

here is my custom topology:

public class MyTopology {
    public static void main(String[] args) {
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("NameSpout", new NameSpout());
        builder.setBolt("NameBolt", new MyBolt()).shuffleGrouping("NameSpout");

        Config config = new Config();
        config.setDebug(true);
        config.setNumWorkers(1);

        LocalCluster cluster = new LocalCluster();

        try {

            cluster.submitTopology("TryingOne", config, builder.createTopology());
            Thread.sleep(10000);
        } catch (Exception e) {
            e.printStackTrace();

        } finally {
            cluster.shutdown();
        }

    }

}

Solution

  • Yes, LocalCluster will take care of it. You shouldn't run your own Zookeeper server when using LocalCluster.

    In order to rule out issues with the environment you're running in, please try checking out and running this topology https://github.com/apache/storm/blob/v1.2.2/examples/storm-starter/src/jvm/org/apache/storm/starter/ExclamationTopology.java.

    If it works, it will be an issue with your project configuration. If not, there's likely an issue with the environment you're in.