List:General Discussion« Previous MessageNext Message »
From:Claudio Nanni Date:March 3 2011 9:20pm
Subject:Re: Get MySQL server IP address in SQL
View as plain text  
Hi Steve,

Thanks for your tip.

It's not a cluster,
I am building a tool to monitor mysql performances and this information(*IP*)
is required in a stored procedure on the mysql-agents installations.
Being it possible to have multiple mysql instances on the same server the
only unique identifier would be the couple [IP-PORT],
the port you can get it easily, the IP I did not find it.
I dont trust the [hostname] since is slightly more subject to be changed,
while the ip on eth0(:0) is a bit more unlikely to be changed.
I would like this information when then you collect data in the same vault.
Also the IP has some risky values:
*IP*:, 192.x.x.x, 10.x.x.x
While the hostname risky/not unique values would be:
*HOSTNAME*: any non official DNS name

While IP/HOSTNAME should be unique on any two systems in the "world", the
PORT is used to distinguish instances on the same host.



2011/3/3 Steve Staples <sstaples@stripped>

> On Thu, 2011-03-03 at 13:43 -0600, Chris W wrote:
> >
> > On 3/2/2011 5:59 PM, Reindl Harald wrote:
> > > Am 03.03.2011 00:31, schrieb Claudio Nanni:
> > >> Anyone knows how to get the server* IP address* thru SQL?
> > > no, because it is nonsense and has nothing to do with a db-server
> > >
> > > if you connect via tcp you know the ip
> > >
> >
> > Isn't that kind of like going to someones home, knocking on their door,
> > and asking, "Where do you live?"
> >
> > Chris W
> >
> What if this is a "load balanced" cluster?  Doesn't that setup query
> "serverA", and in turn, "serverA" finds the least busiest server in the
> "cluster", which could be "serverY", therefore you would have no idea
> which server the query was run on?
> But, as far as I can tell, you could only get the "server_id" (which
> would have to be unique anyway in the cluster), so you could just add
> this to the query:
> SELECT @@global.server_id
> Then you can figure out elsewhere what 'server_id' corresponds to what
> server ip address.
> Just trying to think of other solutions on why the OP would want this
> data...
> Steve
> --
> MySQL General Mailing List
> For list archives:
> To unsubscribe:


Get MySQL server IP address in SQLClaudio Nanni3 Mar
  • Re: Get MySQL server IP address in SQLReindl Harald3 Mar
    • Re: Get MySQL server IP address in SQLChris W3 Mar
      • Re: Get MySQL server IP address in SQLSteve Staples3 Mar
        • Re: Get MySQL server IP address in SQLClaudio Nanni3 Mar
          • RE: Get MySQL server IP address in SQLJerry Schwartz3 Mar
            • Re: Get MySQL server IP address in SQLClaudio Nanni3 Mar