RedHat5.5和Solaris10 Linux设置共享

=====================================RedHat 5.5======================================


鉴于现在用户一个项目一般都是用多台机器进行处理,那么对ArcGIS Server来说,尽管多台机器进行处理,但是地图切片的文件夹肯定是一个地方的,那么Linux的共享文件夹就需要大家掌握了,下面就试验一下怎么在Linux环境下设置共享文件夹。

机器1:RedHat,192.168.100.203 

机器2:RedHatA,192.168.100.204

目的:将RedHat机器里面的两个文件夹进行共享

1:将机器1的  /opt/arcgis/server10.0/server/serverdir  共享到机器2的 /opt/arcgis/server10.0/server/serverdir

2:将机器1的 /home/aaa 共享到机器2的/home/bbb


修改机器1的/etc/exports文件

/opt/arcgis/server10.0/server/serverdir  192.168.100.204(rw,no_root_squash,async
) 192.168.100.203(rw,no_root_squash,async)
/home/aaa 192.168.100.204(rw,no_root_squash,async) 192.168.100.203(rw,no_root_sq
uash,async)
相关格式:

共享路径   共享给机器IP(rw,no_root_squash,async)  共享给机器2 IP(rw,no_root_squash,async)


可以查看exportfs是否有输出信息


重启nfs和portmap服务

[root@RedHat ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@RedHat ~]# service portmap restart
Stopping portmap:                                          [  OK  ]
Starting portmap:                                          [  OK  ]


注意:Redhat6.1已经没有portmap服务了,可以使用rpcbind服务代替

设置机器2 

修改/etc/fstab,添加

192.168.100.203:/opt/arcgis/server10.0/server/serverdir /opt/arcgis/server10.0/server/serverdir nfs rsize=8192,wsize=8192,timeo=14,intr

192.168.100.203:/home/aaa   /home/bbb  nfs rsize=8192,wsize=8192,timeo=14,intr
格式:

共享机器的IP: 共享机器的路径     本机的映射路径  nfs rsize=8192,wsize=8192,timeo=14,intr

然后,使用mount  本机器的路径进行mount上

查询mount 会查看本机器的路径是否mount上

