LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-08-2010, 04:06 AM   #1
chobong
Member
 
Registered: Jan 2010
Posts: 83

Rep: Reputation: 15
Please help to load balancing httpd and mysqld with keepalived


Dear All,

I have 4 servers:
- One is loadbalancer, installed keepalived and ipvsadm - LV1
- One is failover for loadbalancer, installed keepalived and ipvsadm too - LV2
- The other servers was installed httpd and mysqld. (RealServer)
LV1 load balancing for both httpd and mysql. And it's working fine.
VIP for http: 192.168.1.110
VIP for mysql: 192.168.1.111

Now I want to setup a website on RealServers , with URL is http://192.168.1.110, and this website connect to mysql via VIP 192.168.1.111, this means real servers will connect to their mysql via load balancer (LV!).
I tried to connect mysql via VIP from real server but it cannot.

Please help me if I can make this?
Thanks so much!!

Last edited by chobong; 09-08-2010 at 04:49 AM.
 
Old 09-08-2010, 07:27 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Maybe start with tcpdump on LV1 and watch port 3306 (I think), it may not be routing between VIP's

cheers
 
Old 09-08-2010, 11:08 PM   #3
chobong
Member
 
Registered: Jan 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks a lot, kbp.

Actually, when I stand at RealServer1 and connect to VIP:mysql, it's ok at the first, but not ok at the second, and ok at the third... RealServer2 is the same.
I think when a RealServer connect to its mysql, it's NOT ok.
But when a RealServer connect to mysql of the other, it's ok.

I don't know why...
Could you please let me know how to route between VIP?
 
Old 09-08-2010, 11:20 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Are you doing active/passive load balancing for mysql or active/active ?
 
Old 09-08-2010, 11:23 PM   #5
chobong
Member
 
Registered: Jan 2010
Posts: 83

Original Poster
Rep: Reputation: 15
I did keepalived with roundrobin for load balancing mysql. That is your mean?
Uhm, mysql is being active at both two realservers..

Last edited by chobong; 09-08-2010 at 11:58 PM.
 
Old 09-09-2010, 04:52 AM   #6
chobong
Member
 
Registered: Jan 2010
Posts: 83

Original Poster
Rep: Reputation: 15
And Im having a trouble with keepalived.
Status is MASTER on both LV1 and LV2, not MASTER and BACKUP.
Ipvsadm is still working fine !!

In the log message on two servers
Code:
[root@localhost ~]# tail /var/log/messages
Sep  9 22:46:13 localhost Keepalived_vrrp: cant bind to device eth0. errno=9. (try to run it as root)
Sep  9 22:46:13 localhost Keepalived_vrrp: VRRP_Instance(VI) Transition to MASTER STATE
Sep  9 22:46:14 localhost Keepalived_vrrp: VRRP_Instance(VI) Entering MASTER STATE
Sep  9 22:46:14 localhost Keepalived_vrrp: VRRP_Instance(VI) setting protocol VIPs.
Sep  9 22:46:14 localhost Keepalived_vrrp: VRRP_Instance(VI) Sending gratuitous ARPs on eth0 for 192.168.1.110
Sep  9 22:46:14 localhost Keepalived_vrrp: VRRP_Instance(VI) Sending gratuitous ARPs on eth0 for 192.168.1.111
Sep  9 22:46:14 localhost Keepalived_vrrp: Remote SMTP server [127.0.0.1:25] connected.
Sep  9 22:46:15 localhost Keepalived_vrrp: SMTP alert successfully sent.
Sep  9 22:46:19 localhost Keepalived_vrrp: VRRP_Instance(VI) Sending gratuitous ARPs on eth0 for 192.168.1.110
Sep  9 22:46:19 localhost Keepalived_vrrp: VRRP_Instance(VI) Sending gratuitous ARPs on eth0 for 192.168.1.111
And here is my configuration
Code:
vrrp_instance VI {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 120
    nopreempt
    smtp_alert
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.1.110
        192.168.1.111
    }
}
At this time, LV1 load balancing, but at other time, LV2 load balancing...
Please help me.
Thank you so much!
 
Old 09-09-2010, 05:11 AM   #7
chobong
Member
 
Registered: Jan 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Please forget about latest reply!

That is because I didn't allow multicast IP 224.0.0.8 and protocol 112 in iptables.
Just add lines which listed below in iptables and restart it.
Code:
-A RH-Firewall-1-INPUT -i eth0 -d 224.0.0.0/8 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth0 -p 112 -j ACCEPT
Refer this link: http://www.cyberciti.biz/faq/linux-u...orking-or-not/
 
Old 09-10-2010, 05:04 AM   #8
chobong
Member
 
Registered: Jan 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chobong View Post
Thanks a lot, kbp.

Actually, when I stand at RealServer1 and connect to VIP:mysql, it's ok at the first, but not ok at the second, and ok at the third... RealServer2 is the same.
I think when a RealServer connect to its mysql, it's NOT ok.
But when a RealServer connect to mysql of the other, it's ok.

I don't know why...
Could you please let me know how to route between VIP?
Anyone knows? Please help me ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WARNING! Loop detected httpd -> mysqld. prcsys.log GlennsPref Linux - Server 0 06-23-2009 03:29 AM
LXer: High-Availability Load Balancer With HAProxy/Keepalived On Debian Lenny LXer Syndicated Linux News 0 06-16-2009 12:11 PM
[SOLVED] rc.httpd and rc.mysqld break startup scripts geek745 Slackware 27 02-11-2009 11:45 AM
A lot of agetty, httpd and mysqld processes ilhbutshm Slackware 3 09-04-2006 12:49 PM
disabling mysqld and httpd webinsek Linux - Newbie 3 03-25-2006 12:13 PM


All times are GMT -5. The time now is 06:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration