Apache Slider + Storm

本文档详细介绍了如何在集群环境中部署ApacheSlider和ApacheStorm,包括环境搭建、配置文件调整、应用启动与管理等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#Apache Slider + Storm

##系统环境

安装如下组件,部署可用环境

Apache storm配置相关目录及环境变量,不启动服务,主要作用为client连接slider storm需要使用

Apache Slider部署参照Apache Slider编译安装

##Storm App Package编译

###下载Strom可执行包 下载软件包apache-storm-0.9.4.tar.gz至/home/hadoop/Downloads目录下。

cd /home/hadoop/Downloads
ls apache-storm-0.9.4.tar.gz

###编译环境

Slider编译环境参照Apache Slider编译安装

Storm Slider编译命令

mvn clean package -DskipTests -Pstorm-app-package -Dpkg.version=0.9.4 -Dpkg.name=apache-storm-0.9.4.tar.gz -Dpkg.src=/home/hadoop/Downloads

生成Slider-storm-app-package-${version}.zip。

${BUILD_DIR}/apache-slider-0.91.0-incubating/app-packages/storm/target/slider-storm-app-package-0.9.4.zip

##创建package 创建package

slider package --install --name STORM --package slider-storm-app-package-0.9.4.zip

查看package是否已经上传

hadoop fs -ls /user/hadoop/.slider/package/STORM/slider-storm-app-package-0.9.4.zip

替换新的package

slider package --install  --name STORM --package slider-storm-app-package-0.9.4.zip --relpacepkg

删除package

slider package --delete --name STORM 

##创建slider app ###slider app配置文件 需要配置如下两个配置文件

${BUILD_DIR}/apache-slider-0.91.0-incubating1/app-packages/storm/appConfig-default.json
${BUILD_DIR}/apache-slider-0.91.0-incubating1/app-packages/storm/resources-default.json

拷贝以供修改使用

cd ${BUILD_DIR}/apache-slider-0.91.0-incubating1/app-packages/storm
cp appConfig-default.json appConfig.json
cp resources-default.json resources.json

####appConfig.json appConfig.json配置为Hbase相关服务的参数配置,可以理解为通过此文件生成服务启动时的hbase-site.xml和hbase-env.sh

#####默认配置如下

{
  "schema": "http://example.org/specification/v2.0.0",
  "metadata": {
  },
  "global": {
    "application.def": ".slider/package/STORM/slider-storm-app-package-${pkg.version}.zip",
    "java_home": "/usr/jdk64/jdk1.7.0_67",
    "create.default.zookeeper.node": "true",

    "site.global.app_user": "${USER_NAME}",
    "site.global.app_version": "${storm.version}",
    "site.global.app_root": "${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.version}",
    "site.global.user_group": "hadoop",

    "site.global.metric_collector_host": "${NN_HOST}",
    "site.global.metric_collector_port": "6188",
    "site.global.metric_collector_lib": "",

    "site.storm-site.metrics.reporter.register" : "org.apache.hadoop.metrics2.sink.storm.StormTimelineMetricsReporter",
    "site.storm-site.storm.log.dir" : "${AGENT_LOG_ROOT}",
    "site.storm-site.storm.zookeeper.servers": "['${ZK_HOST}']",
    "site.storm-site.nimbus.thrift.port": "${NIMBUS.ALLOCATED_PORT}",
    "site.storm-site.storm.local.dir": "${AGENT_WORK_ROOT}/app/tmp/storm",
    "site.storm-site.transactional.zookeeper.root": "/transactional",
    "site.storm-site.storm.zookeeper.port": "2181",
    "site.storm-site.nimbus.childopts": "-Xmx1024m -javaagent:${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/lib/jmxetric-1.0.4.jar=host=${@//site/global/metric_collector_host},port=${@//site/global/metric    _collector_port},wireformat31x=true,mode=multicast,config=${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/conf/jmxetric-conf.xml,process=Nimbus_JVM",
    "site.storm-site.supervisor.childopts": "-Xmx256m -javaagent:${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/lib/jmxetric-1.0.4.jar=host=${@//site/global/metric_collector_host},port=${@//site/global/metric    _collector_port},wireformat31x=true,mode=multicast,config=${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/conf/jmxetric-conf.xml,process=Supervisor_JVM",
    "site.storm-site.ui.childopts": "-Xmx768m",
    "site.storm-site.worker.childopts": "-Xmx768m -javaagent:${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/lib/jmxetric-1.0.4.jar=host=${@//site/global/metric_collector_host},port=${@//site/global/metric    _collector_port},wireformat31x=true,mode=multicast,config=${AGENT_WORK_ROOT}/app/install/apache-storm-${storm.    version}/external/storm-jmxetric/conf/jmxetric-conf.xml,process=Worker_%ID%_JVM",
    "site.storm-site.dev.zookeeper.path": "${AGENT_WORK_ROOT}/app/tmp/dev-storm-zookeeper",
    "site.storm-site.drpc.invocations.port": "0",
    "site.storm-site.storm.zookeeper.root": "${DEFAULT_ZK_PATH}",
    "site.storm-site.transactional.zookeeper.port": "null",
    "site.storm-site.nimbus.host": "${NIMBUS_HOST}",
    "site.storm-site.ui.port": "${STORM_UI_SERVER.ALLOCATED_PORT}",
    "site.storm-site.supervisor.slots.ports": "[${SUPERVISOR.ALLOCATED_PORT}{PER_CONTAINER},${SUPERVISOR.    ALLOCATED_PORT}{PER_CONTAINER}]",
    "site.storm-site.drpc.port": "0",
    "site.storm-site.logviewer.port": "${SUPERVISOR.ALLOCATED_PORT}{PER_CONTAINER}"
  },
  "components": {
    "slider-appmaster": {
      "jvm.heapsize": "256M"
    }
  }
}

#####根据测试集群调整配置如下

{
  "schema": "http://example.org/specification/v2.0.0",
  "metadata": {
  },
  "global": {
    "application.def": ".slider/package/STORM/slider-storm-app-package-0.9.4.zip",
    "java_home": "/opt/beh/core/jdk",
    "create.default.zookeeper.node": "true",

    "site.global.app_user": "${USER_NAME}",
    "site.global.app_version": "0.9.4",
    "site.global.app_root": "${AGENT_WORK_ROOT}/app/install/apache-storm-0.9.4",
    "site.global.user_group": "hadoop",

    "site.global.metric_collector_host": "${NN_HOST}",
    "site.global.metric_collector_port": "6188",
    "site.global.metric_collector_lib": "",

    "site.storm-site.metrics.reporter.register" : "org.apache.hadoop.metrics2.sink.storm.StormTimelineMetricsReporter",
    "site.storm-site.storm.log.dir" : "${AGENT_LOG_ROOT}",
    "site.storm-site.storm.zookeeper.servers": "[breath]",
    "site.storm-site.nimbus.thrift.port": "${NIMBUS.ALLOCATED_PORT}",
    "site.storm-site.storm.local.dir": "${AGENT_WORK_ROOT}/app/tmp/storm",
    "site.storm-site.transactional.zookeeper.root": "/transactional",
    "site.storm-site.storm.zookeeper.port": "2181",
    "site.storm-site.nimbus.childopts": "-Xmx1024m ",
    "site.storm-site.supervisor.childopts": "-Xmx256m",
    "site.storm-site.ui.childopts": "-Xmx768m",
    "site.storm-site.worker.childopts": "-Xmx768m",
    "site.storm-site.dev.zookeeper.path": "${AGENT_WORK_ROOT}/app/tmp/dev-storm-zookeeper",
    "site.storm-site.drpc.invocations.port": "0",
    "site.storm-site.storm.zookeeper.root": "${DEFAULT_ZK_PATH}",
    "site.storm-site.transactional.zookeeper.port": "null",
    "site.storm-site.nimbus.host": "${NIMBUS_HOST}",
    "site.storm-site.ui.port": "${STORM_UI_SERVER.ALLOCATED_PORT}",
    "site.storm-site.supervisor.slots.ports": "[${SUPERVISOR.ALLOCATED_PORT}{PER_CONTAINER},${SUPERVISOR.    ALLOCATED_PORT}{PER_CONTAINER}]",
    "site.storm-site.drpc.port": "0",
    "site.storm-site.logviewer.port": "${SUPERVISOR.ALLOCATED_PORT}{PER_CONTAINER}"
  },
  "components": {
    "slider-appmaster": {
      "jvm.heapsize": "256M"
    }
  }
}

其中测试时如下几项修改比较重要:

  • JAVA_HOME
    "java_home": "/opt/beh/core/jdk",

  • Zookeeper集群主机列表,主机名逗号隔开
    "site.storm-site.storm.zookeeper.servers": "[breath]",

  • 在JVM参数中移除了jmxetric的相关参数,只为测试使用 "site.storm-site.nimbus.childopts" "site.storm-site.supervisor.childopts" "site.storm-site.worker.childopts"

####resource.json resource.json的配置主要是设置Storm中不同服务启动时的container相关参数

#####默认配置如下

  {
  "schema" : "http://example.org/specification/v2.0.0",
  "metadata" : {
  },
  "global" : {
    "yarn.log.include.patterns": "",
    "yarn.log.exclude.patterns": ""
  },
  "components": {
    "slider-appmaster": {
      "yarn.memory": "512"
    },
    "NIMBUS": {
      "yarn.role.priority": "1",
      "yarn.component.instances": "1",
      "yarn.memory": "2048"
    },
    "STORM_UI_SERVER": {
      "yarn.role.priority": "2",
      "yarn.component.instances": "1",
      "yarn.memory": "1278"
    },
    "DRPC_SERVER": {
      "yarn.role.priority": "3",
      "yarn.component.instances": "1",
      "yarn.memory": "1278"
    },
    "SUPERVISOR": {
      "yarn.role.priority": "4",
      "yarn.component.instances": "1",
      "yarn.memory": "3072"
    }
  }
}  

###通过slider启动storm 此处cl1为为启动的slider-storm的一个实例名称。后文用${slider_application_name}表示

  • 创建

slider create cl1 --template appConfig.json --resources resources.json

2016-10-21 16:56:05,292 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/172.16.13.69:23140
2016-10-21 16:56:06,516 [main] INFO  zk.BlockingZKWatcher - waiting for ZK event
2016-10-21 16:56:06,614 [main-EventThread] INFO  zk.BlockingZKWatcher - ZK binding callback received
2016-10-21 16:56:07,098 [main] INFO  agent.AgentClientProvider - Validating app definition .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:56:07,100 [main] INFO  agent.AgentUtils - Reading metainfo at .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:56:07,409 [main] WARN  hdfs.DFSClient - DFSInputStream has been closed already
2016-10-21 16:56:07,409 [main] INFO  agent.AgentUtils - Got metainfo from summary file
2016-10-21 16:56:07,903 [main] INFO  client.SliderClient - No credentials requested
2016-10-21 16:56:08,094 [main] INFO  agent.AgentUtils - Reading metainfo at .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:56:08,113 [main] WARN  hdfs.DFSClient - DFSInputStream has been closed already
2016-10-21 16:56:08,114 [main] INFO  agent.AgentUtils - Got metainfo from summary file
2016-10-21 16:56:08,155 [main] INFO  launch.AbstractLauncher - Setting yarn.resourcemanager.am.retry-count-window-ms to 300000
2016-10-21 16:56:08,155 [main] INFO  launch.AbstractLauncher - Log include patterns: 
2016-10-21 16:56:08,155 [main] INFO  launch.AbstractLauncher - Log exclude patterns: 
2016-10-21 16:56:08,155 [main] INFO  launch.AbstractLauncher - Modified log include patterns: .*
2016-10-21 16:56:08,155 [main] INFO  launch.AbstractLauncher - Modified log exclude patterns: 
2016-10-21 16:56:08,892 [main] INFO  slideram.SliderAMClientProvider - Loading all dependencies for AM.
2016-10-21 16:56:08,905 [main] INFO  tools.SliderUtils - Loading all dependencies from /opt/beh/core/slider-0.91.0-incubating/lib
2016-10-21 16:56:12,171 [main] INFO  agent.AgentClientProvider - Automatically uploading the agent tarball at hdfs://breath:9000/user/hadoop/.slider/cluster/storm2/tmp/application_1476173557981_0003/agent
2016-10-21 16:56:12,216 [main] INFO  agent.AgentClientProvider - Validating app definition .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:56:12,224 [main] INFO  tools.SliderUtils - For faster submission of apps, upload dependencies using cmd dependency --upload
2016-10-21 16:56:12,231 [main] INFO  client.SliderClient - Submitting application application_1476173557981_0003
2016-10-21 16:56:12,234 [main] INFO  launch.AppMasterLauncher - Submitting application to Resource Manager
2016-10-21 16:56:12,265 [main] INFO  impl.YarnClientImpl - Submitted application application_1476173557981_0003
2016-10-21 16:56:12,268 [main] INFO  util.ExitUtil - Exiting with status 0
  • 启动

