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

start with multi-ip addresses --advertise-address=192.168.7.210 xxx.xxx.18.210 couldn't connect server success #21448

Closed
heming79 opened this issue Dec 3, 2020 · 3 comments · Fixed by #21603
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.

Comments

@heming79
Copy link

heming79 commented Dec 3, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Tidb 4.0.7 vim /etc/hosts
192.168.7.210 yz-mbg-018210
xxx.xxx.18.210 yz-mbg-018210
hostname -i 输出 192.168.7.210 xxx.xxx.18.210
启动tidb 会导致启动参数 --advertise-address=192.168.7.210 xxx.xxx.18.210
此时4000端口监听正常 ,但是 mysql连接报授权失败

2. What did you expect to see? (Required)

希望做一下参数判断 如果 --advertise-address 超过一个值就报异常 ,不要启动端口监听 ,避免前端lvs或者 haproxy 认为后端可用不利于高可用 ,不利于查问题

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

4.0.7

@heming79 heming79 added the type/bug The issue is confirmed as a bug. label Dec 3, 2020
@heming79
Copy link
Author

heming79 commented Dec 3, 2020

或者检查一下 为什么这种情况tidb服务不可用

@jebter jebter assigned lysu and unassigned jebter Dec 3, 2020
@lysu
Copy link
Contributor

lysu commented Dec 3, 2020

Thanks for your feedback.

Yes, -advertise-address should add check, but it seems there are some misunderstand for you about advertise-address usage.

First, for go's flag.String, you can not split multiple parameters with SPACE(" "), so for your command tidb only recieve 192.168.7.210, you need surround it with quota like this --advertise-address="192.168.7.210 xxx.xxx.18.210", but sadly it didn't do only-one-host validation
Second, -advertise-address is a advertise address to others, real bind host is -host(why need two configuration, #7078 (comment) has some explain), but we also cannot bind multi host now

Currently, TiDB only support bind one address via -host, and using -advertise-address to advertise host to others(e.g. bind 0.0.0.0 but export real api to other service)

if you configuration multiple host in -host(e.g. -host='addr1 addr2' it will report error before startup), maybe we need add checks for advertise-address, do you interesting to write a PR to do this simple check :D

@lysu lysu removed their assignment Dec 3, 2020
@lysu lysu added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement. and removed type/bug The issue is confirmed as a bug. labels Dec 3, 2020
@lysu lysu changed the title Tidb 启动参数值有多个ip的话 --advertise-address=192.168.7.210 xxx.xxx.18.210 mysql连接报授权失败 start with multi-ip addresses --advertise-address=192.168.7.210 xxx.xxx.18.210 couldn't connect server success Dec 3, 2020
@TszKitLo40
Copy link
Contributor

I have filed a PR, PTAL @lysu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants