PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > mysql.general > Use of slave server for read only queries
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Use of slave server for read only queries

Réponse
 
LinkBack Outils de la discussion
Vieux 07/09/2007, 06h05   #1
Ashok Chauhan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Use of slave server for read only queries

Hi All,

I'm using Mysql 5 (with replication) on CentOS 4.4 OS with 2 CPU and 8GB
of RAM.
Master & Slave servers have same hardware configration.

Now i want to know, should i use slave server for fetching read only
queries.
if yes, then how ?.

Thanks
Ashok

  Réponse avec citation
Vieux 07/09/2007, 07h40   #2
Vetle Roeim
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Use of slave server for read only queries

On Fri, 07 Sep 2007 07:05:31 +0200, Ashok Chauhan <ashok.linux@gmail.com>
wrote:

> Hi All,
>
> I'm using Mysql 5 (with replication) on CentOS 4.4 OS with 2 CPU and 8GB
> of RAM.
> Master & Slave servers have same hardware configration.
>
> Now i want to know, should i use slave server for fetching read only
> queries.
> if yes, then how ?.


You could do it in the application logic, i.e. create a separate
connection to the slave server that you use for reading, or perhaps this
would be a good use of the MySQL Proxy <URL:
http://forge.mysql.com/wiki/MySQL_Proxy >.

In any case, you should be aware that the replication is not synchronous,
so there might be data on the master that has not yet been added to the
slave. Various things can affect this, such as heavy queries, for
instance. Wether or not this is a problem for you will depend on your
application.

One option could be to use slave servers for users or data where
up-to-date information is not necessarily required.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
  Réponse avec citation
Vieux 07/09/2007, 09h50   #3
dave@cpfc.org
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Use of slave server for read only queries

> On Fri, 07 Sep 2007 07:05:31 +0200, Ashok Chauhan <ashok.linux@gmail.com>
> wrote:
>
>> Hi All,
>>
>> I'm using Mysql 5 (with replication) on CentOS 4.4 OS with 2 CPU and 8GB
>> of RAM.
>> Master & Slave servers have same hardware configration.
>>
>> Now i want to know, should i use slave server for fetching read only
>> queries.
>> if yes, then how ?.

>
> You could do it in the application logic, i.e. create a separate
> connection to the slave server that you use for reading, or perhaps this
> would be a good use of the MySQL Proxy <URL:
> http://forge.mysql.com/wiki/MySQL_Proxy >.


This doesn't look like it will work just yet

http://forge.mysql.com/wiki/MySQL_Pr...from_writes.3F

Which is a real shame because I can't see that sqlrelay can do this either

http://sqlrelay.sourceforge.net/sqlr...lfailover.html

Dave

  Réponse avec citation
Vieux 07/09/2007, 17h26   #4
Augusto Bott
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Use of slave server for read only queries

It seems that the trunk version supports RO/RW splitting:
http://jan.kneschke.de/2007/8/1/mysq...-r-w-splitting and
http://jan.kneschke.de/2007/8/26/mys...-r-w-splitting

--
Augusto Bott

On 9/7/07, dave@cpfc.org <dave@cpfc.org> wrote:
>
> > On Fri, 07 Sep 2007 07:05:31 +0200, Ashok Chauhan <ashok.linux@gmail.com
> >
> > wrote:
> >
> >> Hi All,
> >>
> >> I'm using Mysql 5 (with replication) on CentOS 4.4 OS with 2 CPU and

> 8GB
> >> of RAM.
> >> Master & Slave servers have same hardware configration.
> >>
> >> Now i want to know, should i use slave server for fetching read only
> >> queries.
> >> if yes, then how ?.

> >
> > You could do it in the application logic, i.e. create a separate
> > connection to the slave server that you use for reading, or perhaps this
> > would be a good use of the MySQL Proxy <URL:
> > http://forge.mysql.com/wiki/MySQL_Proxy >.

>
> This doesn't look like it will work just yet
>
>
> http://forge.mysql.com/wiki/MySQL_Pr...from_writes.3F
>
> Which is a real shame because I can't see that sqlrelay can do this either
>
> http://sqlrelay.sourceforge.net/sqlr...lfailover.html
>
> Dave
>
>
> --
> MySQL Replication Mailing List
> For list archives: http://lists.mysql.com/replication
> To unsubscribe:
> http://lists.mysql.com/replication?u...bott@gmail.com
>
>


  Réponse avec citation
Vieux 07/09/2007, 21h46   #5
Shawn Green
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Use of slave server for read only queries

Ashok Chauhan wrote:
> Hi All,
>
> I'm using Mysql 5 (with replication) on CentOS 4.4 OS with 2 CPU and 8GB
> of RAM.
> Master & Slave servers have same hardware configration.
>
> Now i want to know, should i use slave server for fetching read only
> queries.
> if yes, then how ?.
>
> Thanks
> Ashok
>
>


The simple way is to use the --read-only startup parameter on the slave.
The only updates it will allow must come through replication or from a
SUPER user.

http://dev.mysql.com/doc/refman/5.0/...sqld_read_only



--
Shawn Green, Support Engineer
MySQL Inc., USA, www.mysql.com
Office: Blountville, TN
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ /
/ /|_/ / // /\ \/ /_/ / /__
/_/ /_/\_, /___/\___\_\___/
<___/
Join the Quality Contribution Program Today!
http://dev.mysql.com/qualitycontribution.html

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h28.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12186 seconds with 13 queries