[Gluster-users] Separating reads and writes for performance benefit

John Mark Walker johnmark at redhat.com
Fri Mar 23 17:15:28 UTC 2012


Hi guys,

This looks like a good Q&A thread to add to http://community.gluster.org/

Just a friendly reminder that we like to add more of these instructive dialogues to the Q&A site (it's "sticky" and google-friendly).

-JM


----- Original Message -----
> Hy,
> 
> I've further investigated your problem, and found a solution, with a
> test setup.
> 
> i've created a volume:
> # gluster volume create test replica 2 transport tcp node1:/brick
> node1:/brick2
> # gluster volume start test
> 
> then mounted with gluster:
> # mount.glusterfs node1:/test /mnt
> 
> mounted the brick directly to a read-only directory, with --bind:
> # mount --bind /brick ~/test_read_only
> # mount --bind -o remount,ro /brick ~/test_read_only
> 
> # touch ~/test_read_only/file
> touch: cannot touch `teszt/asd': Read-only file system
> 
> Becouse it's a bind mount to the native brick, on ext4 filesystem, it
> has better performance for read, than through cluster mount, and the
> read-only mount prevents any file writes. This works only if you
> need to access the files on the same machine, which the gluster
> runs.
> 
> Ps: sorry for my terrible english :)
> 
> --
> Üdvözlettel,
> Francsics Balázs
> Netrix Internet
> 
> 
> On Friday, March 23, 2012 at 9:12 AM, Haris Zukanovic wrote:
> 
> > Hi Francis,
> >  
> > Thanx for the suggestion..
> >  
> > I tried this. I set 644 owner root on the brick directory.
> > Apache is not able to read the PHP files from under the brick
> > folder.
> > 2012/03/23 09:04:32 [crit] 15752#0: *137813 stat()
> > "/var/www/gluster-application-read-only/www/staging/failover-test/web/server-health.php"
> > failed (13: Permission denied), client: *.*.107.216, server:
> > *.failover.myserver.com (http://failover.myserver.com), request:
> > "GET /server-health.php HTTP/1.1", host:
> > "test.failover.myserver.com (http://test.failover.myserver.com)"
> >  
> > Apache seems to be unable to change into brick dir since it has no
> > x permission.
> > If I set the x for other users (apache) on the brick then since
> > apache user is owner of all the files it will be able to overwrite
> > it also using the path directly through the brick.
> > I maybe missing something?
> >  
> >  
> >  
> > On 23/03/12 08.20, Francsics Balázs wrote:
> > > Gluster runs on the gluster user, right? If you set the brick
> > > permission to 644, and you read the files with a different user,
> > > you cannot write to the dir.
> > >  
> > > --
> > > Francsics Balázs
> > > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> > >  
> > >  
> > > On 2012. March 22., Thursday at 22:18, Haris Zukanovic wrote:
> > >  
> > > > Great to hear that...
> > > > All my tests so far have also confirmed that there are no
> > > > problems when you only read from the brick dir.
> > > > However, I would like somehow to prevent accidentals writes if
> > > > possible. Do you have any suggestions on how to accomplish
> > > > that?
> > > > In fact, I am unable to allow writes to a file through the
> > > > Gluster mount and allow to read but not write on the brick
> > > > directory directly.
> > > >  
> > > >  
> > > >  
> > > > On 22/03/12 20.47, winyaa at gmail.com (mailto:winyaa at gmail.com)
> > > > wrote:
> > > > > If you are on the same machine, which the gluster runs from,
> > > > > and you are using replicated setup, you can read from the
> > > > > brick directly, but avoid to write into the brick dir,
> > > > > becouse it leads to data inconsistency.
> > > > > 2012.03.22. 20:06, "Haris Zukanovic"
> > > > > <haris.zukanovic74 at gmail.com
> > > > > (mailto:haris.zukanovic74 at gmail.com)> ezt írta:
> > > > > > Thanx for your input...
> > > > > > Do you mean that I should mount the brick through NFS to
> > > > > > make the brick read-only? I would like to avioid that. I
> > > > > > am on the same physical machine where the brick is.
> > > > > >  
> > > > > >  
> > > > > > On 22/03/12 19.56, Berend de Boer wrote:
> > > > > > > > > > > > "Haris" == Haris
> > > > > > > > > > > > Zukanovic<haris.zukanovic74 at gmail.com
> > > > > > > > > > > > (mailto:haris.zukanovic74 at gmail.com)> writes:
> > > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > >  
> > > > > > > >  
> > > > > > >  
> > > > > > > Haris> Anyhow, everything seems to work fine for now but
> > > > > > > the read
> > > > > > > Haris> performance is a problem.
> > > > > > >  
> > > > > > > Try mounting the volume with nfs and see if that improves
> > > > > > > things.
> > > > > >  
> > > > > > --
> > > > > > --
> > > > > > Haris Zukanovic
> > > > > >  
> > > > > > _______________________________________________
> > > > > > Gluster-users mailing list
> > > > > > Gluster-users at gluster.org
> > > > > > (mailto:Gluster-users at gluster.org)
> > > > > > http://gluster.org/cgi-bin/mailman/listinfo/gluster-users
> > > > >  
> > > >  
> > > >  
> > > > -- -- Haris Zukanovic
> >  
> > -- -- Haris Zukanovic
> 
> 
> _______________________________________________
> Gluster-users mailing list
> Gluster-users at gluster.org
> http://gluster.org/cgi-bin/mailman/listinfo/gluster-users
> 



More information about the Gluster-users mailing list