Re: MySql Host through Heartbeat
The "\!" command is specific to the mysql client and executes locally, making it useless for this purpose. If you don't have access to 5.0.41+ and the database you are querying is a replicated slave, you can use the 'server_id' variable to tie the server to an actual hostname (SHOW VARIABLES LIKE 'server_id') as it is unique. Ben - just curious, why is heartbeat tied in with the server IP? Is it monitoring the server instead of the mysql daemon to check if it's up? :) Cheers, Atle On Wed, 13 Jun 2007, Scott Tanner wrote: > There's a 'report-host' option that can be set in the conf file to > mask the host name. Sounds like this may be set. > > If you want to get the server's actual host name from within mysql, > how about running a system command: >mysql> \! hostname; > >or > >mysql> \! cat /etc/hostnames; (debian) >mysql> \! cat /etc/hosts; (CentOS/rhel) > > > > Regards, > Scott > > > > On Wed, 2007-06-13 at 17:46 +0100, Ben Clewett wrote: > > What I know is that: > > > > Heartbeat with MySQL uses two IP's. That of the server, and that of the > > resource MySql. The former is fixed, the latter moves with MySQL when > > it's moved to another server. > > > > The one I need is the hostname of the physical server, not the resource. > > > > I've installed 5.0.41 and have found that the 'hostname' variable does > > report the hostname of the physical server. I have no idea how it does > > it :) > > > > I have my solution, thanks for the help, > > > > Ben Clewett. > > > > > > > > Baron Schwartz wrote: > > > Gerald L. Clark wrote: > > >> Baron Schwartz wrote: > > >>> Gerald L. Clark wrote: > > >>> > > Ben Clewett wrote: > > > > > Dear MySQL, > > > > > > I'm running 5.0.26 through Heartbeat. Which seems to work well, > > > even as a replication slave and Heartbeat continously stopping and > > > starting the server. > > > > > > The Heartbeat moves MySQL around from server to server when a > > > failure occures. I am trying to find a way for MySQL to report the > > > server host name on which it's currently sitting. Without any luck. > > > > > > Would any kind members know of a way of getting this information > > > from MySQL? > > > > > > Many thanks, > > > > > > Ben > > > > > > > > Heartbeat moves the IP address around as well as the services. > > Your hostname should not change. > > >>> > > >>> > > >>> DNS won't change, but the server's /etc/hostname will, right? > > >>> > > >>> Disclaimer: I'm no expert on this... I didn't even know the IP > > >>> address moved too. I should read about Heartbeat. > > >>> > > >>> Baron > > >> Do you actually have /etc/hostname? > > >> RHEL and Centos do not. > > >> They do have an entry in /etc/sysconfig/network > > > > > > Debian and Gentoo have /etc/hostname and /etc/conf.d/hostname, > > > respectively. I would think this is what /usr/bin/hostname uses, and > > > probably where the hostname server variable gets set from in MySQL 5.0.41. > > > > > > Baron > > > > > > > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
There's a 'report-host' option that can be set in the conf file to mask the host name. Sounds like this may be set. If you want to get the server's actual host name from within mysql, how about running a system command: mysql> \! hostname; or mysql> \! cat /etc/hostnames; (debian) mysql> \! cat /etc/hosts; (CentOS/rhel) Regards, Scott On Wed, 2007-06-13 at 17:46 +0100, Ben Clewett wrote: > What I know is that: > > Heartbeat with MySQL uses two IP's. That of the server, and that of the > resource MySql. The former is fixed, the latter moves with MySQL when > it's moved to another server. > > The one I need is the hostname of the physical server, not the resource. > > I've installed 5.0.41 and have found that the 'hostname' variable does > report the hostname of the physical server. I have no idea how it does > it :) > > I have my solution, thanks for the help, > > Ben Clewett. > > > > Baron Schwartz wrote: > > Gerald L. Clark wrote: > >> Baron Schwartz wrote: > >>> Gerald L. Clark wrote: > >>> > Ben Clewett wrote: > > > Dear MySQL, > > > > I'm running 5.0.26 through Heartbeat. Which seems to work well, > > even as a replication slave and Heartbeat continously stopping and > > starting the server. > > > > The Heartbeat moves MySQL around from server to server when a > > failure occures. I am trying to find a way for MySQL to report the > > server host name on which it's currently sitting. Without any luck. > > > > Would any kind members know of a way of getting this information > > from MySQL? > > > > Many thanks, > > > > Ben > > > > > Heartbeat moves the IP address around as well as the services. > Your hostname should not change. > >>> > >>> > >>> DNS won't change, but the server's /etc/hostname will, right? > >>> > >>> Disclaimer: I'm no expert on this... I didn't even know the IP > >>> address moved too. I should read about Heartbeat. > >>> > >>> Baron > >> Do you actually have /etc/hostname? > >> RHEL and Centos do not. > >> They do have an entry in /etc/sysconfig/network > > > > Debian and Gentoo have /etc/hostname and /etc/conf.d/hostname, > > respectively. I would think this is what /usr/bin/hostname uses, and > > probably where the hostname server variable gets set from in MySQL 5.0.41. > > > > Baron > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
What I know is that: Heartbeat with MySQL uses two IP's. That of the server, and that of the resource MySql. The former is fixed, the latter moves with MySQL when it's moved to another server. The one I need is the hostname of the physical server, not the resource. I've installed 5.0.41 and have found that the 'hostname' variable does report the hostname of the physical server. I have no idea how it does it :) I have my solution, thanks for the help, Ben Clewett. Baron Schwartz wrote: Gerald L. Clark wrote: Baron Schwartz wrote: Gerald L. Clark wrote: Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben Heartbeat moves the IP address around as well as the services. Your hostname should not change. DNS won't change, but the server's /etc/hostname will, right? Disclaimer: I'm no expert on this... I didn't even know the IP address moved too. I should read about Heartbeat. Baron Do you actually have /etc/hostname? RHEL and Centos do not. They do have an entry in /etc/sysconfig/network Debian and Gentoo have /etc/hostname and /etc/conf.d/hostname, respectively. I would think this is what /usr/bin/hostname uses, and probably where the hostname server variable gets set from in MySQL 5.0.41. Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Gerald L. Clark wrote: Baron Schwartz wrote: Gerald L. Clark wrote: Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben Heartbeat moves the IP address around as well as the services. Your hostname should not change. DNS won't change, but the server's /etc/hostname will, right? Disclaimer: I'm no expert on this... I didn't even know the IP address moved too. I should read about Heartbeat. Baron Do you actually have /etc/hostname? RHEL and Centos do not. They do have an entry in /etc/sysconfig/network Debian and Gentoo have /etc/hostname and /etc/conf.d/hostname, respectively. I would think this is what /usr/bin/hostname uses, and probably where the hostname server variable gets set from in MySQL 5.0.41. Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Baron Schwartz wrote: Gerald L. Clark wrote: Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben Heartbeat moves the IP address around as well as the services. Your hostname should not change. DNS won't change, but the server's /etc/hostname will, right? Disclaimer: I'm no expert on this... I didn't even know the IP address moved too. I should read about Heartbeat. Baron Do you actually have /etc/hostname? RHEL and Centos do not. They do have an entry in /etc/sysconfig/network -- Gerald L. Clark Supplier Systems Corporation -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Gerald L. Clark wrote: Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben Heartbeat moves the IP address around as well as the services. Your hostname should not change. DNS won't change, but the server's /etc/hostname will, right? Disclaimer: I'm no expert on this... I didn't even know the IP address moved too. I should read about Heartbeat. Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Baron, Thanks for the fast reply. I like the idea of piping in the servername to a small table on startup. Since this will only change on startup, sounds like an excellent idea. Or I may upgrade to above 5.0.41... Regards, Ben Baron Schwartz wrote: Hi, Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? I only know of two ways, though there may be more. 1) The hostname system variable, which was added in 5.0.41 (http://dev.mysql.com/doc/refman/5.0/en/releasenotes-cs-5-0-41.html) 2) Perhaps a UDF that makes a system call. There might be some external ways to do it also. For example, create a table with a single row, and have a startup script replace the value in it with the server's hostname upon startup. Then you can query this value. Cheers Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben Heartbeat moves the IP address around as well as the services. Your hostname should not change. -- Gerald L. Clark Supplier Systems Corporation -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySql Host through Heartbeat
Hi, Ben Clewett wrote: Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? I only know of two ways, though there may be more. 1) The hostname system variable, which was added in 5.0.41 (http://dev.mysql.com/doc/refman/5.0/en/releasenotes-cs-5-0-41.html) 2) Perhaps a UDF that makes a system call. There might be some external ways to do it also. For example, create a table with a single row, and have a startup script replace the value in it with the server's hostname upon startup. Then you can query this value. Cheers Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
MySql Host through Heartbeat
Dear MySQL, I'm running 5.0.26 through Heartbeat. Which seems to work well, even as a replication slave and Heartbeat continously stopping and starting the server. The Heartbeat moves MySQL around from server to server when a failure occures. I am trying to find a way for MySQL to report the server host name on which it's currently sitting. Without any luck. Would any kind members know of a way of getting this information from MySQL? Many thanks, Ben -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]