Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use NFS service to achieve website data synchronization?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to use NFS service to achieve website data synchronization? This problem may be often seen in our daily work. Through this question, I hope you can gain more. Let's take a look at the solution with the editor today.

NFS service

NFS:network file system network file system, a protocol for sharing files between unix systems.

The client of NFS is mainly linux, which supports simultaneous mounting of multiple nodes and concurrent writes.

Prepare 3 servers:

Web1:192.168.2.1

Web2:192.168.2.2

Nas:192.168.2.3

Close selinux:sed-I'/ ^ SELINUX=/cSELINUX=disable' / etc/selinux/config

-I: directly modify the contents of the read file instead of outputting it to the terminal.

Turn off the firewall: systemctl stop firewalld.service; systemctl disable firewalld

1.nas (storage side)

1) installation service: yum-y install nfs-utils.x86_64

2) create a directory: [root@nas ~] # mkdir / webdata

3) write to the webpage file: [root@nas ~] # echo "nfs test." > / webdata/index.html

4) write configuration file: [root@nas ~] # vim / etc/exports

/ webdata 192.168.2.0 Universe 24 (rw,sync,no_root_squash)

Rw: read and write

Sync: write data to memory and hard disk at the same time to ensure no data loss

No_root_squash does not suppress root, and when a NFS client is accessed as a root administrator, it is mapped to the root administrator of the NFS server.

Configuration of 2.WEB1/WEB2:

1) View: [root@web1 ~] # showmount-e 192.168.2.3

Export list for 192.168.2.101:

/ webdata 192.168.2.0/24

2) installation service: yum-y install nfs-utils; yum-y install httpd

3) Mount: vim / etc/fstab

192.168.2.3:webdata / var/www/html nfs defaults 0 0

Mount-a

4) View df: 192.168.2.3:/webdata 18G 3.1G 15G 18% / var/www/html

3. Verification: no matter which WEB server you visit, the content of the web page you see is the same, achieving data synchronization.

****

On the use of NFS services to achieve website data synchronization methods to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report