SUSE LINUX Enterprise & openSUSE Community
มิถุนายน 16, 2019, 04:34:57 AM *
ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
ส่งอีเมล์ยืนยันการใช้งาน?

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
ข่าว:
 
   หน้าแรก   ช่วยเหลือ ค้นหา เข้าสู่ระบบ สมัครสมาชิก  

[Why we need your support] SUSE and openSUSE are trademarks of Attachmate Group, Inc. - WE ARE NOT IN ANY WAY ASSOCIATED WITH SUSE AND ATTACHMATE GROUP. SUSEThailand.com is a SUSE Linux user and community found in Thailand but not limited to other country suse linux user to join in. Currently active contents (How to's, Scripts, Tips, Tricks, Tutorials, Linux Command Line, and Troubleshooting) this suse linux how to's and expert support are SUSE Linux.
หน้า: [1]   ลงล่าง
  พิมพ์  
ผู้เขียน
หัวข้อ: Setup a Linux Highly Availability NFS servers  (อ่าน 1937 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
Sontaya
Administrator
Expert : ผู้เชี่ยวชาญ
*****

Karma: +1/-0
ออฟไลน์ ออฟไลน์

กระทู้: 1931


Administrator


เว็บไซต์
« เมื่อ: กุมภาพันธ์ 18, 2011, 03:44:50 PM »


In this tutorial I will describe how to set up a Linux Highly Availability(HA) NFS servers using SuSE Linux Enterprise Server 10 SP2. In order to make Linux HA NFS failover work, you’re require “sm-notify” utility, basically sm-notify will send out Network Status Monitor(NSM) reboot notifications.

Here are the steps to prepare automated NFS failover.

Server setup details:

Hostname: ServerNFS01
IP Address: 10.10.10.11

Hostname: ServerNFS02
IP Address: 10.10.10.12

Linux HA Virtual Hostname: servernfs01
IP Address 10.10.10.10

NFS Client Hostname NFSclient01
IP Address: 10.10.10.13

Require RPM:
nfs-utils
util-linux
heartbeat
portmap

The /data directory is a Linux HA share drive sitting on /dev/sdb1(ext3) and contains NFS share drive.

Create a new partition using fdisk
$ fdisk /dev/sdb

Format /dev/sdb1 as ext3
$ mkfs.ext3 /dev/sdb1

Create new folder /data
$ mkdir /data

Linux HA configuration file:
$ /etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility local0
node servernfs01
node servernfs02
keepalive 2
warntime 30
deadtime 60
initdead 120
udpport 694
ucast eth0 10.10.10.11
ucast eth0 10.10.10.12
auto_failback off
respawn hacluster /usr/lib/heartbeat/ipfail
watchdog /dev/watchdog

$ /etc/ha.d/authkeys
auth 2
2 sha1 NFS_test!

$ /etc/ha.d/haresources
servernfs01 10.10.10.10\
Filesystem::/dev/sdb1::/data::ext3 \
service

$ cat /etc/ha.d/resource.d/service

โค๊ด:
---------------------------------------------------------------------------------------------------------------
# Script START here
# service – Linux HA stop and start script
#

usage(){
# Spit out usage message
#
cat <
USAGE:

$(basename $0) start
$(basename $0) stop
MSG
exit
}

# Main
#

if [ "$(id -u)" != 0 ]; then
echo "Error: Must be root to run this program."
exit
fi

if [ "$#" != 1 ];then
usage
fi

case $1 in
'start')
echo -n Starting NFS . . .

#Restarting NFS server
/etc/init.d/nfsserver restart

#Virtual IP
/sbin/sm-notify -v 10.10.10.10

;;
'stop')
echo -n Stopping NFS . . .

#Stopping NFS server
/etc/init.d/nfsserver stop

#Virtual IP
/sbin/sm-notify -v 10.10.10.10
;;
esac

# Script END here
---------------------------------------------------------------------------------------------------------------

Virtual IP Address Information:
eth0:0 Link encap:Ethernet HWaddr 00:50:56:BA:7B:CC
inet addr:10.10.10.10 Bcast:10.10.225.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:177 Base address:0x1424

Move existing NFS server files to Linux HA share drive
$ mv /var/lib/nfs /data
$ mv /etc/exports /data


Create a symbolic link for NFS server

$ ln -s /data/nfs /var/lib/nfs
$ ln -s /data/exports /etc/exports


$ cat /etc/exports

/data 10.10.10.0/255.255.255.0(rw,no_root_squash,no_all_squash,sync)

For ServerNFS01 & ServerNFS02, you’re require
$ chkconfig nfsserver off
$ chkconfig portmap on
$ chkconfig nfsboot off
$ chkconfig nfs off
$ chkconfig heartbeat on


Please make sure you have NFS services ON for your NFS client machine – NFSclient01

$ chkconfig nfs on

Let’s start TESTING ….
1. Login to NFSclient01 and type mkdir /data ; mount -t nfs 10.10.10.10:/data /data

2. Type mount and you should see /data mounted on NFS.
10.10.10.10:/data on /data type nfs (rw,addr=10.10.10.10)

3. Power Off ServerNFS01 immediately.

4. Linux HA will take over by ServerNFS02.

3. Type ifconfig on ServerNFS02 and you should able to see virtual IP address – 10.10.10.10(please wait for a while to see it running).

4. Type /etc/init.d/nfsserver status and you should see NFS server running on node2.

5. Go back to NFSclient01, type ls -l /data or mount and you should see as usual which is mounted on virtual IP address 10.10.10.10 on ServerNFS02.

Congratulations! You’re done!

Reference
- http://www.planetmy.com/blog/setup-a-linux-highly-availability-nfs-servers/
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า

ageLOC Technology
หน้า: [1]   ขึ้นบน
  พิมพ์  
 
กระโดดไป:  

(@)2007 SUSE Linux user community found in Thailand. This site is not an official openSUSE and SUSE website, and is not in any way affiliated with or endorsed by SUSE Linux GmbH or Novell. openSUSE and SUSE are trademarks of Novell, Inc. in the United States and other countries.
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
หน้านี้ถูกสร้างขึ้นภายในเวลา 0.037 วินาที กับ 20 คำสั่ง (Pretty URLs adds 0.008s, 2q)