启动storm后,如果发现报错如下,或者有类似的错误提示:
Exception in thread "main" expected '<document start>', but found BlockMappingStart in 'reader', line 43, column 1:
说明参数有错误,在配置文件的43行第1列。
原因是因为storm 0.9.3(其他版本或许相同,未做考证)版本中的配置文件,必须以空格开头,即所有配置文件的开头需要是空格。
storm@h1:/opt$ Exception in thread "main" expected '<document start>', but found BlockMappingStart
in 'reader', line 43, column 1:
supervisor.slots.ports:
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:424)
at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:138)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:178)
at backtype.storm.config$read_storm_config.invoke(config.clj:116)
at backtype.storm.command.config_value$_main.invoke(config_value.clj:22)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at backtype.storm.command.config_value.main(Unknown Source)
Exception in thread "main" expected '<document start>', but found BlockMappingStart
in 'reader', line 43, column 1:
supervisor.slots.ports:
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:424)
at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:138)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:178)
at backtype.storm.config$read_storm_config.invoke(config.clj:116)
at backtype.storm.command.config_value$_main.invoke(config_value.clj:22)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at backtype.storm.command.config_value.main(Unknown Source)
在给配置文件加上空格后,问题消失,正常启动,如下:没行参数前都要空出一格。
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########### These MUST be filled in for a storm configuration
storm.zookeeper.servers:
- "h1"
- "h2"
- "h3"
nimbus.host: "h1"
#
#temporary change to 8081
ui.port: 8080
#
#
# ##### These may optionally be filled in:
#
## List of custom serializations
# topology.kryo.register:
# - org.mycompany.MyType
# - org.mycompany.MyType2: org.mycompany.MyType2Serializer
#
## List of custom kryo decorators
# topology.kryo.decorators:
# - org.mycompany.MyDecorator
#
## Locations of the drpc servers
#drpc.servers:
# - "drpc-server"
#supervisor.slots.ports:
# - 6700
# - 6701
# - 6702
# - 6703
## Metrics Consumers
# topology.metrics.consumer.register:
# - class: "backtype.storm.metrics.LoggingMetricsConsumer"
# parallelism.hint: 1
# - class: "org.mycompany.MyMetricsConsumer"
# parallelism.hint: 1
# argument:
# - endpoint: "metrics-collector.mycompany.org"
#storm.local.dir: "/home/storm/storm-0.9.1"
storm.scheduler: "backtype.storm.scheduler.ResaScheduler"
worker.childopts: "-Xmx4096m"
supervisor.heartbeat.frequency.secs: 10
worker.heartbeat.frequency.secs: 5
task.heartbeat.frequency.secs: 5
task.refresh.poll.secs: 3
topology.receiver.buffer.size: 1
topology.max.spout.pending: 200
topology.executor.send.buffer.size: 65536
topology.executor.receive.buffer.size: 65536
worker.cpu.limit: 200