mysql / mysql-utilities

MySQL Utilities is a set of easy-to-use scripts intended to make working with MySQL servers easier.
GNU General Public License v2.0
267 stars 161 forks source link

Insufficient Error Info: CRITICAL [Errno 2] No such file or directory #32

Open zzdjk6 opened 6 years ago

zzdjk6 commented 6 years ago

I try to use it with docker (ubuntu 16.04), but met a problem without a good explain. I suggest to not only print e.errmsg, but add print(traceback.format_exc()) for more error details.

The cmd I execute is:

mysqlfailover --master=root:root@172.17.0.2:3306 --discover-slaves-login=root:root health

The log I have is:

2018-05-28 01:05:11 AM INFO MySQL Utilities mysqlfailover version 1.6.4.
2018-05-28 01:05:11 AM INFO Server '172.17.0.2:3306' is using MySQL version 5.7.22-log.
2018-05-28 01:05:11 AM INFO Discovering slaves for master at 172.17.0.2:3306
2018-05-28 01:05:11 AM INFO Discovering slave at 172.17.0.3:3306
2018-05-28 01:05:11 AM INFO Found slave: 172.17.0.3:3306
2018-05-28 01:05:11 AM INFO Server '172.17.0.3:3306' is using MySQL version 5.7.22-log.
2018-05-28 01:05:11 AM INFO Checking privileges.
2018-05-28 01:05:11 AM INFO Unregistering existing instances from slaves.
2018-05-28 01:05:11 AM INFO Registering instance on master.
2018-05-28 01:05:11 AM INFO Failover console started.
2018-05-28 01:05:11 AM INFO Failover mode = auto.
2018-05-28 01:05:11 AM INFO Unregistering instance on master.
2018-05-28 01:05:11 AM CRITICAL [Errno 2] No such file or directory

It doesn't tell me WHAT file is missing.

After I modified the mysqlfailover to show the traceback, I finally figured out the problem: it point out to /usr/local/lib/python2.7/dist-packages/mysql/utilities/common/tools.py and line 242, which means I didn't have ping installed!!!

After install inetutils-ping, It works fine.

I think print("ERROR: %s" % e.errmsg) is not enough to debug the problem. Adding print(traceback.format_exc()) after that would give user a better explaination.