slider start cl1

2016-10-21 16:57:54,576 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/172.16.13.69:23140
2016-10-21 16:57:56,374 [main] INFO  agent.AgentUtils - Reading metainfo at .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:57:56,642 [main] WARN  hdfs.DFSClient - DFSInputStream has been closed already
2016-10-21 16:57:56,642 [main] INFO  agent.AgentUtils - Got metainfo from summary file
2016-10-21 16:57:56,717 [main] INFO  launch.AbstractLauncher - Setting yarn.resourcemanager.am.retry-count-window-ms to 300000
2016-10-21 16:57:56,717 [main] INFO  launch.AbstractLauncher - Log include patterns: 
2016-10-21 16:57:56,717 [main] INFO  launch.AbstractLauncher - Log exclude patterns: 
2016-10-21 16:57:56,717 [main] INFO  launch.AbstractLauncher - Modified log include patterns: .*
2016-10-21 16:57:56,717 [main] INFO  launch.AbstractLauncher - Modified log exclude patterns: 
2016-10-21 16:57:57,517 [main] INFO  slideram.SliderAMClientProvider - Loading all dependencies for AM.
2016-10-21 16:57:57,540 [main] INFO  tools.SliderUtils - Loading all dependencies from /opt/beh/core/slider-0.91.0-incubating/lib
2016-10-21 16:58:00,721 [main] INFO  agent.AgentClientProvider - Automatically uploading the agent tarball at hdfs://breath:9000/user/hadoop/.slider/cluster/storm2/tmp/application_1476173557981_0004/agent
2016-10-21 16:58:00,765 [main] INFO  agent.AgentClientProvider - Validating app definition .slider/package/STORM/slider-storm-app-package-0.9.4.zip
2016-10-21 16:58:00,784 [main] INFO  tools.SliderUtils - For faster submission of apps, upload dependencies using cmd dependency --upload
2016-10-21 16:58:00,790 [main] INFO  client.SliderClient - Submitting application application_1476173557981_0004
2016-10-21 16:58:00,793 [main] INFO  launch.AppMasterLauncher - Submitting application to Resource Manager
2016-10-21 16:58:01,030 [main] INFO  impl.YarnClientImpl - Submitted application application_1476173557981_0004
2016-10-21 16:58:01,033 [main] INFO  util.ExitUtil - Exiting with status 0
  • 关闭

slider stop cl1

2016-10-21 16:57:38,433 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/172.16.13.69:23140
2016-10-21 16:57:40,596 [main] INFO  util.ExitUtil - Exiting with status 0
  • 摧毁

slider destroy --force cl1

###通过YARN WEB端页面查看应用是否正常启动

Yarn中的Application

Storm的服务分布

配置Url

Storm集群的web访问url

Storm的web访问页面

###登录Slider Storm ####客户端程序 解压slider-storm-app-package-0.9.4.zip包含两个python脚本,可以将这两个脚本放置在$STORM_HOME/bin或者$SLIDER_HOME/bin

storm-slider.py
storm-slider

#####storm-slider测试

编译Storm自带的测试样例:${STORM_HOME}/examples/storm-starter生成jar包storm-starter-0.9.6-jar-with-dependencies.jar,并进行测试。

