spring-cloud-dataflow-server-local 要为 MySQL 启动?

spring-cloud-dataflow-server-local to start for MySQL?

我正在使用 Spring 批处理 处理 Spring 数据流。在这个例子中,我已经下载了 spring-cloud-dataflow-server-local-1.7.4.RELEASE,并且只是 运行 它 java -jar spring-cloud-dataflow-server-local-1.7.4.RELEASE.jar ,但它只是尝试仅连接到 H2 数据库。

有什么办法可以在 MySQL 开始吗?

E:\spring-cloud-data-flow\spring-cloud-data-flow-example-master>java -jar spring-cloud-dataflow-server-local-1.7.4.RELEASE.jar
  ____                              ____ _                __
 / ___| _ __  _ __(_)_ __   __ _   / ___| | ___  _   _  __| |
 \___ \| '_ \| '__| | '_ \ / _` | | |   | |/ _ \| | | |/ _` |
  ___) | |_) | |  | | | | | (_| | | |___| | (_) | |_| | (_| |
 |____/| .__/|_|  |_|_| |_|\__, |  \____|_|\___/ \__,_|\__,_|
  ____ |_|    _          __|___/                 __________
 |  _ \  __ _| |_ __ _  |  ___| | _____      __  \ \ \ \ \ \
 | | | |/ _` | __/ _` | | |_  | |/ _ \ \ /\ / /   \ \ \ \ \ \
 | |_| | (_| | || (_| | |  _| | | (_) \ V  V /    / / / / / /
 |____/ \__,_|\__\__,_| |_|   |_|\___/ \_/\_/    /_/_/_/_/_/

Spring Cloud Data Flow Local Server  (v1.7.4.RELEASE)

2020-04-17 01:41:59.509  INFO 1392 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2020-04-17 01:42:01.723  WARN 1392 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/spring-cloud-dataflow-server-local/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2020-04-17 01:42:01.726  INFO 1392 --- [           main] o.s.c.d.s.local.LocalDataFlowServer      : No active profile set, falling back to default profiles: default
2020-04-17 01:42:04.595  INFO 1392 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-04-17 01:42:04.655  INFO 1392 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-04-17 01:42:04.951  INFO 1392 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-04-17 01:42:05.874  INFO 1392 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=58e7985c-b060-3840-a081-de0afa153316
2020-04-17 01:42:08.543  INFO 1392 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9393 (http)
2020-04-17 01:42:08.590  INFO 1392 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Initializing ProtocolHandler ["http-nio-9393"]
2020-04-17 01:42:08.641  INFO 1392 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-04-17 01:42:08.642  INFO 1392 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.34
2020-04-17 01:42:08.908  INFO 1392 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-04-17 01:42:09.858  INFO 1392 --- [ost-startStop-1] o.s.c.d.s.config.web.WebConfiguration    : Start Embedded H2
2020-04-17 01:42:09.859  INFO 1392 --- [ost-startStop-1] o.s.c.d.s.config.web.WebConfiguration    : Starting H2 Server with URL: jdbc:h2:tcp://localhost:19092/mem:dataflow
2020-04-17 01:42:11.322  INFO 1392 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-04-17 01:42:11.389  INFO 1392 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-04-17 01:42:11.635  INFO 1392 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2020-04-17 01:42:11.690  INFO 1392 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
        name: default
        ...]
2020-04-17 01:42:11.947  INFO 1392 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.12.Final}
2020-04-17 01:42:11.951  INFO 1392 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2020-04-17 01:42:12.044  INFO 1392 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2020-04-17 01:42:12.559  INFO 1392 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2020-04-17 01:42:13.961  INFO 1392 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-04-17 01:42:15.335  INFO 1392 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: H2
2020-04-17 01:42:15.898  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [org/springframework/batch/core/schema-h2.sql]
2020-04-17 01:42:16.420  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [org/springframework/batch/core/schema-h2.sql] in 520 ms.
2020-04-17 01:42:16.432  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql]
2020-04-17 01:42:16.443  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql] in 9 ms.
2020-04-17 01:42:17.753  INFO 1392 --- [           main] o.s.b.a.s.SimpleJobServiceFactoryBean    : No database type set, using meta data indicating: H2
2020-04-17 01:44:27.834  INFO 1392 --- [           main] b.a.s.AuthenticationManagerConfiguration :

Using default security password: c0eff397-fb4c-4512-8aa5-f418df83d3f4

2020-04-17 01:44:28.253  INFO 1392 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schemas/h2/common.sql for h2 database
2020-04-17 01:44:28.254  INFO 1392 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schemas/h2/streams.sql for h2 database
2020-04-17 01:44:28.257  INFO 1392 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schemas/h2/tasks.sql for h2 database
2020-04-17 01:44:28.263  INFO 1392 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schemas/h2/deployment.sql for h2 database
2020-04-17 01:44:28.265  INFO 1392 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schemas/h2/jpa.sql for h2 database
2020-04-17 01:44:28.268  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schemas/h2/common.sql]
2020-04-17 01:44:28.272  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schemas/h2/common.sql] in 3 ms.
2020-04-17 01:44:28.277  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schemas/h2/streams.sql]
2020-04-17 01:44:28.284  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schemas/h2/streams.sql] in 6 ms.
2020-04-17 01:44:28.285  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schemas/h2/tasks.sql]
2020-04-17 01:44:28.289  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schemas/h2/tasks.sql] in 3 ms.
2020-04-17 01:44:28.291  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schemas/h2/deployment.sql]
2020-04-17 01:44:28.294  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schemas/h2/deployment.sql] in 3 ms.
2020-04-17 01:44:28.299  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schemas/h2/jpa.sql]
2020-04-17 01:44:28.306  INFO 1392 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schemas/h2/jpa.sql] in 6 ms.
2020-04-17 01:44:28.685  WARN 1392 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-04-17 01:44:28.691  INFO 1392 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-17 01:44:28.713  WARN 1392 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-04-17 01:44:28.714  INFO 1392 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-17 01:44:30.315  INFO 1392 --- [           main] o.s.l.c.support.AbstractContextSource    : Property 'userDn' not set - anonymous context will be used for read-write operations
2020-04-17 01:44:30.807  INFO 1392 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService  'taskScheduler'
2020-04-17 01:44:33.260  INFO 1392 --- [           main] o.s.c.d.s.c.support.MetricStore          : Metrics Collector URI = []
2020-04-17 01:44:34.274  INFO 1392 --- [           main] ration$HystrixMetricsPollerConfiguration : Starting poller
2020-04-17 01:44:34.335  INFO 1392 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Starting ProtocolHandler ["http-nio-9393"]
2020-04-17 01:44:34.362  INFO 1392 --- [           main] o.a.tomcat.util.net.NioSelectorPool      : Using a shared selector for servlet write/read
2020-04-17 01:44:34.400  INFO 1392 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9393 (http)
2020-04-17 01:44:34.414  INFO 1392 --- [           main] o.s.c.d.s.local.LocalDataFlowServer      : Started LocalDataFlowServer in 159.838 seconds (JVM running for 161.116)

您需要在启动服务器时设置适当的数据源属性:

java -jar spring-cloud-dataflow-server-local/target/spring-cloud-dataflow-server-local-1.7.4.RELEASE.jar \
    --spring.datasource.url=jdbc:mysql://localhost:3306/mydb \
    --spring.datasource.username= \
    --spring.datasource.password= \
    --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver &

更多信息可以参考文档here

作为旁注,请考虑切换到更高版本的 SCDF,因为 1.7.x 相对较旧。