首先配置类:
@Bean
public ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup();
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
这个地方忘记加了
第二主机名写出了locahost后台报错
java.net.UnknownHostException: loclahost
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_192]
at java.net.InetAddress$.lookupAllHostAddr(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName0(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName(InetAddress.java:) ~[na:1.8.0_192]
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration$ProxyStreamServlet.doGet(HystrixDashboardConfiguration.java:) ~[spring-cloud-netflix-hystrix-dashboard-2.1..RELEASE.jar:2.1..RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:) [tomcat-embed-core-9.0..jar:9.0.]
这两个不加会报错:
Unable to connect to Command Metric Stream.
还有就是那个界面之后不知道如何操作: