1. Introduction to NFSIn the previous article, we explained that K8s mentioned NFS to uniformly store files generated by different Pods. The data volume in K8s directly supports NFS. You can directly specify the IP and directory of the NFS server. In this article, we will learn how to mount the NFS remote directory and mount the specified directories on different servers to the NFS server, which is similar to the shared folder in Windows, so that data can be shared between different servers. Let's experience NFS together. NFS is the abbreviation of Network File System, which means network file system in Chinese. Its main function is to allow different host systems to share files or directories through a network (usually a local area network). The NFS client (usually an application server, such as a web server) can mount the data directory shared by the NFS server to the local system of the NFS client (that is, under a certain mount point) by mounting. From the client's local perspective, the directory shared by the NFS server looks like the client's own disk partition or directory, but in fact it is a directory on the remote NFS server. 2. NFS ConstructionOverall architecture:
The purpose of this article is to ensure that files modified in 161 can be viewed or modified in 162 in a timely manner. 1. NFS server constructionInstall nfs and rpcbind yum -y install nfs-utils rpcbind Set up automatic startup chkconfig nfs on Or systemctl enable nfs.service chkconfig rpcbind on Or systemctl enable rpcbind.service Start the service service rpcbind start service nfs start Create a server-side shared directory and grant permissions mkdir -p /nfs/data && chmod -R 777 /nfs/data Configure exports file vi /etc/exports Add the following content, and pay attention to fill in the server's IP. /nfs/data 192.168.40.160(rw) /nfs/data/ *(insecure,rw,async,no_root_squash) Refresh configuration takes effect immediately exportfs -a View the mount directory showmount -e 192.168.40.160 At this point the server has been built. 2. NFS client constructionInstall nfs-utils yum install nfs-utils Create a directory and grant permissions mkdir -p /nfs/data && chmod -R 777 /nfs/data Hang in directory mount 192.168.40.160:/nfs/data /nfs/data If no error is reported at this point, it will hang on success. 3. TestingCreate the test.txt file on 161 and write some random content: Let's look at the data in 160 or 162: At this point, the NFS remote directory mount is successfully set up! This is the end of this article about the process of using NFS remote directory mounting in CentOS environment. For more relevant content about using NFS directory mounting in CentOS, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: PHP-HTMLhtml important knowledge points notes (must read)
Tomcat is a web server software based on Java lan...
This article uses the gearman+mysql method to imp...
Recently, due to the need to test security produc...
1. Problem introduction Assume a scenario where a...
npx usage tutorial Tonight, when I was learning V...
Table of contents Preface On-site investigation C...
Table of contents Error demonstration By computed...
1. ref is copied, the view will be updated If you...
Table of contents Boolean Type Number Types Strin...
This blog post is about a difficulty encountered ...
When talking about this issue, some people may ask...
In a recent project, I wanted to align text verti...
Table of contents 0x0 Introduction 0x1 Installati...
Use native js to implement a simple calculator (w...
Recently, when doing homework, I needed to nest a ...