Re: MySQL Clustering
- From: muhammad usman <usmanbsd@xxxxxxxxx>
- Date: Fri, 24 Mar 2006 13:23:52 -0800 (PST)
There is a very usefull book of O-Reilly on MySQL load
balancing.
And according to it you can have only on writeable SQL
server, and load balancing only works for read-only
queries.
but as Mr.Cody Baker suggested its better if you
configure your load balancer to make persistent
binding.
regards
usman
--- "L. Jason Godsey" <lannygodsey@xxxxxxxxx> wrote:
http://dev.mysql.com/doc/refman/5.0/en/replication-auto-increment.html
The following solves replication breaking over the
same auto int race
condition. This can happen because of fast inserts
from multiple hosts
connected to multiple back end servers (8 in my
case), or because of
disconnected operation.
The way I solved this in the past was using
composite keys. Instead of
just the auto integer field, I also used a server_id
field.
Prior to inserting anything into this database,
issue the query
set @server_id=@@server_id;, reuse the db connection
for the insert.
Sometimes you can use something like:
$query = "set @server_id=@@server_id; insert
into.....";
Don't skip the seemingly redundant, @server_id=@@
bit and go with
insert into VALUES (@@server_id)... then each server
doing the
replication will use it's own server_id which isn't
what you want.
create table users (
id int auto_increment,
server_id int,
login varchar(32),
pass varchar(32),
primary key (id,server_id)
);
create unique index _i_users_login on users (login);
mysql> set @server_id=@@server_id;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into users (server_id, login, pass)
values (@server_id,
'lanny', 'examples');
Query OK, 1 row affected (0.00 sec)
mysql> select * from users;
+----+-----------+-------+----------+
| id | server_id | login | pass |
+----+-----------+-------+----------+
| 1 | 2 | lanny | examples |
+----+-----------+-------+----------+
1 row in set (0.00 sec)
mysql> set @server_id=32; insert into users
(server_id, login, pass)
values (@server_id, 'lanny3', 'examples');
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
mysql> select * from users;
+----+-----------+--------+----------+
| id | server_id | login | pass |
+----+-----------+--------+----------+
| 1 | 2 | lanny | examples |
| 2 | 2 | lanny2 | examples |
| 3 | 32 | lanny3 | examples |
+----+-----------+--------+----------+
--- Cody Baker <cody@xxxxxxxxxxxxx> wrote:
If you're database is simply read only then theload balanced
situationthen your load
should work fine. If your database is read/write
balancer could cause you problems under certaincircumstances. If
yourfine. If, however,
updates are not time critical then it should be
your(ex. session data for
databases are used for a time critical updates
aalways hit the same
web page) then it's important that your users
database server because the replication can becomedelayed at times.
Ifyour database servers
the user has a random chance of hitting any of
then for example your user may add something totheir cart, and
refreshthe item missing from
the page connecting to another server, and find
their cart. Other no-nos for replicated databasesespecially on mysql
<has a solution for
5, are auto-incrementing fields in tables. 5.x
this
(
http://lists.freebsd.org/mailman/listinfo/freebsd-isp).<james@xxxxxxxxxxxxxxxxxxxxx> wrote:
Thank You,
Cody Baker
cody@xxxxxxxxxxxxx
http://www.wilkshire.net
Jon Simola wrote:
On 3/15/06, James Ryan
apologize if its
Not sure if this is the right list for this (I
not),under FreeBSD 5.x
but has anybody ran a MySQL 2+ node cluster
behind atips or warnings?
load balancer; and if so, could you offer any
clustering server setup,
If you're talking about the actual MySQL
I'vetoo large.
never had a chance to try it as our dataset is
round-robin master setup (A
I've run a pair of MySQL servers in a
rather well,slaves from B, B slaves from A) and that worked
replication was impressively quick.
--
Jon Simola
Systems Administrator
ABC Communications
_______________________________________________
freebsd-isp@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ispTo unsubscribe, send any mail to"freebsd-isp-unsubscribe@xxxxxxxxxxx"
_______________________________________________
freebsd-isp@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ispTo unsubscribe, send any mail to
"freebsd-isp-unsubscribe@xxxxxxxxxxx"
_______________________________________________
freebsd-isp@xxxxxxxxxxx mailing list
To unsubscribe, send any mail to
"freebsd-isp-unsubscribe@xxxxxxxxxxx"
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
freebsd-isp@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-isp
To unsubscribe, send any mail to "freebsd-isp-unsubscribe@xxxxxxxxxxx"
- References:
- Re: MySQL Clustering
- From: L. Jason Godsey
- Re: MySQL Clustering
- Prev by Date: Re: DSLAM
- Next by Date: udp packet problem
- Previous by thread: Re: MySQL Clustering
- Next by thread: experience with dell DRAC 4?
- Index(es):
Relevant Pages
|
|