[hadoop@breath Documents]storm-slider --app cl1 jar storm-starter-0.9.6-jar-with-dependencies.jar storm.starter.RollingTopWords     production-topology remote
2016-09-21 16:05:36,276 [main] INFO  impl.TimelineClientImpl - Timeline service address: http://breath:8188/ws/v1/timeline/
2016-09-21 16:05:36,788 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/192.168.134.171:23140
2016-09-21 16:05:38,182 [main] INFO  util.ExitUtil - Exiting with status 0
Running: java -client -Dstorm.options=nimbus.host=breath,nimbus.thrift.port=43669,storm.thrift.transport=backtype.storm.security.auth    .SimpleTransportPlugin -Dstorm.home=/opt/beh/core/storm -cp /opt/beh/core/storm/lib/logback-core-1.0.13.    jar:/opt/beh/core/storm/lib/slf4j-api-1.7.5.jar:/opt/beh/core/storm/lib/jgrapht-core-0.9.0.jar:/opt/beh/core/storm/lib/jline-2.11.    jar:/opt/beh/core/storm/lib/reflectasm-1.07-shaded.jar:/opt/beh/core/storm/lib/compojure-1.1.3.jar:/opt/beh/core/storm/lib/core.    incubator-0.1.0.jar:/opt/beh/core/storm/lib/carbonite-1.4.0.jar:/opt/beh/core/storm/lib/commons-fileupload-1.2.1.    jar:/opt/beh/core/storm/lib/minlog-1.2.jar:/opt/beh/core/storm/lib/ring-jetty-adapter-0.3.11.jar:/opt/beh/core/storm/lib/tools.    logging-0.2.3.jar:/opt/beh/core/storm/lib/snakeyaml-1.11.jar:/opt/beh/core/storm/lib/tools.cli-0.2.4.    jar:/opt/beh/core/storm/lib/clojure-1.5.1.jar:/opt/beh/core/storm/lib/clj-time-0.4.1.jar:/opt/beh/core/storm/lib/ring-core-1.1.5.    jar:/opt/beh/core/storm/lib/commons-lang-2.5.jar:/opt/beh/core/storm/lib/commons-exec-1.1.jar:/opt/beh/core/storm/lib/commons-logging    -1.1.3.jar:/opt/beh/core/storm/lib/joda-time-2.0.jar:/opt/beh/core/storm/lib/json-simple-1.1.jar:/opt/beh/core/storm/lib/log4j-over-    slf4j-1.6.6.jar:/opt/beh/core/storm/lib/ring-devel-0.3.11.jar:/opt/beh/core/storm/lib/servlet-api-2.5.    jar:/opt/beh/core/storm/lib/ring-servlet-0.3.11.jar:/opt/beh/core/storm/lib/objenesis-1.2.jar:/opt/beh/core/storm/lib/tools.macro-0.1    .0.jar:/opt/beh/core/storm/lib/logback-classic-1.0.13.jar:/opt/beh/core/storm/lib/disruptor-2.10.1.    jar:/opt/beh/core/storm/lib/commons-codec-1.6.jar:/opt/beh/core/storm/lib/chill-java-0.3.5.jar:/opt/beh/core/storm/lib/asm-4.0.    jar:/opt/beh/core/storm/lib/jetty-util-6.1.26.jar:/opt/beh/core/storm/lib/hiccup-0.3.6.jar:/opt/beh/core/storm/lib/clout-1.0.1.    jar:/opt/beh/core/storm/lib/kryo-2.21.jar:/opt/beh/core/storm/lib/math.numeric-tower-0.0.1.jar:/opt/beh/core/storm/lib/clj-stacktrace    -0.2.2.jar:/opt/beh/core/storm/lib/commons-io-2.4.jar:/opt/beh/core/storm/lib/storm-core-0.9.5.jar:/opt/beh/core/storm/lib/jetty-6.1.    26.jar:storm-starter-0.9.6-jar-with-dependencies.jar:/home/hadoop/.storm:/opt/beh/core/storm/bin -Dstorm.jar=storm-starter-0.9.6-jar-    with-dependencies.jar storm.starter.RollingTopWords production-topology remote
152  [main] INFO  storm.starter.RollingTopWords - Topology name: production-topology
195  [main] INFO  storm.starter.RollingTopWords - Running in remote (cluster) mode
360  [main] INFO  backtype.storm.StormSubmitter - Jar not uploaded to master yet. Submitting jar...
367  [main] INFO  backtype.storm.StormSubmitter - Uploading topology jar storm-starter-0.9.6-jar-with-dependencies.jar to assigned     location: /opt/beh/data/tmp/yarn/local/usercache/hadoop/appcache/application_1474435760880_0009/container_1474435760880_0009_01_00000    2/app/tmp/storm/nimbus/inbox/stormjar-07dea68c-8ae8-4ca3-8cd2-6762b3b17aca.jar
391  [main] INFO  backtype.storm.StormSubmitter - Successfully uploaded topology jar to assigned location: /opt/beh/data/tmp/yarn/loc    al/usercache/hadoop/appcache/application_1474435760880_0009/container_1474435760880_0009_01_000002/app/tmp/storm/nimbus/inbox/stormja    r-07dea68c-8ae8-4ca3-8cd2-6762b3b17aca.jar
391  [main] INFO  backtype.storm.StormSubmitter - Submitting topology production-topology in distributed mode with conf {"nimbus.    host":"breath","storm.thrift.transport":"backtype.storm.security.auth.SimpleTransportPlugin","topology.debug":true,"nimbus.thrift.    port":43669}
568  [main] INFO  backtype.storm.StormSubmitter - Finished submitting topology: production-topolog。

