-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
FATAL ERROR 1105 (HY000): Failed to register slave: too long 'report-host' #388
Comments
https://github.com/siddontang/go-mysql/blob/master/replication/binlogsyncer.go#L43 seem we have already had this config, you can use it directly. |
This sets the hostname of the slave hosts to be "localhost". If unset, as it was, it will use the os.Hostname() value as the hostname instead. In rare situations, the OS's hostname could be too long for the slave host's "host" field, and we got an error like: panic: ERROR 1105 (HY000): Failed to register slave: too long 'report-host' which would crash the server. Before this change: mysql> show slave hosts; +------------+--------------------------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+--------------------------+------+-----------+------------+ | 2926146535 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4101280766 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 738891311 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3490062834 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3176772553 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 985189460 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4240725287 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 2752132824 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3221796892 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3038601891 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | +------------+--------------------------+------+-----------+------------+ After this change: mysql> show slave hosts; +------------+-----------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+-----------+------+-----------+------------+ | 186920018 | localhost | 3308 | 1 | | | 2071718504 | localhost | 3308 | 1 | | | 3278845420 | localhost | 3308 | 1 | | | 2121800266 | localhost | 3308 | 1 | | | 3721418580 | localhost | 3308 | 1 | | | 3544321535 | localhost | 3308 | 1 | | | 50012544 | localhost | 3308 | 1 | | | 4141694557 | localhost | 3308 | 1 | | | 1374039930 | localhost | 3308 | 1 | | +------------+-----------+------+-----------+------------+ It doesn't seem like the hostname of the slave hosts matters that much; Verified everything still worked as expected. Also see go-mysql-org/go-mysql#388
This sets the localhost field of the BinlogSyncerConfig. If unset, as it was, it will use the os.Hostname() value as the hostname instead. In rare situations, the OS's hostname could be too long for the slave host's "host" field, and we got an error like: panic: ERROR 1105 (HY000): Failed to register slave: too long 'report-host' which would crash the server. So we strip the hostname to be 60 characters, which is the max allowed length. It doesn't seem like the hostname of the slave hosts matters that much; Verified everything still worked as expected. We could hardcode "localhost" here as the host name but are keeping the OS's hostname in case it's useful for debugging on remote hosts. To see the hostname of slave hosts: mysql> show slave hosts; +------------+--------------------------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+--------------------------+------+-----------+------------+ | 2926146535 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4101280766 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 738891311 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3490062834 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3176772553 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 985189460 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4240725287 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 2752132824 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3221796892 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3038601891 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | +------------+--------------------------+------+-----------+------------+ Also see go-mysql-org/go-mysql#388
This sets the localhost field of the BinlogSyncerConfig. If unset, as it was, it will use the os.Hostname() value as the hostname instead. In rare situations, the OS's hostname could be too long for the slave host's "host" field, and we got an error like: panic: ERROR 1105 (HY000): Failed to register slave: too long 'report-host' which would crash the server. So we strip the hostname to be 60 characters, which is the max allowed length. It doesn't seem like the hostname of the slave hosts matters that much; Verified everything still worked as expected. We could hardcode "localhost" here as the host name but are keeping the OS's hostname in case it's useful for debugging on remote hosts. To see the hostname of slave hosts: mysql> show slave hosts; +------------+--------------------------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+--------------------------+------+-----------+------------+ | 2926146535 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4101280766 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 738891311 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3490062834 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3176772553 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 985189460 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4240725287 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 2752132824 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3221796892 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3038601891 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | +------------+--------------------------+------+-----------+------------+ Also see go-mysql-org/go-mysql#388
This sets the localhost field of the BinlogSyncerConfig. If unset, as it was, it will use the os.Hostname() value as the hostname instead. In rare situations, the OS's hostname could be too long for the slave host's "host" field, and we got an error like: panic: ERROR 1105 (HY000): Failed to register slave: too long 'report-host' which would crash the server. So we strip the hostname to be 60 characters, which is the max allowed length. It doesn't seem like the hostname of the slave hosts matters that much; Verified everything still worked as expected. We could hardcode "localhost" here as the host name but are keeping the OS's hostname in case it's useful for debugging on remote hosts. To see the hostname of slave hosts: mysql> show slave hosts; +------------+--------------------------+------+-----------+------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +------------+--------------------------+------+-----------+------------+ | 2926146535 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4101280766 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 738891311 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3490062834 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3176772553 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 985189460 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 4240725287 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 2752132824 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3221796892 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | | 3038601891 | Arthur-Huang-MacBook-Pro | 3308 | 1 | | +------------+--------------------------+------+-----------+------------+ Also see go-mysql-org/go-mysql#388
I also met this problem, and seems different version of MySQL has different length limit, it's better let the application of this library to decide the hostname |
normally, what we do is canal := NewCanal(cfg) there's no way for developers to inject custom binlogsyncer to canal. so event BinlogSyncerConfig itself have a public field call LocalHost, it does not help |
You can set canal.Config.Localhost |
oh. cool. our repo is using v1.6.0, so this param is not available. but i check latest version, it has this setting. I think this will do the trick. Thank you. But it looks like this change is not included in v1.7.0, setting our go module directly depends on latest might bring unexpected result though. |
I have been running into this issue when running
gh-ost
inside of some of our docker containers. When the hostname of the docker container is at least 61 characters in length, I get the following error when trying to rungh-ost
.The docker container is running on Ubuntu Bionic.
When I specified
--hostname
when creating the same docker container to be 61 characters instead,gh-ost
ran without any issues.The error message comes from https://github.com/mysql/mysql-server/blob/124c7ab1d6f914637521fd4463a993aa73403513/sql/rpl_master.cc#L161 and it looks like hostname is chosen from https://github.com/siddontang/go-mysql/blob/master/replication/binlogsyncer.go#L495
Let me know if you need any other information to reproduce this.
It looks like this is an actual limit defined in mysql: https://github.com/mysql/mysql-server/blob/124c7ab1d6f914637521fd4463a993aa73403513/sql/sql_const.h#L59
Would it be possible for go-mysql to allow clients to override the hostname used when setting up replication?
The text was updated successfully, but these errors were encountered: