[Linux-cluster] how to mount a gfs2 volume on all our real webservers in /var/www/html

Alex linux at vfemail.net
Thu Jul 31 10:22:46 UTC 2008


On Thursday 31 July 2008 11:52, 张会光 wrote:
> This is a typical LVS model.

Indeed is a LVS. I have an router in front of rs1, rs2, rs3 webservers which 
is configured as LVS with load balancing.

> Do not add your httpd script and mount script into source in your
> cluster.conf

In redhat howto "Example of Setting Up Apache HTTP Server" they are saying to 
not start httpd server at boot time and leave the cluster to do that! Thats 
why i added http_service in my cluster.conf.

> What you should do is :
> 1.add your node into cluster.conf (I dont confirm whether should add
> fence device)

Node or nodes? I have already added rs2 and rs3 to my "httpcluster" in 
cluster.conf. If not necessary, i can remove http_service and docroot_gfs_mp 
service from my cluster.conf, but i have no idea how to automatically control 
mounting process of shared volume /dev/myvg1/mylv1 in /var/www/html on all 
our webservers which are part of "httpcluster". Also, httpd service should be 
started by the cluster or it should be started individually, at boot time by 
each realserver?

> 2.config your lvs.cf (in /etc/sysconfig/ha/)

lvs.cf is already configured and is working fine, balancing connections 
between rs1, rs2 and rs3 webservers. What i need is a centralized method to 
control and mount/umount mylv1, a gfs2 volume, as document root on all our 
webservers. Is that possible. If yes, how?

Probably, that will be enough to add manually a line in /etc/fstab on each 
rs1, rs2 and rs3 webservers to mount /dev/myvg1/mylv1 in /var/www/html, but 
this is an ugly solution. Does not exist any other elevated method to do 
this?

Can you or other people to clarify this aspect?

> 3.test.

I tested mounting mylv1 manually on rs2 and rs3 and is working.

[root at rs2 ~]# cat /etc/mtab |grep mylv1
/dev/mapper/myvg1-mylv1 /var/www/html gfs2 rw,hostdata=jid=0:id=262146:first=0 
0 0
[root at rs2 ~]#

[root at rs3 ~]# cat /etc/mtab |grep mylv1
/dev/mapper/myvg1-mylv1 /var/www/html gfs2 rw,hostdata=jid=1:id=262146:first=0 
0 0
[root at rs3 ~]#

Regards,
Alx

>
> Alex wrote:
> > Hello all,
> >
> > I have 3 real http servers running on centos-5.2 (rs1=192.168.113.3,
> > rs2=192.168.113.4, rs3=192.168.113.5) on which i want to mount some gfs2
> > volumes (mylv1 as /var/www/html and mylv2 as /var/www/cgi-bin).
> >
> > In my present setup, rs1 is still missing (will be added later).
> >
> > Using conga, i configured rs2 and rs3 to be part of "httpcluster".
> >
> > On all real webservers, mylv1 and mylv2 volumes are accessible:
> >
> > [root at rs2 ~]# lvscan
> >   ACTIVE            '/dev/myvg2/mylv2' [48.63 GB] inherit
> >   ACTIVE            '/dev/myvg1/mylv1' [48.63 GB] inherit
> > [root at rs2 ~]#
> >
> > [root at rs3 ~]# lvscan
> >   ACTIVE            '/dev/myvg2/mylv2' [48.63 GB] inherit
> >   ACTIVE            '/dev/myvg1/mylv1' [48.63 GB] inherit
> > [root at rs3 ~]#
> >
> > Using Conga and this howto, I added:
> > http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/en-US/RHEL510
> >/Cluster_Administration/s1-apache-inshttpd-CA.html
> >
> > 2 resources:
> > - httpd_script (type script, full_path_to_script=/etc/rc.d/init.d/httpd)
> > - docroot_gfs_mp (type gfs, mount_point=/var/www/html,
> > device=/dev/myvg1/mylv1)
> >
> > 2 services:
> > - http_service (which is linked to http_script resource and is
> > responsible to startup httpd servers aon all our nodes)
> > - docroot_mount (which is linked to docroot_gfs_mp and is responsible to
> > mount mylv1 on all our webservers in /var/www/html)
> >
> > The main problem is that: httpd service is started only on one node (now
> > on rs2=192.168.113.4), and mylv1 is mounted in /var/www/html on the same
> > node. If this node become unusable (is rebooted), httpd service is
> > started on rs3, and mylv1 is mounted there.
> >
> > What should be changed in my cluster.conf file, in order to have all
> > httpd servers started by "httpcluster" and mylv1 to be mounted in
> > /var/www/html on all our webservers?
> >
> > Here comes my present cluster.conf file:
> >
> > [root at rs2 ~]# cat /etc/cluster/cluster.conf
> > <?xml version="1.0"?>
> > <cluster alias="httpcluster" config_version="12" name="httpcluster">
> >         <fence_daemon clean_start="0" post_fail_delay="0"
> > post_join_delay="3"/>
> >         <clusternodes>
> >                 <clusternode name="192.168.113.5" nodeid="1" votes="1">
> >                         <fence/>
> >                 </clusternode>
> >                 <clusternode name="192.168.113.4" nodeid="2" votes="1">
> >                         <fence/>
> >                 </clusternode>
> >         </clusternodes>
> >         <cman expected_votes="1" two_node="1"/>
> >         <fencedevices/>
> >         <rm>
> >                 <failoverdomains/>
> >                 <resources>
> >                         <script file="/etc/rc.d/init.d/httpd"
> > name="httpd_script"/>
> >                         <clusterfs device="/dev/myvg1/mylv1"
> > force_unmount="0" fsid="35790" fstype="gfs2" mountpoint="/var/www/html"
> > name="docroot_gfs_mp" self_fence="0"/>
> >                 </resources>
> >                 <service autostart="1" exclusive="0" name="http_service">
> >                         <script ref="httpd_script"/>
> >                 </service>
> >                 <service autostart="1" exclusive="0"
> > name="docroot_mount"> <clusterfs fstype="gfs2" ref="docroot_gfs_mp"/>
> > </service>
> >         </rm>
> > </cluster>
> > [root at rs2 ~]#
> >
> > Regards,
> > Alx
> >
> > --
> > Linux-cluster mailing list
> > Linux-cluster at redhat.com
> > https://www.redhat.com/mailman/listinfo/linux-cluster




More information about the Linux-cluster mailing list