我使用提供的docker-compose.yaml
文件启动了Spring Cloud Dataflow服务器,并定义了一个简单的流:http | log
现在,我想从主机上向HTTP源发送一些数据,但是我找不到正确的服务器地址和端口。
我想
curl -X POST -d 'data to be sent' http://localhost:8080
http://localhost:8080
必须使用什么才能使它正常工作?
这是我的docker-compose.yaml
文件:
version: '3'
services:
rabbitmq:
image: rabbitmq:3.7
expose:
- "5672"
zookeeper:
image: wurstmeister/zookeeper
expose:
- "2181"
dataflow-server:
image: springcloud/spring-cloud-dataflow-server:${DATAFLOW_VERSION:?DATAFLOW_VERSION is not set!}
container_name: dataflow-server
ports:
- "9393:9393"
environment:
- spring.cloud.dataflow.applicationProperties.stream.spring.rabbitmq.host=rabbitmq
- spring.cloud.skipper.client.serverUri=http://skipper-server:7577/api
- spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.influx.enabled=true
- spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.influx.db=myinfluxdb
- spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.influx.uri=http://influxdb:8086
- spring.cloud.dataflow.grafana-info.url=http://localhost:3000
depends_on:
- rabbitmq
volumes:
- /Users/ernst/Temp/scdf:/root/apps
app-import:
image: springcloud/openjdk:latest
depends_on:
- dataflow-server
command: >
/bin/sh -c "
while ! nc -z dataflow-server 9393;
do
sleep 1;
done;
wget -qO- 'http://dataflow-server:9393/apps' --post-data='uri=http://bitt.ly/Einstein-SR2-stream-applications-rabbit-maven&force=true';
echo 'Stream apps imported'
wget -qO- 'http://dataflow-server:9393/apps' --post-data='uri=http://bitt.ly/Dearborn-SR1-task-applications-maven&force=true';
echo 'Task apps imported'"
skipper-server:
image: springcloud/spring-cloud-skipper-server:${SKIPPER_VERSION:?SKIPPER_VERSION is not set!}
container_name: skipper
ports:
- "7577:7577"
- "9000-9010:9000-9010"
volumes:
- /Users/ernst/Temp/scdf:/root/apps
influxdb:
image: influxdb:1.7.4
container_name: 'influxdb'
ports:
- '8086:8086'
grafana:
image: springcloud/spring-cloud-dataflow-grafana-influxdb:${DATAFLOW_VERSION:?DATAFLOW_VERSION is not set!}
container_name: 'grafana'
ports:
- '3000:3000'
volumes:
scdf-targets:
答案 0 :(得分:0)
在skipper-server
中定义的docker-composer.yaml
容器中执行组成Spring Cloud Data Flow中流的java应用程序。
这意味着跳过服务器部分中的端口映射是相关的:
skipper-server:
image: springcloud/spring-cloud-skipper-server:${SKIPPER_VERSION:?SKIPPER_VERSION is not set!}
container_name: skipper
ports:
- "7577:7577"
- "9000-9010:9000-9010"
这意味着端口7577和9000-9010已映射到主机端口。
为防止http
源选择随机端口,流定义必须如下所示:
http --server.port=9000 | log
现在,以下各项可以正常工作:
curl -H "Content-Type: application/json" -X POST -d '{"id":"1","temperature":"100"}' http://localhost:9000