In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
# # access Network File sharing Service # #
# # Learning goals
Mount network sharing
Automatically mount network sharing
1.1 mount network file system
A network file system is a file system provided by a network attached storage server to multiple hosts over the network, rather than by a block device, such as a hard disk drive. Clients access remote storage through special file system protocols and formats
There are two main protocols available in Linux to access the network file system: NFS and CIFS. NFS (Network File System) can be thought of as a standard file system for Linux, UNIX, and other similar operating systems. CIFS (Comon Internet File System) is a standard network file system for Microsoft Windows systems.
Three basic steps to access network sharing
-1. Identify the remote share to be accessed
-2. Determine the mount point (where the share should be mounted) and create an empty directory of the mount point
-3. Mount the network file system through appropriate fame or configuration changes
1.2##CIFS: general Network File system
CIFS is a local network file system for the Microsoft Windows operating system.
Linux systems can mount and access CIFS file shares, just like common network file systems
It's the same. However, because CIFS is based on the NTFS file system permission model and itself
Authentication system, so everything in CIFS protocol is not very good
Map to Linux
The smbclient utility included in the samba-client RPM package can be used to identify the
A CIFS share provided by a Windows or Samba file server. The utility
It works like clicking a network neighbor in Microsoft Windows. And then mount
The command can be used to mount the share. Commands for accessing CIFS shar
-. Identification: # smbclient-L instructor.example.com
-2. Determine the mount point: # mkdir / remote2
-3. Mount: # mount / / instructor.example.com/ftp / remote2
1.3##NFS: network file system
NFS (Network File System) is an Internet standard protocol used by Linux, UNIX, and other similar operating systems and can be used as their local network file system. It is an open standard under the active extension that supports local Linux permissions and file system functions
Red Hat Enterprise Linux 7 supports NFSv4 (version 4 of the protocol) by default and automatically fallback to NFSv3 and NFSv2 if that version is not available. For all versions of NFS running on the client, two services should be enabled: rpcbind and nfslock. NFSv4 uses the TCP protocol to communicate with the server, while earlier versions of NFS may use TCP or UDP
There are two ways to determine the NFS export, or file sharing, provided by the server. If the server supports NFSv3 or NFSv2, you can use the showmount-eserver command to get a list of exported items. If the server supports NFSv4, you can mount / export items to an empty directory and browse the contents of all exported file systems
1.4 commands for accessing NFS exports
1. Identify
-# showmount-e instructor.example.com
two。 Determine the mount point
-# mkdir / remote1
3. Mounting
-# mount
Instructor.example.com:/var/ftp/pub / remote1
1.5 mount network storage automatically
Using the mount command, you need to have root privileges to connect to the network share. Alternatively, we can add entries to / etc/fstab, but the subsequent connection to the network server will always be active. When a program tries to access files in a network share, the automounter (or autofs) service can be configured to mount the network share "on demand". Automounter unmounts the share after it is no longer in use and is inactive for a certain period of time
The interval for inactivity defaults to five minutes, but it can be found in the
Make global changes in / etc/sysconfig/autofs
[root@instructor ~] # grep TIMEOUT / etc/sysconfig/autofs
# TIMEOUT-set the default mount timeout (default 600).
TIMEOUT=300
... output omitted....
In general, we need to use network shares to keep them mounted for a short period of time in an inactive state, so as to prevent them from being used again for a period of time. This avoids unnecessary mounting / unmounting cycles
In this section, we will introduce two ways to use the autoloader. First, use the special / net to automatically mount the mount point, and then manually configure the indirect auto-mount mapping. Special mapping / net
By default, when the autofs service runs, there is a special directory called / net, but it will be displayed as empty
Accessing a directory / net/instructor.example.com that does not exist causes the automounter to create the subdirectory and display all NFS exports on the NFS server. This is sometimes called "browsing" sharing
-# cd / net/instructor.example.com
-# ls
-home kickstart var
When all files and directories under / net/instructor.example.com are out of use and the timeout expires, autofs unmounts the share and removes the empty / net/instructor.example.com subdirectory
1.6 indirect mapping
* in addition to using the / net mapping, the system administrator can also manually configure any directory to mount a specific share "on demand" on its subdirectories during access. Example:
* indirect mapping uses two-tier profile syntax. In the top-level file
/ etc/auto.master, each managed "parent" directory and contains subdirectories
The name of a separate second configuration file shared by the mount point with the network is on one line.
-# cat / etc/auto.master
-/ demo / etc/auto.demo
-# cat / etc/auto.demo
-public-ro nfsserver.domain:/exported/path
-service autofs reloa
2.1 document # what is a network file sharing service
A network file system is a file system provided by a network attached storage server to multiple hosts over the network, rather than by fast devices. Clients access remote storage through special file system protocols and formats
2.2 universal network file system (suitable for cross-system use)
1. Install the samba service
Yum install samba-client-y
two。 Log in to the 172.25.254.250 server
Smbclient-L / / 172.25.254.250
3. Enter the westos1 directory of the 172.25.254.250 server
Smbclient / / 172.25.254.250/westos1
4. Mount the westos1 of 172.25.254.250 to the local / mnt directory. Because the anonymous usernames of the two systems are different, you have to add-o username=guest after the command.
Mount / / 172.25.254.250/westos1 / mnt-o username=guest
5. Power on and mount automatically
Edit the / etc/fstab file, append it after the file
/ / 172.25.254.250/westos1 / mnt cifs defaults,username=guest 0 0
2.3 document # network file system
1. Install the nfs service
Yum install nfs-utils-y
two。 View server mountable devices
Showmount-e 172.25.254.250
3. Mount the nfs1 on the 172.25.254.250 device to the / mnt directory on this machine
Mount 172.25.254.250:/nfsshare/nfs1 / mnt
4. Power on and mount automatically
Edit the boot auto mount file / etc/fstab and add the following command to the file
172.25.254.250:/nfsshare/nfs1 / mnt nfs defaults 0 0
2.4. Automatically mount network storage service
1. Install the automatic mount service
Yum install autofs-y
two。 Start the service
Systemctl start autofs.service
3. Indirect mapping directory
Customize mount shares on subdirectories on demand
Vim / etc/auto.master edit the main configuration file
/ westos / etc/auto.westos
Upper directory subconfiguration file of the final mount point
Vim / etc/auto.westos Edit Sub-profile
Nfs1 172.25.254.250:/nfsshare/nfs1 # # specify mount to / westos/nfs1
* 172.25.254.250 172.25.254.250:/nfsshare/ share & # # specify that any device should be mounted to any directory
Systemctl restart autofs.service # # restart the service
# # Mount to any directory of / mnt/
# # Mount to / westos/nfs2
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.