alibaba / alibaba/Sentinel

sentinel 集群流控token-server 列表不显示链接状态

Open
#2,926 3 comments 0 reactions 0 assignees View on GitHub
area/cluster-flow area/dashboard kind/question
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

sentinel-dashboard version: 1.8.1
sentinel-cluster-server-default version: 1.8.1
sentinel-cluster-client-default version: 1.8.1

1: 已经实现配置规则持久到apollo

2:以独立模式部署的token-server,代码如下:

`/**
* @description: Server namespace set (scope) data source.
* @author: zhou shuai
* @param tokenServerNameSpace
* @date: 2022/10/25 14:40
*/
private void initTokenServerNameSpaces(String tokenServerNameSpace) {
ReadableDataSource> namespaceDs = new ApolloDataSource<>(tokenServerNameSpace,
ApolloConfigUtil.getTokenServerNamespaceSetKey(), defaultRules, source -> JSON.parseObject(source,
new TypeReference>() {
}));
log.info("namespaceDs : {}", namespaceDs.getProperty());
ClusterServerConfigManager.registerNamespaceSetProperty(namespaceDs.getProperty());
}

/**
* @description: Server transport configuration data source.
* @author: zhou shuai
* @param tokenServerNameSpace
* @date: 2022/10/25 14:39
*/
private void initServerTransportConfig(String tokenServerNameSpace) {
ReadableDataSource serverTransportDs = new ApolloDataSource<>(tokenServerNameSpace,
ApolloConfigUtil.getTokenServerRuleKey(), defaultRules,
new TokenServerTransportConfigParser());
ClusterServerConfigManager.registerServerTransportProperty(serverTransportDs.getProperty());
}

/**
* @description: 初始化最大qps
* @author: zhou shuai
* @param tokenServerNameSpace
* @date: 2022/10/25 14:40
*/
private void initServerFlowConfig(String tokenServerNameSpace) {
ClusterServerFlowConfigParser serverFlowConfigParser = new ClusterServerFlowConfigParser();
ReadableDataSource serverFlowConfigDs = new ApolloDataSource<>(tokenServerNameSpace,
ApolloConfigUtil.getTokenServerRuleKey(), defaultRules, s -> {
ServerFlowConfig config = serverFlowConfigParser.convert(s);
if (config != null) {
ClusterServerConfigManager.loadGlobalFlowConfig(config);
}
return config;
});
}

/**
* 设置为 token server
*/
private void initStateProperty() {
ClusterStateManager.applyState(ClusterStateManager.CLUSTER_SERVER);
}`

3:apollo相关配置
![image](https://user-images.githubusercontent.com/29701159/197946823-47ef2251-b352-425b-9b9e-3249fc6a097b.png)

4:sentinel client 配置
/**
* 客户端请求超时配置; 默认超时时间20ms
*/
private void initClientConfigProperty(String tokenServerNameSpace) {
ReadableDataSource clientConfigDs = new ApolloDataSource<>(tokenServerNameSpace,
ApolloConfigUtil.getClusterClientConfig(), defaultRules,
source -> JSON.parseObject(source, new TypeReference() {
}));
ClusterClientConfigManager.registerClientConfigProperty(clientConfigDs.getProperty());
}

/**
* 设置 token client 需要链接的token server 的地址
*/
public void initClientServerAssignProperty(String tokenServerNameSpace) {
ReadableDataSource clientAssignDs = new ApolloDataSource<>(tokenServerNameSpace,
ApolloConfigUtil.getTokenServerRuleKey(), defaultRules, new ClusterAssignConfigParser());
ClusterClientConfigManager.registerServerAssignProperty(clientAssignDs.getProperty());
}

/**
* 设置业务端状态为集群限流客户端
*/
private void initStateProperty() {
ClusterStateManager.applyState(ClusterStateManager.CLUSTER_CLIENT);
}

5:我在本地是多实例启动order-server服务,启动参数
-Dcsp.sentinel.log.use.pid=true
-Dserver.port=8763

6:我在order-server集群流控页面添加token-server列表,但是token-server不显示链接状态
![image](https://user-images.githubusercontent.com/29701159/197947208-a89ec607-2223-4098-aef0-95230f6d4205.png)

7:后来我发现在token-server这个应用下显示了,但是显示的是嵌入模式。但是我想在order-server显示token-server的链接状态。方便问一下是什么原因嘛?还是说独立模式启动就是这样的机制。
![image](https://user-images.githubusercontent.com/29701159/197947462-b4fd0ab2-dcf9-45a2-8dee-2d4858fd0353.png)

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior in Sentinel Dashboard 1.8.1 using the independent token-server and order-server cluster setup described in the issue. Start with the cluster flow-control page and the supplied Apollo client/server configuration; done means determining whether the missing link status is expected or correcting the display so the independent token-server status appears under order-server.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.