NFS single point of failure and in-depth optimization solutions, nfs single point of failure depth

Source: Internet
Author: User
Tags inotify

NFS single point of failure and in-depth optimization solutions, nfs single point of failure depth

#### Host:
Backup nfs01

#### System environment:

[Root @ backup ~] # Cat/etc/redhat-release CentOS release 6.8 (Final) [root @ backup ~] # Uname-r2.6.32-642. el6.x86 _ 64 [root @ backup ~] #/Etc/init. d/iptables statusiptables: Firewall is not running. [root @ backup ~] # GetenforceDisabled #### installation package yum install keepalived-y
-------------------------------------------------
-------------------------------------------------
#### Keepalived configuration file
### Backup
global_defs {   router_id LVS_02}vrrp_script check_nfs {           script "/server/scripts/check_nfs.sh"  interval 2   weight 2}vrrp_instance VI_1 {    state BACKUP    interface eth1    virtual_router_id 100    priority 100    advert_int 1    authentication {        auth_type PASS        auth_pass 1111    }    virtual_ipaddress {     172.16.1.3/16 dev eth1 label eth1:1    }  track_script {              check_nfs  }}
---------------------------------------------------
---------------------------------------------------
### Nfs01
global_defs {   router_id LVS_01}vrrp_script check_nfs {           script "/server/scripts/check_nfs.sh"  interval 2   weight 2}vrrp_instance VI_1 {    state MASTER    interface eth1    virtual_router_id 100    priority 150    advert_int 1    authentication {        auth_type PASS        auth_pass 1111    }    virtual_ipaddress {     172.16.1.3/16 dev eth1 label eth1:1    }  track_script {              check_nfs  }}

----------------------------------------------
----------------------------------------------


#### Modify the backup rsyncd. conf configuration file

######rsync_config_______________start##rsyncd.conf start##uid = wwwgid = wwwuse chroot = nomax connections = 200timeout = 300pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.logignore errorsread only = falselist = falsehosts allow = 172.16.1.0/24#hosts deny = 0.0.0.0/32auth users = rsync_backupsecrets file = /etc/rsync.password[backup]path = /backup/[nfsbackup]path = /nfsbackup/[web01backup]path = /web01backup/[data]path = /data#rsync_config_______________end


#### Add a module/data
--------------------------------------------------
--------------------------------------------------

#### Add a user

useradd -s /sbin/nologin -M -u888 wwwid wwwmkdir /datachown -R www.www /web01backup /nfsbackup /backup /data
 

#### Modify the sersync configuration file of nfs01 and change the rsync module to data

<?xml version="1.0" encoding="ISO-8859-1"?>

-------------------------------------------------------------------------
#### Start the rpcbind nfs service in backup and share the/data Directory

[root@backup data]# cat /etc/exports #share /data by oldboy for bingbing at 20160425/data/www 172.16.1.0/24(rw,sync,all_squash,anonuid=888,anongid=888)/data/bbs 172.16.1.0/24(rw,sync,all_squash,anonuid=888,anongid=888)/data/blog 172.16.1.0/24(rw,sync,all_squash,anonuid=888,anongid=888)

#### Start the service

chkconfig rpcbind onchkconfig nfs on


#### Change the web Service Mount ip address to 172.16.1.3

umount -lf /application/nginx-1.10.2/html/www/uploadsumount -lf /application/nginx-1.10.2/html/bbsumount -lf /application/nginx-1.10.2/html/blog/wp-content

 

#### NFS client kernel Optimization

cat >>/etc/sysctl.conf<<EOFnet.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216EOFsysctl -p


#### Client mounting Optimization

mount -t nfs -o nosuid,noexec,nodev,noatime,nodiratime,rsize=131072,wsize=131072 172.16.1.3:/data/www /application/nginx-1.10.2/html/www/uploadsmount -t nfs -o nosuid,noexec,nodev,noatime,nodiratime,rsize=131072,wsize=131072 172.16.1.3:/data/bbs /application/nginx-1.10.2/html/bbsmount -t nfs -o nosuid,noexec,nodev,noatime,nodiratime,rsize=131072,wsize=131072 172.16.1.3:/data/blog /application/nginx-1.10.2/html/blog/wp-content


#### Solve the problem that the nfs service stops keepalived and does not jump to backup. Compile a script

[root@m01 storage]# cat check_nfs.sh #!/bin/bashif [ `showmount -e localhost|wc -l` -lt 4 ];then   /etc/init.d/keepalived stopfi


#### Start the service and add it to auto-start upon startup

/etc/init.d/keepalived startchkconfig keepalived on

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.