apache / linkis

Apache Linkis builds a computation middleware layer to facilitate connection, governance and orchestration between the upper applications and the underlying data engines.
https://linkis.apache.org/
Apache License 2.0
3.32k stars 1.17k forks source link

[Question] api/rest_j/v1/data-source-manager/ report an authentication error #2733

Closed super3one closed 2 years ago

super3one commented 2 years ago

Before asking

Your environment

Describe your questions

When I use qualitis to connection linkis with linkis_host : linkis_gateway_port to get the data source information, I got an error reported in qualitis.log like:

ERROR [qtp592858578-612] handler.RestErrorHandler handleError: Client Error! response: status code: 401, status text: Unauthorized, header: {transfer-encoding=[chunked], Access-Control-Allow-Origin=[*], Access-Control-Allow-Credentials=[true], Access-Control-Allow-Headers=[authorization,Content-Type], Access-Control-Allow-Methods=[POST, GET, OPTIONS, PUT, HEAD, DELETE], Date=[Friday, August 12, 2022 4:19:27 PM CST], Content-Type=[application/json;charset=UTF-8]}, body: {"method":"/api/rest_j/v1/data-source-manager/info","status":-1,"message":"Token Authentication Failed, token: QUALITIS-AUTH,tokenUser: hadoop, reason: errCode: 15200 ,desc: Failed to load token from DB into cache! ,ip: node1 ,port: 9002 ,serviceKind: linkis-mg-gateway","data":{}}, charset: UTF-8

But I've already configured in the token.properties file in linkis like: QUALITIS-AUTH=*

what does the error code 15200 means? and how can I fix this problem?

Eureka service list

Instances currently registered with Eureka Application AMIs Availability Zones Status LINKIS-CG-ENTRANCE n/a (1) (1) UP (1) - node1:linkis-cg-entrance:9104 LINKIS-CG-LINKISMANAGER n/a (1) (1) UP (1) - node1:linkis-cg-linkismanager:9101 LINKIS-MG-EUREKA n/a (1) (1) UP (1) - node1:linkis-mg-eureka:20303 LINKIS-MG-GATEWAY n/a (1) (1) UP (1) - node1:linkis-mg-gateway:9002 LINKIS-PS-DATA-SOURCE-MANAGER n/a (1) (1) UP (1) - node1:linkis-ps-data-source-manager:9109 LINKIS-PS-METADATAMANAGER n/a (1) (1) UP (1) - node1:linkis-ps-metadatamanager:9110 LINKIS-PS-PUBLICSERVICE n/a (1) (1) UP (1) - node1:linkis-ps-publicservice:9105

Some logs info or acctch file

qualitis.log:



2022-08-12 16:19:33,697 ERROR [qtp592858578-612] handler.RestErrorHandler handleError: Client Error! response: status code: 401, status text: Unauthorized, header: {transfer-encoding=[chunked], Access-Control-Allow-Origin=[*], Access-Control-Allow-Credentials=[true], Access-Control-Allow-Headers=[authorization,Content-Type], Access-Control-Allow-Methods=[POST, GET, OPTIONS, PUT, HEAD, DELETE], Date=[Friday, August 12, 2022 4:19:27 PM CST], Content-Type=[application/json;charset=UTF-8]}, body: {"method":"/api/rest_j/v1/data-source-manager/info","status":-1,"message":"Token Authentication Failed, token: QUALITIS-AUTH,tokenUser: hadoop, reason: errCode: 15200 ,desc: Failed to load token from DB into cache! ,ip: node1 ,port: 9002 ,serviceKind: linkis-mg-gateway","data":{}}, charset: UTF-8
2022-08-12 16:19:33,697 ERROR [qtp592858578-612] controller.MetaDataController getDataSourceInfoPage: I/O error on GET request for "http://10.58.14.105:9002/api/rest_j/v1/data-source-manager/info": 401 Unauthorized; nested exception is com.webank.wedatasphere.qualitis.exception.HttpRestTemplateException: 401 Unauthorized
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://10.58.14.105:9002/api/rest_j/v1/data-source-manager/info": 401 Unauthorized; nested exception is com.webank.wedatasphere.qualitis.exception.HttpRestTemplateException: 401 Unauthorized
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:742) ~[spring-web-5.1.18.RELEASE.jar:5.1.18.RELEASE]
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:668) ~[spring-web-5.1.18.RELEASE.jar:5.1.18.RELEASE]
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:577) ~[spring-web-5.1.18.RELEASE.jar:5.1.18.RELEASE]
        at com.webank.wedatasphere.qualitis.client.impl.MetaDataClientImpl.getDataSourceInfoPage(MetaDataClientImpl.java:642) ~[core_meta_data-0.9.0.jar:?]
        at com.webank.wedatasphere.qualitis.service.impl.MetaDataServiceImpl.getDataSourceInfoPage(MetaDataServiceImpl.java:374) ~[web_meta_data-0.9.0.jar:?]
        at com.webank.wedatasphere.qualitis.service.impl.MetaDataServiceImpl$$FastClassBySpringCGLIB$$f1a47669.invoke(<generated>) ~[web_meta_data-0.9.0.jar:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.18.RELEASE.jar:5.1.18.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:687) ~[spring-aop-5.1.18.RELEASE.jar:5.1.18.RELEASE]
        at com.webank.wedatasphere.qualitis.service.impl.MetaDataServiceImpl$$EnhancerBySpringCGLIB$$9e7ba7ca.getDataSourceInfoPage(<generated>) ~[web_meta_data-0.9.0.jar:?]
        at com.webank.wedatasphere.qualitis.controller.MetaDataController.getDataSourceInfoPage(MetaDataController.java:244) ~[web_meta_data-0.9.0.jar:?]
        at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282]
