[Labs-l] MySQL server error

Tim Landscheidt tim at tim-landscheidt.de
Wed May 14 20:36:23 UTC 2014


Emilio J. Rodríguez-Posada <emijrp at gmail.com> wrote in a
different order:

>> > I coded a script that uses several wiki databases and servers. When I
>> > manually execute it, it works fine, but after adding it to cron, it
>> returns
>> > this error:
>> [...]
>> > _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
>> > 's3.labsdb' (0)")

>> Sounds like whatever host you end up running on is missing /etc/hosts
>> entries.

>> See
>> https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Help#Connecting_to_the_database_replicas_from_other_Labs_instances

> Why things are so difficult? :-/

That's what you would need from another Labs project.  In
Tools, you should be able to connect to s3.labsdb from all
hosts.

And indeed, all exec nodes have s3.labsdb in their
/etc/hosts:

| scfc at tools-login:~$ for HOST in tools-exec-{01..10}; do ssh $HOST 'fgrep -q s3.labsdb /etc/hosts || hostname'; done
| scfc at tools-login:~$

But all aliases are missing on tools-submit:

| scfc at tools-login:~$ ssh tools-submit cat /etc/hosts
| 127.0.0.1 localhost
| 127.0.1.1 ubuntu.pmtpa.wmflabs ubuntu

| # The following lines are desirable for IPv6 capable hosts
| ::1 ip6-localhost ip6-loopback
| fe00::0 ip6-localnet
| ff00::0 ip6-mcastprefix
| ff02::1 ip6-allnodes
| ff02::2 ip6-allrouters
| ff02::3 ip6-allhosts
| scfc at tools-login:~$

which leads me to the conclusion that you aren't submitting
your cron job to the grid with jsub/qsub, but executing it
on tools-submit itself (which is allowed under certain con-
ditions).  I filed https://bugzilla.wikimedia.org/65308 for
the missing aliases/NAT on tools-submit.

Unfortunately, I don't have sudo rights on tools-submit, so
I can't fix it right away.  So you could either wait for
Coren to return from his holiday on Friday, or change your
cron job so that it is submitted to the grid instead.

Tim




More information about the Labs-l mailing list