[root@RedHatA ~]# mount /home/bbb
[root@RedHatA ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.100.203:/home/aaa on /home/bbb type nfs (rw,rsize=8192,wsize=8192,timeo=                                                                                                             14,intr,addr=192.168.100.203)
[root@RedHatA ~]# mount /opt/arcgis/server10.0/server/serverdir/
[root@RedHatA ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.100.203:/home/aaa on /home/bbb type nfs (rw,rsize=8192,wsize=8192,timeo=                                                                                                             14,intr,addr=192.168.100.203)
192.168.100.203:/opt/arcgis/server10.0/server/serverdir on /opt/arcgis/server10.                                                                                                             0/server/serverdir type nfs (rw,rsize=8192,wsize=8192,timeo=14,intr,addr=192.168                                                                                                             .100.203)

相关测试:

在机器1上共享的路径下创建一个文件,在机器2的相关映射路径下能够看到。


=====================================Solaris 10======================================

以一台机器为例:我的/export/home路径下有四个文件夹:aaa、bbb、ccc、ddd

目的是:

共享/export/home/aaa  映射到/export/home/bbb

共享/export/home/ccc  映射到/export/home/ddd


修改/etc/dfs/dfstab文件

bash-3.00# vi /etc/dfs/dfstab


"/etc/dfs/dfstab" 12 lines, 430 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
share -F nfs -o /export/home/ccc
share -F nfs -o  /export/home/aaa
因为这是在本机测试,共享给本机这两个文件夹
share -F nfs -o  /export/home/aaa

如果是共享给另外一台或者两台机器

share -F nfs -o rw=app1:app2 /opt/arcgis/server/serverdir
share -F nfs -o rw=59.255.44.13 /opt/arcgis/server/serverdir
app1、app2、59.255.44.13这些都是共享目的机器的机器名和IP.


然后执行share命令

bash-3.00# share /export/home/aaa
bash-3.00# share /export/home/ccc
bash-3.00# share
-               /export/home/ccc   rw   ""
-               /export/home/aaa   rw   ""
我们可以看到这些文件夹已经共享上了


然后我们进行映射修改/etc/vfstab

bash-3.00# vi /etc/vfstab
"/etc/vfstab" 14 lines, 521 characters
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c0d0s1 -       -       swap    -       no      -
/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0        /       ufs     1       no      -
/dev/dsk/c0d0s7 /dev/rdsk/c0d0s7        /export/home    ufs     2       yes
-
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
192.168.205.140:/export/home/ccc - /export/home/ddd nfs - yes -
192.168.205.140:/export/home/aaa - /export/home/bbb nfs - yes -
相关格式

那个机器共享的IP:共享机器共享的路径 -  映射到本机的路径   nfs - yes -

192.168.205.140:/export/home/ccc - /export/home/ddd nfs - yes -
192.168.205.140:/export/home/aaa - /export/home/bbb nfs - yes -
如上所示,共享的/export/home/aaa文件夹,映射到/export/home/bbb即可


然后执行mount命令

bash-3.00# mount /export/home/ddd
nfs mount: mount: /export/home/ddd: Device busy
bash-3.00# mount /export/home/bbb
nfs mount: mount: /export/home/bbb: Device busy
bash-3.00# mount
/ on /dev/dsk/c0d0s0 read/write/setuid/devices/intr/largefiles/logging/xattr/one                                                                                                             rror=panic/dev=1980000 on Mon Jun 25 13:47:53 2012
/devices on /devices read/write/setuid/devices/dev=4780000 on Mon Jun 25 13:47:3                                                                                                             9 2012
/system/contract on ctfs read/write/setuid/devices/dev=47c0001 on Mon Jun 25 13:                                                                                                             47:39 2012
/proc on proc read/write/setuid/devices/dev=4800000 on Mon Jun 25 13:47:39 2012
/etc/mnttab on mnttab read/write/setuid/devices/dev=4840001 on Mon Jun 25 13:47:                                                                                                             39 2012
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4880001 on Mon Jun                                                                                                              25 13:47:39 2012
/system/object on objfs read/write/setuid/devices/dev=48c0001 on Mon Jun 25 13:4                                                                                                             7:39 2012
/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4900001 on Mon Jun 25                                                                                                              13:47:40 2012
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=1                                                                                                             980000 on Mon Jun 25 13:47:49 2012
/dev/fd on fd read/write/setuid/devices/dev=4a80001 on Mon Jun 25 13:47:53 2012
/tmp on swap read/write/setuid/devices/xattr/dev=4880002 on Mon Jun 25 13:47:55                                                                                                              2012
/var/run on swap read/write/setuid/devices/xattr/dev=4880003 on Mon Jun 25 13:47                                                                                                             :55 2012
/export/home on /dev/dsk/c0d0s7 read/write/setuid/devices/intr/largefiles/loggin                                                                                                             g/xattr/onerror=panic/dev=1980007 on Mon Jun 25 13:48:56 2012
/export/home/bbb on 192.168.205.140:/export/home/aaa remote/read/write/setuid/de                                                                                                             vices/xattr/dev=4b00006 on Mon Jun 25 14:46:42 2012
/export/home/ddd on 192.168.205.140:/export/home/ccc remote/read/write/setuid/de                                                                                                             vices/xattr/dev=4b00007 on Mon Jun 25 14:59:44 2012

相关测试:

在机器1上共享的路径下创建一个文件,在机器2的相关映射路径下能够看到。


=====================================取消======================================

取消mount
bash-3.00# umount /export/home/ddd
bash-3.00# mount
/ on /dev/dsk/c0d0s0 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=1980000 on Mon Jun 25 13:47:53 2012
/devices on /devices read/write/setuid/devices/dev=4780000 on Mon Jun 25 13:47:39 2012
/system/contract on ctfs read/write/setuid/devices/dev=47c0001 on Mon Jun 25 13:47:39 2012
/proc on proc read/write/setuid/devices/dev=4800000 on Mon Jun 25 13:47:39 2012
/etc/mnttab on mnttab read/write/setuid/devices/dev=4840001 on Mon Jun 25 13:47:39 2012
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4880001 on Mon Jun 25 13:47:39 2012
/system/object on objfs read/write/setuid/devices/dev=48c0001 on Mon Jun 25 13:47:39 2012
/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4900001 on Mon Jun 25 13:47:40 2012
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=1980000 on Mon Jun 25 13:47:49 2012
/dev/fd on fd read/write/setuid/devices/dev=4a80001 on Mon Jun 25 13:47:53 2012
/tmp on swap read/write/setuid/devices/xattr/dev=4880002 on Mon Jun 25 13:47:55 2012
/var/run on swap read/write/setuid/devices/xattr/dev=4880003 on Mon Jun 25 13:47:55 2012
/export/home on /dev/dsk/c0d0s7 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=1980007 on Mon Jun 25 13:48:56 2012
/export/home/bbb on 192.168.205.140:/export/home/aaa remote/read/write/setuid/devices/xattr/dev=4b00006 on Mon Jun 25 14:46:42 2012
我们看到,原来的/export/home/ddd已经没有mount了


取消共享

bash-3.00# share
-               /export/home/ccc   rw   ""
-               /export/home/aaa   rw   ""
bash-3.00# unshare /export/home/ccc
bash-3.00# share
-               /export/home/aaa   rw   ""

但是如果需要永久共享,应该屏蔽/etc/dfs/dfstab文件里面的共享信息

以上是solaris环境,redhat可以类比


 -------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
-------------------------------------------------------------------------------------------------------


你可能感兴趣的:(RedHat5.5和Solaris10 Linux设置共享)