spring-cloud-turbine clusterNameExpression配置是什么意思?

时间:2015-07-17 04:05:33

标签: spring-cloud turbine

当我使用弹簧云涡轮机时 我配置了涡轮机

turbine:
  clusterNameExpression: new String("default")
  appConfig: crm,hystrix

我不知道 clusterNameExpression 是什么意思

当我启动turbine服务器时,日志为

Just added and starting handler tuple: StreamingHandler_b9a27bea-5fda-4d0f-bfb9-3f2cd23f8066
2015-07-17 11:44:56.535  INFO 989 --- [nio-8555-exec-2] c.n.turbine.data.AggDataFromCluster      : Per handler dispacher started for: StreamingHandler_8d325fd3-bfa4-483f-809b-c7172483ad18
2015-07-17 11:44:56.535  INFO 989 --- [nio-8555-exec-1] c.n.turbine.data.AggDataFromCluster      : Per handler dispacher started for: StreamingHandler_b9a27bea-5fda-4d0f-bfb9-3f2cd23f8066
2015-07-17 11:44:56.536  INFO 989 --- [nio-8555-exec-1] c.n.t.monitor.cluster.ClusterMonitor     : All event handlers for cluster monitor: [StaticListener_For_Aggregator, StreamingHandler_b9a27bea-5fda-4d0f-bfb9-3f2cd23f8066, StreamingHandler_8d325fd3-bfa4-483f-809b-c7172483ad18]
2015-07-17 11:44:56.536  INFO 989 --- [nio-8555-exec-2] c.n.t.monitor.cluster.ClusterMonitor     : All event handlers for cluster monitor: [StaticListener_For_Aggregator, StreamingHandler_b9a27bea-5fda-4d0f-bfb9-3f2cd23f8066, StreamingHandler_8d325fd3-bfa4-483f-809b-c7172483ad18]
2015-07-17 11:44:56.536  INFO 989 --- [nio-8555-exec-1] c.n.t.monitor.cluster.ClusterMonitor     : Starting up the cluster monitor for default_agg
2015-07-17 11:44:56.536  INFO 989 --- [nio-8555-exec-2] c.n.t.monitor.cluster.ClusterMonitor     : Starting up the cluster monitor for default_agg
2015-07-17 11:44:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instance list for apps: [crm, hystrix]
2015-07-17 11:44:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instances for app: crm
2015-07-17 11:44:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Received instance list for app: crm, size=3
2015-07-17 11:44:59.208  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instances for app: hystrix
2015-07-17 11:44:59.208  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Received instance list for app: hystrix, size=2
2015-07-17 11:44:59.208  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Retrieved hosts from InstanceDiscovery: 5
2015-07-17 11:44:59.208  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Found hosts that have been previously terminated: 0
2015-07-17 11:44:59.208  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Hosts up:2, hosts down: 0
2015-07-17 11:44:59.220  INFO 989 --- [        Timer-0] c.n.t.monitor.instance.InstanceMonitor   : Url for host: http://127.0.0.1:8111/hystrix.stream default
2015-07-17 11:44:59.220  INFO 989 --- [        Timer-0] c.n.t.handler.TurbineDataDispatcher      : 

Just added and starting handler tuple: default_agg_aggClusterEventHandler
2015-07-17 11:44:59.220  INFO 989 --- [        Timer-0] c.n.turbine.data.AggDataFromCluster      : Per handler dispacher started for: default_agg_aggClusterEventHandler
2015-07-17 11:44:59.221  INFO 989 --- [        Timer-0] c.n.t.monitor.instance.InstanceMonitor   : Url for host: http://localhost:8010/hystrix.stream default
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instance list for apps: [crm, hystrix]
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instances for app: crm
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Received instance list for app: crm, size=3
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Fetching instances for app: hystrix
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery  : Received instance list for app: hystrix, size=2
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Retrieved hosts from InstanceDiscovery: 5
2015-07-17 11:45:59.157  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Found hosts that have been previously terminated: 0
2015-07-17 11:45:59.158  INFO 989 --- [        Timer-0] c.n.t.discovery.InstanceObservable       : Hosts up:2, hosts down: 0
2015-07-17 11:46:02.629 ERROR 989 --- [nio-8555-exec-2] c.n.t.s.TurbineStreamingConnection       : Got exception when writing to response stream

我开始两个具有不同端口的相同服务,但turbine显示器仅限于默认端口;

如何配置涡轮机来处理所有服务?

我是中国人,对不起,我的英语太差了

1 个答案:

答案 0 :(得分:0)

请参阅文档:http://projects.spring.io/spring-cloud/docs/1.0.1/spring-cloud.html#_turbine

clusterNameExpression是一个Spring Expression Language表达式,用于从InstanceInfo获取群集名称的位置。默认值为appName。我不会改变clusterNameExpression

您需要设置turbine.aggregator.clusterConfig=CRM,HYSTRIX

您需要在Turbur网址/turbine.stream?cluster=<clustername>中添加clusterConfig中的群集名称。