github-actions[bot] commented 2 years ago

:blush: Welcome to the Apache Linkis (incubating) community!! We are glad that you are contributing by opening this issue.

Please make sure to include all the relevant context. We will be here shortly.

If you are interested in contributing to our website project, please let us know! You can check out our contributing guide on :point_right: How to Participate in Project Contribution.

WeChat Group:

image Mailing Lists: name description Subscribe Unsubscribe archive
dev@linkis.apache.org community activity information subscribe unsubscribe archive
casionone commented 2 years ago

please make sure you have init you token table https://linkis.apache.org/zh-CN/docs/1.1.3/upgrade/upgrade-guide#41-token-%E9%85%8D%E7%BD%AE the token sql file can be found in https://github.com/apache/incubator-linkis/tree/master/linkis-dist/package/db

super3one commented 2 years ago

please make sure you have init you token table https://linkis.apache.org/zh-CN/docs/1.1.3/upgrade/upgrade-guide#41-token-%E9%85%8D%E7%BD%AE the token sql file can be found in https://github.com/apache/incubator-linkis/tree/master/linkis-dist/package/db

Yes. I can see the record with token_name=QUALITIS-AUTH has been added to table linkis_mg_gateway_auth_token.

id  token_name  legal_users legal_hosts business_owner  create_time update_time elapse_day  update_by
5   QUALITIS-AUTH   *   *   BDP 2022-08-12  2022-08-12  -1  LINKIS

But it doesn't help... the error still exists.

casionone commented 2 years ago

please make sure you have init you token table https://linkis.apache.org/zh-CN/docs/1.1.3/upgrade/upgrade-guide#41-token-%E9%85%8D%E7%BD%AE the token sql file can be found in https://github.com/apache/incubator-linkis/tree/master/linkis-dist/package/db

Yes. I can see the record with token_name=QUALITIS-AUTH has been added to table linkis_mg_gateway_auth_token.

id    token_name  legal_users legal_hosts business_owner  create_time update_time elapse_day  update_by
5 QUALITIS-AUTH   *   *   BDP 2022-08-12  2022-08-12  -1  LINKIS

But it doesn't help... the error still exists.

try to restart linkis-mg-gateway service

super3one commented 2 years ago

please make sure you have init you token table https://linkis.apache.org/zh-CN/docs/1.1.3/upgrade/upgrade-guide#41-token-%E9%85%8D%E7%BD%AE the token sql file can be found in https://github.com/apache/incubator-linkis/tree/master/linkis-dist/package/db

Yes. I can see the record with token_name=QUALITIS-AUTH has been added to table linkis_mg_gateway_auth_token.

id  token_name  legal_users legal_hosts business_owner  create_time update_time elapse_day  update_by
5   QUALITIS-AUTH   *   *   BDP 2022-08-12  2022-08-12  -1  LINKIS

But it doesn't help... the error still exists.

try to restart linkis-mg-gateway service

I tried several times, but still got the same error Is that the error of "Fail to load token from DB into cache" resulted from wrong setting of database? I got an error of initing db when the first time I installed Linkis, then I passes this through source every sql file manually. Is this matters?