1.Doris官网
Doris官网https://doris.apache.org/
2.根本原因
本地idea访问FE,FE会返回BE的地址,但是在服务器上通过ip addr查看,发现只有局域网IP,所以FE返回了局域网的IP,导致idea连接不上BE
3.解决办法
重写BackendV2类,返回公网IP即可。
在项目下新建包名
java
org.apache.doris.flink.rest.models
然后放入 BackendV2类
java
package org.apache.doris.flink.rest.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/**
* @Project_Name:Realtime
* @Package_Name:org.apache.doris.flink.rest.models
* @Class_Name:BackendV2
* @Auther:zhang pengyun
* @Date:2023-07-25 21:06
* @Description:
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class BackendV2 {
@JsonProperty(value = "backends")
private List<BackendRowV2> backends;
public List<BackendRowV2> getBackends() {
return backends;
}
public void setBackends(List<BackendRowV2> backends) {
this.backends = backends;
}
public static class BackendRowV2 {
public String ip;
public int http_port;
public boolean is_alive;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getHttpPort() {
return http_port;
}
public void setHttpPort(int httpPort) {
this.http_port = httpPort;
}
public boolean isAlive() {
return is_alive;
}
public void setAlive(boolean alive) {
is_alive = alive;
}
public String toBackendString(){
return "47.92.168.70" + ":" + http_port;
}
}
}
然后重写修改toBackendString()方法,将公网IP写死返回,如果有多个BE,可以通过判断ip属性的值,动态返回。