Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support both ip address and hostname for service discovery service call #946 #950

Merged
merged 6 commits into from
Aug 16, 2021
Merged

Conversation

lunescode
Copy link
Contributor

@lunescode lunescode commented Aug 9, 2021

What is the purpose of the change

Linkis support ip address for service discovery service call,Related issues: #946 )

Brief change log

  • Modify sbin/ext/linkis-common-start 、sbin/ext/linkis-common-start,add SPRING_ARGS.
  • Modify relate java/scals, depend on "eureka.instance.prefer-ip-address=true" ,replace hostname to ipAdddress.

Verifying this change

This change is already covered by existing tests, such as (please describe tests).

in config/linkis-env.sh ,set EUREKA_PREFER_IP=true, after install, view eureka page will see services name contains ipAddress,it works!

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • Anything that affects deployment: (no)
  • The MGS(Microservice Governance Services), i.e., Spring Cloud Gateway, OpenFeign, Eureka.: (no)

Documentation

  • Does this pull request introduce a new feature? (yes )
  • If yes, how is the feature documented? (not documented)

@lunescode lunescode changed the title support both ipadderss and hostname for service discovery service call #946 support both ipaddress and hostname for service discovery service call #946 Aug 9, 2021
@lunescode lunescode changed the title support both ipaddress and hostname for service discovery service call #946 support both ip address and hostname for service discovery service call #946 Aug 9, 2021
@@ -130,6 +131,14 @@ trait ProcessEngineConnLaunch extends EngineConnLaunch with Logging {
var springConf = Map("spring.application.name" -> GovernanceCommonConf.ENGINE_CONN_SPRING_NAME.getValue,
"server.port" -> engineConnPort, "spring.profiles.active" -> "engineconn",
"logging.config" -> s"classpath:${EnvConfiguration.LOG4J2_XML_FILE.getValue}") ++: discoveryMsgGenerator.generate(engineConnManagerEnv)

//暂时通过判断engineConnManagerHost是否为IP地址来判断是否使用eureka.instance.prefer-ip-address,后续需要通过engineConnManagerEnv.properties获取相关属性
logger.info(s"engineConnManagerHost:" + engineConnManagerEnv.engineConnManagerHost)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to read Commvars to read this Key(EUREKA_PREFER_IP), which will contain the key Value of the environment variable,CommonVars[String]("EUREKA_PREFER_IP", false),If there is a value in the environment variable, it will not take the default false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I will try and submit changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated,pls review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, you should use the environment variable EUREKA_PREFER_IP instead of spring parameters, because Commvar will read the environment variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, to facilitate communication, you can add my wechat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry,I can't find you webchat, I send my webchat to your email:wpeace1212@gmail.com,pls check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in linkis-env.sh export EUREKA_PREFER_IP, in Configuration read it through CommonVars, and related code has been modified.

@peacewong
Copy link
Contributor

This is a great feature, thank you

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peacewong peacewong merged commit 5221230 into apache:dev-1.0.2 Aug 16, 2021
@lunescode lunescode mentioned this pull request Aug 16, 2021
peacewong added a commit that referenced this pull request Sep 28, 2021
Fix bug about PR #950, Related issues: #946.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants