红军二万五千里长征,事迹一出,震动当时。届时舆论无不热议。今之超级女声何以为比。学习centos
nfs,不时要查阅官方手册。centos的官方文档,自我感觉,比oracle官方文档更为简约,简真是图文并茂,通俗易懂。
寒暄了一点儿,以前的相关centos nfs学习笔记链接:
centos nfs学习笔记
主要主要讲述/etc/exports hostname的格式及相关选项
Hostname Formats
主机名可以采用的格式
The host(s) can be in the following forms:
通过下列形式表示主机名
? Single machine — A fully qualified domain name (that can be resolved
by the server),
hostname (that can be resolved by the server), or an IP address.
可以指定单个机器,采用可以正常解析的的域名形式或ip地址
? Series of machines specified with wildcards — Use the * or ? character
to specify a string
match. Wildcards are not to be used with IP addresses; however, they may
accidentally work
if reverse DNS lookups fail. When specifying wildcards in fully
qualified domain names, dots
(.) are not included in the wildcard. For example, *.example.com
includes one.example.com
but does not include one.two.example.com.
用模式匹配符指定一系列的机器(比如用*或?);但是如果反向dns查找失败,可能会导致
以这种类型配置的nfs出现问题.当用域名模式匹配指定一系列机器时,在模式匹配符中不能出现.符号。比如:
*.example.com可以包含one.example.com,但不包括 one.two.exapmple.com
? IP networks — Use a.b.c.d/z, where a.b.c.d is the network and z is the
number of bits in
the netmask (for example 192.168.0.0/24). Another acceptable format is
a.b.c.d/netmask,
where a.b.c.d is the network and netmask is the netmask (for
example,192.168.100.8/255.255.255.0).
也可以指定ip网络(一个ip子段)。体现为两种表现方式:192.168.121.8/22或者192.168.121.8
/255.255.255.0
? Netgroups — In the format @group-name, where group-name is the NIS
netgroup name.
采用@group_name格式,group_name是nis netgroup名字
7. The /etc/exports Configuration File
/etc/exports配置文件的内容
()
()... ---/etc/exports的格式内容。
export是导出的共享目录
host1及hostN为nfs
client
另外,一个export可以被多个host(也就是多个nfs client共享使用)
----下面例举一些以上options的用法及讲解
? ro — Mounts of the exported file system are read-only. Remote hosts
are not able to make
changes to the data shared on the file system. To allow hosts to make
changes to the file
system, the read/write (rw) option must be specified.
只读方式加载导出文件系统
? wdelay — Causes the NFS server to delay writing to the disk if it
suspects another write
request is imminent. This can improve performance by reducing the number
of times the disk
must be accessed by separate write commands, reducing write overhead.
The no_wdelay
option turns off this feature, but is only available when using the sync
option.
使用sync选项要和它一并使用才可行。用于让nfs server延时写入磁盘(如果发现有另一个写请求蛮紧急或要发生时)
这样减少了各个写命令必须访问磁盘的次数,进而提升了性能,减少了写的成本.同样,用no_wdelay选项
关闭这个功能。
? root_squash — Prevents root users connected remotely from having root
privileges and
assigns them the user ID for the user nfsnobody. This effectively
"squashes" the power of the
remote root user to the lowest local user, preventing unauthorized
alteration of files on the
remote server. Alternatively, the no_root_squash option turns off root
squashing. To squash
every remote user, including root, use the all_squash option. To specify
the user and group
IDs to use with remote users from a particular host, use the anonuid and
anongid options,
respectively. In this case, a special user account can be created for
remote NFS users to
share and specify (anonuid=,anongid=),
where is
the user ID number and is the group ID number.
防止root用户通过远程以root权限连接到nfs
server,给他们分配一个对应用户nfsnobody的uid,这样就控制了root用户权力,
限制到最低的本地用户权限。访问对于远程主机的文件系统进行未经授权的变更.同样,no_root_squash选项可以关闭这个功能.
为了压制或限制每个远程用户,使用all_squash选项。为了指定来自于特定主机的远程用户的uid和gid。在这种情况下,
这个特有的用户帐户信息会以用于共享的远程nfs用户来创建((anonuid=,anongid=),
这里uid-value是user id编号,gid-value同理
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-659939/
,如需转载,请注明出处,否则将追究法律责任。