Linux NFS Mount optimization, Inotify+rsync real-time backup

Source: Internet
Author: User
Tags inotify rsync

to view the parameters of a client Mount

Force Uninstall


high concurrency can be achieved by explicitly adding noatimeto improve the performance of optimized I/O


Ro: Mount a file system in read-only mode

RW: mount a file system in a writable manner

Defaults(default): This is the default value in Fstab, including RW,suid,Dev,exec,auto, Nouser, andasync.

By default, the default is used.

Mount Mount Performance optimization parameter options

1, prohibit the update directory and file time stamp mount:

Mount-t Nfs-o Noatime,nodiratime 172.16.1.31:/data/mnt

2.safe and optimized mounting mode

Mount-t Nfs-o nosuid,noexec,nodev,noatime,nodiratime,intr,rsize=131072,wsize=131072 172.16.1.31:/data/mnt

3. Default Mount

Mount-t NFS 172.16.1.31:/data/mnt

If the local file system

Mount/dev/sdb1/mnt-o defaults,async,noatime,data=writeback,barrier=0


General 6.6 System can use the following parameters

Mount-t nfs-o nosuid,noexec,nodev,noatime,nodiratime, rsize=131072,wsize=131072 172.16.1.31:/data/mnt

but CentOS6.6 Default mount parameters performance is good.

Specific to the business needs to set

NFS Kernel Optimization recommendations (server side):

NFS kernel tuning; adjusting the receive / send socket buffer size
Cat/proc/sys/net/core/rmem_default Default
Cat/proc/sys/net/core/rmem_max Max

Cat/proc/sys/net/core/wmem_default Default
Cat/proc/sys/net/core/wmem_max Max

The corresponding command for the above file is as follows:

Cat >>/etc/sysctl.conf<<eof

Net.core.wmem_default = 8388608

Net.core.rmem_default = 8388608

Net.core.wmem_max = 16777216

Net.core.rmem_max = 16777216

Eof

execution sysctl-p effective

Enterprise Scenario NFS shared storage Optimizations:

1, SSD, multi-block,raid5/raid10. Network card at least gigabit (multi-block bond)

2. configuration file:

All_squash Regardless of the identity of the user who logged on to NFS, his identity will be compressed into an anonymous user, usually the nobody

Anonuid can set the value of this UID itself , this uid must be present in your /etc/passwd
Anongid with Anonuid, but became GroupID .
Sync data synchronously written to memory and hard disk
Async data is stored in memory rather than directly to the hard disk

3. Client Mount Optimization configuration command:

Mount-t nfs-o nosuid,noexec,nodev,noatime,nodiratime, rsize=131072,wsize=131072 172.16.1.31:/data/mnt

Balancing performance security

NFS Benefits:

Simple, easy to get started

The data in the NFS file system is on the filesystem, which means the data can be seen

Fast deployment, easy maintenance, controllable

Reliable, high data reliability from a software perspective

Very stable Service

NFS Limitations:

there is a single point of failure, if NFS Server is down and inaccessible (can be compensated by high availability)

Big Data High concurrency scenarios, limited performance (2 million / day PV sites are not bottlenecks)

Client authentication is based on IP and host name, permissions to identify according to the ID, security generally (for the intranet is not a problem)

NFS data is plaintext andNFS itself does not validate data integrity

multiple client computers mount a Server for NFS, connection management is cumbersome to maintain (high coupling), especially after the NFS service end problem,

all clients are in a dead state (test environment available AutoFS Automatic mount resolution, formal environment repairable NFS or forced offload)

production scenarios should be more data access to push forward, as far as possible to the static storage of resources through Service for CDN or cache servers

Showmount is typically used to check the NFS server shared directory from an NFS client with the following common parameters

- e display directory listing for NFS server output

- D show shared directories provided by Server for NFS

Exportfs Command

The EXPORTFS-RV command is equivalent to/etc/init.d/nfs reload

Exportfs-o rw,sync,all_squash,anonuid=888,anongid=888 10.0.0.0/24:/data

What are the eggs for???


Firewall control

General intranet environment, do not need, if you want to configure, two choose one


This source is very special.

common File system events that inotify can monitor include:
In_access: file is accessed
In_modify: File is modified
In_attrib, file attributes are modified
In_close_write, file opened in writable mode is closed
In_close_nowrite, file opened in non-writable mode is closed
In_open, file is open
In_moved_from, files are removed from the monitored directory
In_moved_to, files are moved into the monitored directory
In_create, create a new file or subdirectory in the monitored directory
In_delete, file or directory is deleted
In_delete_self, self-deletion, that is, an executable file deletes itself when executed
In_move_self, self-moving, that is, an executable file moves itself at execution time

Test creation

Test Delete

test off - write

test shutdown - when writing, creation can also monitor


Simplified output


Sometimes the restart will fail , so put it in the rc.local.





Linux NFS Mount optimization, Inotify+rsync real-time backup

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.