Date: Tue, 11 Nov 2008 13:55:52 +0100 From: "Andrei Manescu" <mandrei05@gmail.com> To: freebsd-cluster@freebsd.org Subject: Re: freebsd-cluster Digest, Vol 113, Issue 1 Message-ID: <c49c95c20811110455i755ca44clfc00edc452631957@mail.gmail.com> In-Reply-To: <20081111120014.E885010656D4@hub.freebsd.org> References: <20081111120014.E885010656D4@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, I tried these solutions separately in test environments, but they should work together: A) For load balancing you can use CARP + 2 VHID. Each node being master for 1 vhid. This way, when one node fails, the other one will take both "service" ip (vhid). 1 example here: http://blas.phemo.us/articles/2007/04/04/setting-up-and-configuring-carp-interfaces-on-freebsd(but I would recommend you to read the manuals + 3-4 other links). B) As for Mysql, you can use the dual master configuration. Be very carefull here. This procedure is based on mysql internal binary logs to replicate each entry from one node to the other. You will need to play with * auto_increment_offset* option from MySQL (otherwise auto_incremented columns will be screwed up). You have a lot to read, but it's worth it. Here are some links for mysql dual master replication: http://forums.mysql.com/read.php?26,100718,100718 http://mediakey.dk/~cc/howto-do-mysql-replication-dual-master-multi-master/ http://www.lefred.be/?q=node/45 I know that this is not a very efficient method for load-balancing but at least it offers redundancy & a little load balancing. C) Unless I miss something, you configure your PHP scripts to point to localhost/service IP (VHID)/nodes fixed ip address for mysql connection. D) PHP & other web programming languages use sessions (depends on the websites that you'll be hosting) that are stored usually on /tmp of the server, so be carefull to have this in mind because some clients can loose their sessions if they're redirected to the second node, unless you do something about it (like rsync/nfs/csync/etc). E) You can youse a 3rd machine running PF as firewall that will do NAT for the nodes + port redirection + load balancing: Here is the example - http://www.openbsd.org/faq/pf/pools.html F) If your website(s) will use upload forms you will need to keep the Directory_roots of Apache from both nodes in sync or you can use shared storage (but I guess that's not your case). G) This solution does not offer automatic automatic failover mechanisms in case of service-failure. I mean that if mysql/apache processes will go down or crash on one node (some bug or they are stopped), but the node stays up, from cluster point of view everything will be ok. The master/firewall (point E) will still forward part of the incoming packets to this failed node. You need to use the nc-netcat command (get exit status) to check ports 80,3306 (or those that your apache/mysql will listen to) from both nodes and take action if one node is detected UP but apache is down (like change the port-forwarding rule or connect one of the node and transfer the CARP vhid from the node with apache not running). Example of how to run netcat to check if apache and mysql are running (Apache - Yes, mysql - No): # nc -w 1 localhost 80 >/dev/null 2>&1; echo $? 0 # nc -w 1 localhost 3306 >/dev/null 2>&1; echo $? 1 H) You could also use daemon-tools to monitor and restart apache+mysql processes in case they crash (of course, the start/stop procedure for both will be different from standard one). P.S.: I never used this complete configuration to say if it'll work, but this is how I would do it. P.S.2: If you are used to commercial clustering solutions, probably this will seem a little strange, as there are no scripts/commands to show the status of the cluster nodes/services, but you can make some scripts t If anyone has anything to add or to correct, please do it, as this would be important to me, also. Good luck. 2008/11/11 <freebsd-cluster-request@freebsd.org> > Send freebsd-cluster mailing list submissions to > freebsd-cluster@freebsd.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freebsd.org/mailman/listinfo/freebsd-cluster > or, via email, send a message with subject or body 'help' to > freebsd-cluster-request@freebsd.org > > You can reach the person managing the list at > freebsd-cluster-owner@freebsd.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of freebsd-cluster digest..." > > > Today's Topics: > > 1. Full picture for "Load Balacing MySQL, Apache" (Anh Pham Tuan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 11 Nov 2008 11:21:12 +0700 > From: "Anh Pham Tuan" <anhptnn@gmail.com> > Subject: Full picture for "Load Balacing MySQL, Apache" > To: freebsd-cluster@freebsd.org > Message-ID: > <e46552500811102021w5f007af4h4a6a56762c5486aa@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hello, > Does anybody give me a solution for this: > | > Load Balancer (IPVS, MySQL cluster management) > | > / \ > / \ > Apache Apache > MySQL MySQL > Howto install IPVS, MySQL cluster management? > How to configure 2 nodes including of Apache+MySQL? > Thanks in advance. > > > ------------------------------ > > _______________________________________________ > freebsd-cluster@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-cluster > To unsubscribe, send any mail to "freebsd-cluster-unsubscribe@freebsd.org" > > > End of freebsd-cluster Digest, Vol 113, Issue 1 > *********************************************** >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c49c95c20811110455i755ca44clfc00edc452631957>