查看storm的WEBUI

输入图片说明

输入图片说明

查看storm-slider集群cl1中运行的topology,可使用如下命令: storm-slider --app cl1 list

[hadoop@breath hadoop]$ storm-slider --app cl1 list
2016-09-21 18:02:57,665 [main] INFO  impl.TimelineClientImpl - Timeline service address: http://breath:8188/ws/v1/timeline/
2016-09-21 18:02:58,260 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/192.168.134.171:23140
2016-09-21 18:02:59,688 [main] INFO  util.ExitUtil - Exiting with status 0
Running: java -client -Dstorm.options=nimbus.host=breath,nimbus.thrift.port=43669,storm.thrift.transport=backtype.storm.security.auth    .SimpleTransportPlugin -Dstorm.home=/opt/beh/core/storm -cp /opt/beh/core/storm/lib/logback-core-1.0.13.    jar:/opt/beh/core/storm/lib/slf4j-api-1.7.5.jar:/opt/beh/core/storm/lib/jgrapht-core-0.9.0.jar:/opt/beh/core/storm/lib/jline-2.11.    jar:/opt/beh/core/storm/lib/reflectasm-1.07-shaded.jar:/opt/beh/core/storm/lib/compojure-1.1.3.jar:/opt/beh/core/storm/lib/core.    incubator-0.1.0.jar:/opt/beh/core/storm/lib/carbonite-1.4.0.jar:/opt/beh/core/storm/lib/commons-fileupload-1.2.1.    jar:/opt/beh/core/storm/lib/minlog-1.2.jar:/opt/beh/core/storm/lib/ring-jetty-adapter-0.3.11.jar:/opt/beh/core/storm/lib/tools.    logging-0.2.3.jar:/opt/beh/core/storm/lib/snakeyaml-1.11.jar:/opt/beh/core/storm/lib/tools.cli-0.2.4.    jar:/opt/beh/core/storm/lib/clojure-1.5.1.jar:/opt/beh/core/storm/lib/clj-time-0.4.1.jar:/opt/beh/core/storm/lib/ring-core-1.1.5.    jar:/opt/beh/core/storm/lib/commons-lang-2.5.jar:/opt/beh/core/storm/lib/commons-exec-1.1.jar:/opt/beh/core/storm/lib/commons-logging    -1.1.3.jar:/opt/beh/core/storm/lib/joda-time-2.0.jar:/opt/beh/core/storm/lib/json-simple-1.1.jar:/opt/beh/core/storm/lib/log4j-over-    slf4j-1.6.6.jar:/opt/beh/core/storm/lib/ring-devel-0.3.11.jar:/opt/beh/core/storm/lib/servlet-api-2.5.    jar:/opt/beh/core/storm/lib/ring-servlet-0.3.11.jar:/opt/beh/core/storm/lib/objenesis-1.2.jar:/opt/beh/core/storm/lib/tools.macro-0.1    .0.jar:/opt/beh/core/storm/lib/logback-classic-1.0.13.jar:/opt/beh/core/storm/lib/disruptor-2.10.1.    jar:/opt/beh/core/storm/lib/commons-codec-1.6.jar:/opt/beh/core/storm/lib/chill-java-0.3.5.jar:/opt/beh/core/storm/lib/asm-4.0.    jar:/opt/beh/core/storm/lib/jetty-util-6.1.26.jar:/opt/beh/core/storm/lib/hiccup-0.3.6.jar:/opt/beh/core/storm/lib/clout-1.0.1.    jar:/opt/beh/core/storm/lib/kryo-2.21.jar:/opt/beh/core/storm/lib/math.numeric-tower-0.0.1.jar:/opt/beh/core/storm/lib/clj-stacktrace    -0.2.2.jar:/opt/beh/core/storm/lib/commons-io-2.4.jar:/opt/beh/core/storm/lib/storm-core-0.9.5.jar:/opt/beh/core/storm/lib/jetty-6.1.    26.jar:/home/hadoop/.storm:/opt/beh/core/storm/bin backtype.storm.command.list
803  [main] INFO  backtype.storm.thrift - Connecting to Nimbus at breath:43669
Topology_name        Status     Num_tasks  Num_workers  Uptime_secs
-------------------------------------------------------------------
production-topology  ACTIVE     15         1            7043      

