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

Fix PD --peer-urls flag to use listen_host variable #949

Merged
merged 3 commits into from
Dec 1, 2020

Conversation

fln
Copy link
Contributor

@fln fln commented Nov 30, 2020

What problem does this PR solve?

This allows us to use server host name instead of IP address. Without
this change if PD service is declared using host name it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable listen_host was introduced in #495 and is already used for
the --client-urls flag.

This should resolve #337 and partially implement #691 .

What is changed and how it works?

This commit updates run_pd.sh and run_pd_scale.sh.tpl templates to use listen_host for
--peer-urls flag instead of host.

Check List

Tests

No code. Tested with integration tests in #950.

Side effects

Breaking backward compatibility

If existing installations relied on host field to be used as address for accepting peer connections this change could be treated as breaking change. Default value of listen_host is 0.0.0.0 so it should not break existing clusters.

Some might want to use different listen addresses for peer and client connections. However I think this would add unnecessary complexity and not worth supporting.

Related changes

Need to update the documentation
Not sure where metadata file is properly documented. So far I have used source code to understand what is expected in the metadata.yaml file.

Release notes:

Support using host name instead of IP hosts in topology.yaml.

@codecov-io
Copy link

codecov-io commented Nov 30, 2020

Codecov Report

Merging #949 (be4aadf) into master (5296e8f) will decrease coverage by 3.81%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #949      +/-   ##
==========================================
- Coverage   55.86%   52.05%   -3.82%     
==========================================
  Files         263      263              
  Lines       19513    19513              
==========================================
- Hits        10901    10157     -744     
- Misses       6883     7713     +830     
+ Partials     1729     1643      -86     
Flag Coverage Δ
cluster 38.17% <100.00%> (-5.21%) ⬇️
dm 24.29% <100.00%> (-0.07%) ⬇️
integrate 46.24% <100.00%> (-3.83%) ⬇️
playground 20.28% <ø> (ø)
tiup 16.80% <100.00%> (ø)
unittest 23.07% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/cluster/embed/autogen_pkger.go 100.00% <100.00%> (ø)
components/cluster/command/check.go 6.37% <0.00%> (-72.82%) ⬇️
pkg/cluster/task/limits.go 0.00% <0.00%> (-68.75%) ⬇️
pkg/cluster/task/sysctl.go 0.00% <0.00%> (-66.67%) ⬇️
components/cluster/command/audit.go 27.27% <0.00%> (-54.55%) ⬇️
pkg/cluster/operation/check.go 0.00% <0.00%> (-51.95%) ⬇️
pkg/cluster/task/rmdir.go 0.00% <0.00%> (-50.00%) ⬇️
pkg/cluster/operation/operation.go 34.78% <0.00%> (-43.48%) ⬇️
components/cluster/command/rename.go 25.00% <0.00%> (-41.67%) ⬇️
components/cluster/command/stop.go 38.46% <0.00%> (-30.77%) ⬇️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5296e8f...be4aadf. Read the comment docs.

Copy link
Member

@lucklove lucklove left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 30, 2020
Copy link
Contributor

@AstroProfundis AstroProfundis left a comment

Choose a reason for hiding this comment

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

LGTM, but we might need more tests before releasing this.

@AstroProfundis AstroProfundis added need-more-test status/need-doc Indicates that we should update document before merge a PR. labels Nov 30, 2020
@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 30, 2020
@fln fln force-pushed the fix_pd_peer_urls branch from 6c6d184 to c3a66cd Compare November 30, 2020 12:13
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
@fln fln force-pushed the fix_pd_peer_urls branch from c3a66cd to 174b11e Compare November 30, 2020 21:23
@lucklove
Copy link
Member

lucklove commented Dec 1, 2020

/merge

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 1, 2020
@ti-chi-bot
Copy link
Member

Can merge label has been added.

Git tree hash: 6df2551

@ti-chi-bot
Copy link
Member

@fln: Your PR has out-of-dated and I have automatically updated it for you.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/ti-community-prow repository.

@ti-chi-bot ti-chi-bot merged commit 601a3e0 into pingcap:master Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time-contributor size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. status/need-doc Indicates that we should update document before merge a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failed to start pd with the host name in topo.yaml
6 participants