Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 10th November 2007, 19:47
rwillie6 rwillie6 is offline
Junior Member
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Load balancing on Fedora with Heartbeat (MySQL Cluster)

I'm following the tutorial on creating a MySQL cluster on 4 machines:

mysql-1: load balancer (primary) and cluster management
mysql-2: MySQL SQL node 1
mysql-3: MySQL SQL node 2
mysql4: load balancer (secondary)

All machines previously only had a base install of Fedora 7. I've got the MySQL cluster up and running great, but I'm having trouble with the load balancing via heartbeat. Here is the output I receive whenever I try to stop ldirectout or start heartbeat:

[root@mysql-1 ~]# /etc/init.d/ldirectord stop
Stopping ldirectord Error [] reading file /etc/ha.d/ldirectord.cf at line 8: Unknown command service=mysql
[FAILED]
[root@mysql-1 ~]# /etc/init.d/heartbeat start
logd is already running
Starting High-Availability services:
Error [] reading file /etc/ha.d/ldirectord.cf at line 8: Unknown command service=mysql
[ OK ]

However, mysql client is installed (on both load balancers, mysql-1 and mysql4), as verified on mysql-1 with:

[root@mysql-1 ~]# mysql -u ldirector -h xxx.xxx.xxx.242 -P 3306 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.45 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

and on mysql4 with:

[root@mysql4 ~]# mysql -u ldirector -h xxx.xxx.xxx.243 -P 3306 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.45 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

So, using the installed mysql client on mysql-1 or mysql4, the two load balancers, I am able to connect to either of the two sql nodes just fine.

Here are all my configuration files:


From mysql-1 (cluster management, and primary load balancer):

/etc/modules:
ip_vs_dh
ip_vs_ftp
ip_vs
ip_vs_lblc
ip_vs_lblcr
ip_vs_lc
ip_vs_nq
ip_vs_rr
ip_vs_sed
ip_vs_sh
ip_vs_wlc

/etc/sysctl.conf:
# Kernel sysctl configuration file for Red Hat Linux
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

/etc/ha.d/ha.cf
logfacility local0
bcast
mcast eth0 225.0.0.1 694 1 0
auto_failback off
node mysql-1
node mysql4
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster

/etc/ha.d/haresources
mysql-1 ldirectord::ldirectord.cf \
LVSSyncDaemonSwap::master \
IPaddr2::192.168.0.105/24/eth0/192.168.0.255

/etc/ha.d/authkeys
auth 3
3 md5 mypassword

/etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes
virtual=192.168.0.105:3306
service=mysql
real=xxx.xxx.xxx.242:3306 gate
real=xxx.xxx.xxx.243:3306 gate
checktype=negotiate
login="ldirector"
passwd="ldirectorpass"
database="ldirectordb"
request="SELECT * FROM connectioncheck"
scheduler=wrr

From mysql4 (secondary load balancer):

/etc/modules
ip_vs_dh
ip_vs_ftp
ip_vs
ip_vs_lblc
ip_vs_lblcr
ip_vs_lc
ip_vs_nq
ip_vs_rr
ip_vs_sed
ip_vs_sh
ip_vs_wlc

/etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

/etc/ha.d/ha.cf
logfacility local0
bcast
mcast eth0 225.0.0.1 694 1 0
auto_failback off
node mysql-1
node mysql4
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster

/etc/ha.d/haresources
mysql-1 ldirectord::ldirectord.cf \
LVSSyncDaemonSwap::master \
IPaddr2::192.168.0.105/24/eth0/192.168.0.255

/etc/ha.d/authkeys
auth 3
3 md5 mypassword

/etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes
virtual = 192.168.0.105:3306
service = mysql
real = xxx.xxx.xxx.242:3306 gate
real = xxx.xxx.xxx.243:3306 gate
checktype = negotiate
login = "ldirector"
passwd = "ldirectorpass"
database = "ldirectordb"
request = "SELECT * FROM connectioncheck"
scheduler = wrr

From mysql-2 (sql node 1):

/etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Enable configuration of arp_ignore option
net.ipv4.conf.all.arp_ignore = 1
# When an arp request is received on eth0, only respond if that address is
# configured on eth0. In particular, do not respond if the address is
# configured on lo
net.ipv4.conf.eth0.arp_ignore = 1
# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_ignore = 1
# Enable configuration of arp_announce option
net.ipv4.conf.all.arp_announce = 2
# When making an ARP request sent through eth0 Always use an address that
# is configured on eth0 as the source address of the ARP request. If this
# is not set, and packets are being sent out eth0 for an address that is on
# lo, and an arp request is required, then the address on lo will be used.
# As the source IP address of arp requests is entered into the ARP cache on
# the destination, it has the effect of announcing this address. This is
# not desirable in this case as adresses on lo on the real-servers should
# be announced only by the linux-director.
net.ipv4.conf.eth0.arp_announce = 2
# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_announce = 2

/etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.0.105
NETMASK=255.255.255.255
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes


From mysql-3 (sql node 2):

/etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Enable configuration of arp_ignore option
net.ipv4.conf.all.arp_ignore = 1
# When an arp request is received on eth0, only respond if that address is
# configured on eth0. In particular, do not respond if the address is
# configured on lo
net.ipv4.conf.eth0.arp_ignore = 1
# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_ignore = 1
# Enable configuration of arp_announce option
net.ipv4.conf.all.arp_announce = 2
# When making an ARP request sent through eth0 Always use an address that
# is configured on eth0 as the source address of the ARP request. If this
# is not set, and packets are being sent out eth0 for an address that is on
# lo, and an arp request is required, then the address on lo will be used.
# As the source IP address of arp requests is entered into the ARP cache on
# the destination, it has the effect of announcing this address. This is
# not desirable in this case as adresses on lo on the real-servers should
# be announced only by the linux-director.
net.ipv4.conf.eth0.arp_announce = 2
# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_announce = 2

/etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.0.105
NETMASK=255.255.255.255
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes


I don't think I skipped anything in the tutorial, though I had to do a bit of switching of packages to try and make the tutorial work on Fedora (since it was written for debian). But I think I have all the package requirements for Fedora.

What other output can I include to help diagnose this? Any ideas on what's up?

Last edited by rwillie6; 10th November 2007 at 20:40.
Reply With Quote
Sponsored Links
  #2  
Old 11th November 2007, 14:58
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Quote:
Originally Posted by rwillie6
Stopping ldirectord Error [] reading file /etc/ha.d/ldirectord.cf at line 8: Unknown command service=mysql
[FAILED]
Try
Code:
service=mysqld
instead on Fedora.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 11th November 2007, 18:58
rwillie6 rwillie6 is offline
Junior Member
 
Join Date: Nov 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Good suggestion, though I can't test it

Ah, I didn't think of that. Unfortunately, I can't test it out now. I'm under a really right schedule and since I was stuck using heartbeat and ldirectord for load balancing, I decided to try a different solution. Since I'm using glassfish and my app is pure Java, HA-JDBC was easy to plugin and it handles the load-balancing and health checking quite well so far. If I end up going back to heartbeat and ldirectord, I'll definitely try mysqld. Thanks.
Reply With Quote
  #4  
Old 8th February 2008, 20:26
aboyz aboyz is offline
Junior Member
 
Join Date: Feb 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default I got the same error

Hre is my config file
ldirectord.cf
# Global Directives
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes
virtual=192.168.1.55:3306
service=mysql
real=192.168.1.48:3306 gate
real=192.168.1.49:3306 gate
checktype=negotiate
login="ld"
passwd="password"
database="lddb"
request="SELECT * FROM connectioncheck"
scheduler=wrr

Seem like line 8 is not right service=mysql
I tried service=mysqld still same error
I tried to remove all blank spaces still same error
I tried to move service=mysql under real=192.168.1.49:3306 gate
now it complain about the real=192.168.1.48:3306 gate

# Global Directives
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes
virtual=192.168.1.55:3306
real=192.168.1.48:3306 gate #line 8 error
real=192.168.1.49:3306 gate
service=mysql
checktype=negotiate
login="ld"
passwd="password"
database="lddb"
request="SELECT * FROM connectioncheck"

No matter what i put in always line 8? anyone got any solution to this?

thanks

scheduler=wrr
Reply With Quote
  #5  
Old 9th February 2008, 19:51
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

What'S the exact error message you're getting?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #6  
Old 6th June 2008, 00:05
petero petero is offline
Junior Member
 
Join Date: Jun 2008
Location: Poland
Posts: 4
Thanks: 0
Thanked 2 Times in 2 Posts
Default

>Stopping ldirectord Error [] reading file /etc/ha.d/ldirectord.cf at line 8: >Unknown command service=mysql
This error is due to formating, it took me some time to figure it out.
The serivce= mysql is probably connected to /etc/services which is correct.
If you have libmysqlclient15 or 14 installed, fixing right formating will do the trick like here:

---/etc/heartbeat/ldirectord.cf
# Global Directives
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes
#after virtual=... make TABS (or double spaces) in every line
virtual = 10.0.2.10:3306
  service = mysql
  real = 10.0.1.11:3306 gate
 real = 10.0.1.12:3306 gate
 checktype = negotiate
  login = "ldirector"
  passwd = "ldirector"
  database = "ldirectordb"
  request = "SELECT * FROM connectioncheck"
  scheduler = wrr
-------------------------end of file---
Hope this helps.

Peter
Reply With Quote
The Following User Says Thank You to petero For This Useful Post:
falko (6th June 2008)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to monitor the load balanced workload in apache cluster + mysql cluster ??? lychee_lch HOWTO-Related Questions 3 24th April 2007 20:17
Question about the hardware requirement for mysql cluster with load balancing??? johN5Five^ HOWTO-Related Questions 3 12th April 2007 18:06
MySQL Cluster On FC5 : error while unpacking from engine asyadiqin HOWTO-Related Questions 7 28th October 2006 18:37
Howto suggestion suse PhP ver 4 + Ver 5 wwparrish Suggest HOWTO 11 7th August 2006 14:29
Load balancing on Fedora Care 4 luxpops HOWTO-Related Questions 1 4th April 2006 19:14


All times are GMT +2. The time now is 03:53.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.