将storm-slider集群cl1中运行的topology名为production-topology的任务杀死,可使用如下命令: storm-slider --app cl1 kill production-topology

[hadoop@breath hadoop]$ storm-slider --app cl1 kill production-topology
2016-09-21 18:03:32,549 [main] INFO  impl.TimelineClientImpl - Timeline service address: http://breath:8188/ws/v1/timeline/
2016-09-21 18:03:33,052 [main] INFO  client.RMProxy - Connecting to ResourceManager at breath/192.168.134.171:23140
2016-09-21 18:03:34,467 [main] INFO  util.ExitUtil - Exiting with status 0
Running: java -client -Dstorm.options=nimbus.host=breath,nimbus.thrift.port=43669,storm.thrift.transport=backtype.storm.security.auth    .SimpleTransportPlugin -Dstorm.home=/opt/beh/core/storm -cp /opt/beh/core/storm/lib/logback-core-1.0.13.    jar:/opt/beh/core/storm/lib/slf4j-api-1.7.5.jar:/opt/beh/core/storm/lib/jgrapht-core-0.9.0.jar:/opt/beh/core/storm/lib/jline-2.11.    jar:/opt/beh/core/storm/lib/reflectasm-1.07-shaded.jar:/opt/beh/core/storm/lib/compojure-1.1.3.jar:/opt/beh/core/storm/lib/core.    incubator-0.1.0.jar:/opt/beh/core/storm/lib/carbonite-1.4.0.jar:/opt/beh/core/storm/lib/commons-fileupload-1.2.1.    jar:/opt/beh/core/storm/lib/minlog-1.2.jar:/opt/beh/core/storm/lib/ring-jetty-adapter-0.3.11.jar:/opt/beh/core/storm/lib/tools.    logging-0.2.3.jar:/opt/beh/core/storm/lib/snakeyaml-1.11.jar:/opt/beh/core/storm/lib/tools.cli-0.2.4.    jar:/opt/beh/core/storm/lib/clojure-1.5.1.jar:/opt/beh/core/storm/lib/clj-time-0.4.1.jar:/opt/beh/core/storm/lib/ring-core-1.1.5.    jar:/opt/beh/core/storm/lib/commons-lang-2.5.jar:/opt/beh/core/storm/lib/commons-exec-1.1.jar:/opt/beh/core/storm/lib/commons-logging    -1.1.3.jar:/opt/beh/core/storm/lib/joda-time-2.0.jar:/opt/beh/core/storm/lib/json-simple-1.1.jar:/opt/beh/core/storm/lib/log4j-over-    slf4j-1.6.6.jar:/opt/beh/core/storm/lib/ring-devel-0.3.11.jar:/opt/beh/core/storm/lib/servlet-api-2.5.    jar:/opt/beh/core/storm/lib/ring-servlet-0.3.11.jar:/opt/beh/core/storm/lib/objenesis-1.2.jar:/opt/beh/core/storm/lib/tools.macro-0.1    .0.jar:/opt/beh/core/storm/lib/logback-classic-1.0.13.jar:/opt/beh/core/storm/lib/disruptor-2.10.1.    jar:/opt/beh/core/storm/lib/commons-codec-1.6.jar:/opt/beh/core/storm/lib/chill-java-0.3.5.jar:/opt/beh/core/storm/lib/asm-4.0.    jar:/opt/beh/core/storm/lib/jetty-util-6.1.26.jar:/opt/beh/core/storm/lib/hiccup-0.3.6.jar:/opt/beh/core/storm/lib/clout-1.0.1.    jar:/opt/beh/core/storm/lib/kryo-2.21.jar:/opt/beh/core/storm/lib/math.numeric-tower-0.0.1.jar:/opt/beh/core/storm/lib/clj-stacktrace    -0.2.2.jar:/opt/beh/core/storm/lib/commons-io-2.4.jar:/opt/beh/core/storm/lib/storm-core-0.9.5.jar:/opt/beh/core/storm/lib/jetty-6.1.    26.jar:/home/hadoop/.storm:/opt/beh/core/storm/bin backtype.storm.command.kill_topology production-topology
614  [main] INFO  backtype.storm.thrift - Connecting to Nimbus at breath:43669
646  [main] INFO  backtype.storm.command.kill-topology - Killed topology: production-topology

转载于:https://my.oschina.net/yulongblog/blog/749797

<think>嗯,用户想在.NET 8.0 MAUI中实现一个包含垂直Slider、Button、Image和Editor的布局,其中Slider需要竖直放置在最右侧。首先,我需要回忆一下MAUI的布局容器有哪些,常用的有Grid、HorizontalStackLayout和VerticalStackLayout。用户的需求是让Slider竖直放在右侧,这意味着可能需要使用Grid来划分区域,或者结合StackLayout进行嵌套。 接下来,要确定如何竖直放置Slider。MAUISlider默认是水平方向的,所以需要设置Rotation属性来旋转它。比如,旋转270度可以让它变成竖直方向。同时,可能需要调整HeightRequest和WidthRequest以确保旋转后的Slider显示正确。 然后考虑布局结构。主界面可能需要分成左右两部分,右侧是垂直Slider,左侧则是其他控件。使用Grid的话,可以定义两列,右侧一列放置Slider,左侧一列放置其他组件。或者使用HorizontalStackLayout,将左侧的控件放在一个VerticalStackLayout里,右侧单独放Slider。 另外,Image控件需要设置Source,可能需要设置HeightRequest和WidthRequest来控制大小。Editor控件可能需要占据较大的空间,所以可以设置VerticalOptions为FillAndExpand,确保它能够扩展填充剩余区域。 还需要考虑各个控件的排列顺序。比如Button可能在顶部,然后是Image,下方是Editor,而Slider在右侧。这时候使用Grid的话,可以在左列放置VerticalStackLayout包含这三个控件,右列放Slider。同时,要确保Slider竖直对齐,可能需要使用VerticalOptions设置为Fill,并调整边距防止被遮挡。 最后,代码示例需要包含命名空间zxing,但用户的问题中并没有涉及扫码功能,可能引用有误。不过根据用户提供的引用,可能需要检查是否正确引用了必要的命名空间。不过这可能与当前布局问题无关,需要确认是否需要处理。 总结步骤: 1. 使用Grid布局,定义两列,右侧列放置Slider。 2. 旋转Slider为竖直方向,调整其尺寸。 3. 左侧使用VerticalStackLayout排列Button、Image、Editor。 4. 设置各控件的属性,如Source、VerticalOptions等。 5. 测试布局在不同屏幕尺寸下的表现,确保Slider在右侧竖直显示,其他控件排列正确。</think>在 .NET MAUI 中实现垂直 Slider 右侧布局,可以通过以下步骤结合 Grid 和 StackLayout 完成: ```xml <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.Maui.Controls" x:Class="YourNamespace.MainPage"> <Grid ColumnDefinitions="*, 60"> <!-- 右侧保留60单位宽度 --> <!-- 左侧控件组 --> <VerticalStackLayout Grid.Column="0" Spacing="15" Margin="20"> <Button Text="处理图像" HorizontalOptions="Center" Clicked="OnButtonClicked"/> <Image x:Name="previewImage" HeightRequest="200" WidthRequest="300" Source="placeholder.png"/> <Editor x:Name="textEditor" HeightRequest="150" VerticalOptions="FillAndExpand" Placeholder="输入文本..."/> </VerticalStackLayout> <!-- 右侧垂直Slider --> <Slider Grid.Column="1" Minimum="0" Maximum="100" Rotation="270" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="300" WidthRequest="60"/> </Grid> </ContentPage> ``` 关键实现要点: 1. **旋转控制**:通过 `Rotation="270"` 将水平 Slider 转为垂直方向[^1] 2. **布局结构**: - 使用 `Grid` 划分主区域与右侧边栏 - 左侧使用 `VerticalStackLayout` 自然排列控件 - 右侧单独放置旋转后的 Slider 3. **尺寸调整**: - 通过 `HeightRequest="300"` 保持垂直滑动范围 - 设置 `WidthRequest="60"` 防止旋转后控件溢出 4. **定位技巧**: - `VerticalOptions="Center"` 确保垂直居中 - `Margin="20"` 为左侧控件组添加安全边距
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值