个人理解,能通过这个端口访问restfull API 应该表示 这个设置生效了,但是首页却是404


访问: http://localhost:8089/   404
访问: http://localhost:8089/taskmanagers/   
正常:
{"taskmanagers":[{"id":"ef7030d2-eb13-4c68-8d0c-20b3d59616c8","path":"akka://flink/user/taskmanager_0","dataPort":-1,"timeSinceLastHeartbeat":0,"slotsNumber":8,"freeSlots":0,"hardware":{"cpuCores":4,"physicalMemory":34359738368,"freeMemory":7635730432,"managedMemory":5338540032}}]}


源码:
```
package test


import org.apache.flink.configuration.{ConfigConstants, Configuration, 
ResourceManagerOptions, RestOptions}
import org.apache.flink.streaming.api.functions.source.SourceFunction
import org.apache.flink.streaming.api.scala.{StreamExecutionEnvironment, _}




object File1 extends App {
  class MySource extends SourceFunction[String] {
    override def run(sourceContext: SourceFunction.SourceContext[String]): Unit 
= {
      for (i <- 1 to 1000) {
        sourceContext.collect(i.toString)
        Thread.sleep(10000)
      }
    }
    override def cancel(): Unit = {}
  }




  var config = new Configuration()
  config.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true)


  config.setInteger(RestOptions.PORT, 8089)
  val env = StreamExecutionEnvironment.createLocalEnvironment(8, config)
  env.addSource(new MySource).print()


  env.execute()
}
```






在 2019-08-23 13:41:36,"Zili Chen" <wander4...@gmail.com> 写道:
>源码里没有标为废弃应该是 FLINK 的一个 issue,你可以到 JIRA[1]上提,这个选项确实是没有用的。
>
>听起来你的程序是个测试程序,能提供相应的源码吗?如果你说后面能访问 /taskmanagers 的话可能并没有问题(x
>
>Best,
>tison.
>
>[1] https://issues.apache.org/jira/browse/
>
>
>hb <343122...@163.com> 于2019年8月23日周五 下午2:27写道:
>
>> 我在idea里 用maven 下载依赖,在idea里运行flink程序<br/><br/>源码里没有标志为废弃啊
>> <br/><br/>```<br/><br/>package
>> org.apache.flink.configuration<br/><br/>public final class ConfigConstants
>> {  ...<br/><br/>     /**<br/>         * @deprecated Use {@link
>> ResourceManagerOptions#LOCAL_NUMBER_RESOURCE_MANAGER} instead.<br/>
>> */<br/>        @Deprecated<br/>        public static final int
>> DEFAULT_LOCAL_NUMBER_RESOURCE_MANAGER = 1;<br/><br/><br/>       public
>> static final String LOCAL_START_WEBSERVER =
>> "local.start-webserver";<br/><br/>```
>> 在 2019-08-23 13:07:27,"Zili Chen" <wander4...@gmail.com> 写道:
>> >另外有个问题是,你是下载二进制 zip 还是从源码编译安装的?
>> >
>> >Best,
>> >tison.
>> >
>> >
>> >Zili Chen <wander4...@gmail.com> 于2019年8月23日周五 下午2:04写道:
>> >
>> >> 我切到了 1.9 的代码上看,这个 ConfigConstants.LOCAL_START_WEBSERVER
>> 应该是个废设置,设不设都没有任何效果。
>> >>
>> >> 所以问题应该跟这个选项没关系,比如你刷新 localhost:8089 能不能恢复?
>> >>
>> >> Best,
>> >> tison.
>> >>
>> >>
>> >> hb <343122...@163.com> 于2019年8月23日周五 下午1:47写道:
>> >>
>> >>> 1.9 版本之前,都是可以这么用的,正常的,1.9也是有这个API的啊
>> >>> 在 2019-08-23 12:28:14,"Zili Chen" <wander4...@gmail.com> 写道:
>> >>> >你是在哪看到这个配置的,我查了下代码甚至这个选项都没有使用点(x
>> >>> >
>> >>> >Best,
>> >>> >tison.
>> >>> >
>> >>> >
>> >>> >hb <343122...@163.com> 于2019年8月23日周五 下午1:22写道:
>> >>> >
>> >>> >> flink1.9.0 下 本地web 页面主页404,代码:
>> >>> >> ```
>> >>> >> var config = new Configuration()
>> >>> >> config.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true)
>> >>> >>
>> >>> >> config.setInteger(RestOptions.PORT, 8089)
>> >>> >> val env = StreamExecutionEnvironment.createLocalEnvironment(8,
>> config)
>> >>> >> ```
>> >>> >> 打开 http://localhost:8089/ 显示
>> >>> >> {"errors":["Not found."]}
>> >>> >> 打开 http://localhost:8089/taskmanagers/ 能正常显示
>> >>>
>> >>
>>

回复