当前主要说版本v2.3.0.RELEASE,代码加载方式:
git clone git@github.com:spring-cloud/spring-cloud-dataflow.git
git checkout v2.3.0.RELEASE
Data Flow Server 通过委托给 Spring Cloud Skipper 来部署 Streams,并直接部署 Tasks。
Skipper 和 Data Flow 服务器都可以部署到本地机器、Cloud Foundry 和 Kubernetes。
本地启动
Cloud Foundry平台部署
Kubernetes编排部署
-参考网址:https://dataflow.spring.io/docs/installation/kubernetes/
本地版本的数据流服务器应该只用于 Stream 开发,但可以在生产环境中用于任务部署,作为 Spring Cloud Batch Admin Server 的替代品。
接下来我们在本地启动 Data Flow Server 和 Shell 来创建time | 日志流。
参考网址: https://kafka.apache.org/quickstart
wget https://downloads.apache.org/kafka/3.0.0/kafka_2.13-3.0.0.tgz
tar -xzf kafka_2.13-3.0.0.tgz
cd kafka_2.13-3.0.0
运行以下命令以按正确顺序启动所有服务:
Start the ZooKeeper service
Note: Soon, ZooKeeper will no longer be required by Apache Kafka.
bin/zookeeper-server-start.sh config/zookeeper.properties
打开另一个终端会话并运行:
_Start the Kafka broker service
bin/kafka-server-start.sh config/server.properties
!!!这里注意命令是mvnw不是mvnmvnw
./mvnw clean install
java -jar spring-cloud-dataflow-server/target/spring-cloud-dataflow-server-<version>.jar
java -jar spring-cloud-dataflow-shell/target/spring-cloud-dataflow-shell-<version>.jar
使用shell终端
dataflow:>stream create --name ticktock --definition "time | log"
Created new stream 'ticktock'
也可以使用http请求来创建:
curl -X POST -d "name=ticktock&definition=time | log" http://localhost:9393/streams/definitions?deploy=false
使用shell方式
dataflow:>stream list
╔═══════════╤═════════════════╤══════════╗
║Stream Name│Stream Definition│ Status ║
╠═══════════╪═════════════════╪══════════╣
║ticktock │time | log │undeployed║
╚═══════════╧═════════════════╧══════════╝
使用http请求方式访问如下:
curl http://localhost:9393/streams/definitions
使用shell方式
dataflow:>stream deploy --name ticktock
Deployed stream 'ticktock'
使用http方式如下:
curl -X POST http://localhost:9393/streams/deployments/ticktock
如果成功,您应该会在 Data Flow Server 控制台中看到类似于以下内容的输出:
...o.s.c.d.spi.local.LocalAppDeployer : deploying app ticktock.log instance 0
Logs will be in /some/path/ticktock.log
如果使用 tail stdout_0.log 文件,您应该看到类似于以下内容的输出:
2016-04-26 15:10:18.320 INFO 59890 --- [pool-1-thread-1] log.sink : 04/26/16 15:10:18
2016-04-26 15:10:19.322 INFO 59890 --- [pool-1-thread-1] log.sink : 04/26/16 15:10:19
2016-04-26 15:10:20.322 INFO 59890 --- [pool-1-thread-1] log.sink : 04/26/16 15:10:20
配置
默认
要配置数据流服务器,您可以遵循此处的引导文档中指定的配置设置指南
注意:可以在此处找到包含默认值的 dataflow-server.yml
Spring Cloud 配置
Spring Cloud Data Flow Server 为用户提供了通过 spring-cloud-config 配置属性的能力。 从云配置中检索到的所有配置将优先于上面列举的 Boot 的默认值。 Spring Cloud Data Flow Server 将在 localhost:8888 处查找服务器,但是这可以通过将 spring.cloud.config.uri 属性设置为所需的 url 来覆盖。
云配置服务器配置
要在云配置服务器 configuration.yml 中为数据流服务器指定存储库,请使用 spring-cloud-dataflow-server 模式设置存储库配置文件。 例如:
spring:
cloud:
config:
server:
git:
uri: https://github.com/myrepo/configurations
repos:
spring-cloud-dataflow-server:
pattern: spring-cloud-dataflow-server
uri: https://github.com/myrepo/configurations
searchPaths: dataFlowServer
快速失败
在某些情况下,如果服务无法连接到配置服务器,则可能希望服务启动失败。 如果这是所需的行为,请设置引导配置属性 spring.cloud.config.failFast=true 并且客户端将因异常而停止。
笔记
如果数据流服务器无法连接到云配置服务器,将记录以下警告消息:
`WARN 42924 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/spring-cloud-dataflow-server/default":Connection refused; nested exception is java.net.ConnectException: Connection refused`
要禁用云配置服务器,请将 spring.cloud.config.enabled 属性设置为 false。
Docker-Compose 集成测试
要运行 docker compose 集成,请启用 -Pfailsafe maven 配置文件。
您只能像这样运行集成测试:
./mvnw clean test-compile failsafe:integration-test -pl spring-cloud-dataflow-server -Pfailsafe
查看更多原文,技术咨询与支持,可以扫描微信公众号进行回复咨询