-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for receiving mysql_server_bind_host
on vttestserver
#17250
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
40cdf79
to
da34985
Compare
mysql_server_bind_host
on vttestservermysql_server_bind_host
on vttestserver
go/vt/mysqlctl/mycnf_flag.go
Outdated
@@ -63,6 +64,7 @@ const ( | |||
func RegisterFlags() { | |||
servenv.OnParse(func(fs *pflag.FlagSet) { | |||
fs.IntVar(&flagServerID, "mycnf_server_id", flagServerID, "mysql server id of the server (if specified, mycnf-file will be ignored)") | |||
fs.StringVar(&flagMysqlBindAddress, "mycnf_mysql_bin_address", flagMysqlBindAddress, "address mysql binds on") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the new flags we add, we use hyphens as separators instead of underscores. So the name should be mycnf-mysql-bin-address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made all new flags use hyphens (see 7adb0a6)
connParams.UnixSocket = "" | ||
connParams.Host = "127.0.0.1" | ||
connParams.Host = host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to the new flags it seems we used 127.0.0.1
as the hostname. Shoudln't that be the default for the flags then instead of 0.0.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mysql is binding to 0.0.0.0
by default (at least it is when run out of vttestserver).
Confirmed with this test:
$ /opt/vitess-19/bin/vttestserver --alsologtostderr --persistent_mode --mysql_bind_host=127.231.106.94 --grpc_bind_address=127.231.106.94 --vschema_ddl_authorized_users=% --enable_system_settings=false --mysql_server_version=8.0.34 --planner-version=gen4 --data_dir=/tmp/foobar/data --log_dir=/tmp/foobar/logs --port=15991 --tablet_hostname=127.231.106.94 --tablet_refresh_interval=10s --vtcombo-bind-host=127.231.106.94 --num_shards=1,1 --keyspaces=core_general_1_dev,core_general_1_test
// notice command with port 15991, and mysql listening on 15993 binds to 0.0.0.0
$ netstat -an | grep 1599 | grep LISTEN
tcp4 0 0 127.231.106.94.15991 *.* LISTEN
tcp46 0 0 *.15992 *.* LISTEN
tcp4 0 0 127.231.106.94.15994 *.* LISTEN
tcp46 0 0 *.15993 *.* LISTEN
$ lsof -i :15991-15994
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 30509 gabrielparreiras 20u IPv6 0x843d5de06a4e62a0 0t0 TCP *:15993 (LISTEN)
vtcombo 30513 gabrielparreiras 34u IPv4 0x83b4c31e34aa900c 0t0 TCP localhost:15994 (LISTEN)
vtcombo 30513 gabrielparreiras 36u IPv6 0x38b3535bf6c700cf 0t0 TCP *:15992 (LISTEN)
vtcombo 30513 gabrielparreiras 37u IPv4 0x93e314ab7e1f052a 0t0 TCP localhost:15991 (LISTEN)
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
Signed-off-by: Gabriel Parreiras <gab.parreiras@gmail.com>
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
There are quite a few test failures. Would you mind looking at them and fixing the PR accordingly? |
This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:
If no action is taken within 7 days, this PR will be closed. |
This PR was closed because it has been stale for 7 days with no activity. |
Description
When
--mysql-server-bind-host
is supplied tovttestserver
, it is now forwarded up tomysqlctl
andmysqlctld
, and then finally added tomy.cnf
file. MySQL then respects the expected IP we want it to bind on.Related Issue(s)
Part of #16798
Checklist
Deployment Notes