2014-09-04 4 views
4

저는 현재 토폴로지를 개발하기 위해 Windows 기반 Netbeans에서 작업하고 있습니다. 내가 로컬 모드에서 배포하는 경우 :
LocalCluster cluster = new LocalCluster(); cluster.submitTopology("word-count", conf, builder.createTopology());
모든 것이 잘 작동하지만 내가하려고 할 때 :
StormSubmitter.submitTopology("word", conf, builder.createTopology());
그것은 분명히 클러스터 모드 토폴로지를 배포하려고 내가 폭풍 후광이 실행 해달라고 때문에 실패 내 로컬 컴퓨터. 하나의 Digital Ocean 드롭 릿에서 폭풍이 전개되었지만 현재의 (그리고 편리하지 않은) 해결책은 JAR 파일을 복사하고 storm jar... 명령을 사용하여 배치하는 것입니다.
내 질문 : Netbeans에게 내 후광 IP 주소를 알려주는 방법이 있습니까? 그렇다면 원격으로 배포 할 수 있습니까? (그리고 저에게 시간을 절약하십시오)
미리 감사드립니다!스톰 토폴로지 (원격) 개발 (로컬) 및 배포 방법

+0

내가 시도하고 해결책을 찾기 위해 시간의 몇을 보냈다 : 여기

Map storm_conf = Utils.readStormConfig(); storm_conf.put("nimbus.host", "<Nimbus Machine IP>"); Client client = NimbusClient.getConfiguredClient(storm_conf) .getClient(); String inputJar = "C:\\workspace\\TestStormRunner\\target\\TestStormRunner-0.0.1-SNAPSHOT-jar-with-dependencies.jar"; NimbusClient nimbus = new NimbusClient(storm_conf, "<Nimbus Machine IP>", <Nimbus Machine Port>); // upload topology jar to Cluster using StormSubmitter String uploadedJarLocation = StormSubmitter.submitJar(storm_conf, inputJar); String jsonConf = JSONValue.toJSONString(storm_conf); nimbus.getClient().submitTopology("testtopology", <uploadedJarLocation>, jsonConf, builder.createTopology()); 

은 작업 예입니다. 나는 폭풍우 클라이언트를 로컬로 실행할 수 있고 storm.yaml을 사용하여 제 nimbus IP를 구성하거나 폭풍 항아리'-c ..... '를 사용할 수 있다는 것을 알고 있습니다. submitTopology 동안 전달되는 구성에서 Nimbus를 언급 할 수있는 방법이 있습니까? –

답변

5

Check this link
이제 Netbeans에서 토폴로지를 개발하고 로컬에서 테스트 한 다음 클러스터의 Nimbus에 배포 할 수 있습니다. 이 솔루션은 저에게 큰 도움이됩니다 !!!
파일 conf의 추가 :
또한 conf.put(Config.NIMBUS_HOST, "123.456.789.101); //YOUR NIMBUS'S IP conf.put(Config.NIMBUS_THRIFT_PORT,6627); //int is expected here

다음을 추가 System.setProperty("storm.jar", <path-to-jar>); //link to exact file location (w/ dependencies) 를 다음과 같은 오류 피하기 위해 :
[main] INFO backtype.storm.StormSubmitter - Jar not uploaded to master yet. Submitting jar... Exception in thread "main" java.lang.RuntimeException: Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload.
건배!

1

당신은 conf지도 매개 변수를 사용하여 그 정보를 전달할 수 있습니다 .. 당신은 .. this 페이지를 확인 가능 매개 변수의 목록은 사용자의 요구 사항

에 따라, 값 쌍을 키를 전달할 수 있습니다

2

확실히, 당신의 토폴로지에 당신의 후광 IP를 말할 수 있습니다. 다음은 원격 클러스터에 토폴로지를 제출하는 예제 코드입니다. Submitting a topology to Remote Storm Cluster

+0

그래서이 경우에는 TestStormRunner-0.0.1-SNAPSHOT-jar-with-dependencies.jar에 토폴로지 클래스가없는 스파우트와 볼트를 정의해야합니까? 왜냐하면 주어진 코드 조각에 topologyBuilder가 있습니다. – Humoyun

+0

아니요, StormSubmitter에서 Spout 및 볼트를 설정하지 않았으므로 아니요, TestStormRunner에도 토폴로지 클래스를 추가해야합니다. 대상 토폴로지에서 수행되는 내용 –

+0

아, 이제 내 문제의 이유를 알았으므로 RemoteSubmitter 클래스 (jar 전송 책임)와 topology.jar에서 StormSubmitter.submitTopology (...)를 정의했습니다. 내가 아는 한, Topology.jar에없는 RemoteSubmitter에서 RemoteSubmitter와 topology.jar 및 StormSubmitter.submitTopology (...)에서 setBolt와 setSpout을 정의해야합니다. – Humoyun