zoukankan      html  css  js  c++  java
  • nfs服务

    1.1 nfs01主机配置

    1.1.1 安装nfs-utils服务

    1.安装

    [root@nfs01 ~]# yum install -y nfs-utils rpcbind

    2.配置nfs

    [root@nfs01 ~]# vim /etc/exports

    /data/www 172.16.1.0/24(rw,sync,all_squash,anonuid=666,anongid=666)

    #创建指定压缩的用户

    [root@nfs01 ~]# groupadd -g 666 www

    [root@nfs01 ~]# useradd -u 666 -g www www

    [root@nfs01 ~]# id www

    uid=666(www) gid=666(www) groups=666(www)

    #创建共享目录并授权给www用户

    [root@nfs01 ~]# mkdir /data/www -p

    [root@nfs01 ~]# chown -R www.www /data

    [root@nfs01 ~]# ll /data/www/ -d

    drwxr-xr-x 2 www www 6 Jul 28 18:31 /data/www/

    3.推送,并重启nfs-server

    #重启服务,并检查配置是否正确

    [root@nfs01 ~]# systemctl restart rpcbind nfs-server

    [root@nfs01 ~]# cat /var/lib/nfs/etab

    /data/www 172.16.1.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=666,anongid=666,sec=sys,secure,root_squash,all_squash)

    #加入开机自启动

    [root@nfs01 ~]# systemctl enable nfs-server

    Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

    [root@nfs01 ~]# systemctl enable rpcbind

    1.2 web01主机配置

    1.2.1 安装nfs-utils服务

    1.安装nfs-utils

    [root@web01 ~]# yum install nfs-utils rpcbind -y

    #重启服务并加入开机自启动

    [root@web01 ~]# systemctl restart rpcbind

    [root@web01 ~]# systemctl enable rpcbind

    2.配置nfs服务

    #获取查询

    [root@web01 ~]# showmount -e 172.16.1.31

    Export list for 172.16.1.31:

    /data/www 172.16.1.0/24

    #创建挂载点

    [root@web01 ~]# mkdir /data/www -p

    #挂载目录

    [root@web01 ~]# mount.nfs4 172.16.1.31:/data/www /data/www

    [root@web01 ~]# df -h

    Filesystem               Size  Used Avail Use% Mounted on

    .....省略.....

    172.16.1.31:/data/www     50G  1.6G   49G   4% /data/www

    #创建www用户

    [root@web01 ~]# groupadd -g 666 www

    [root@web01 ~]# useradd -u 666 -g www www

    [root@web01 ~]# id www

    uid=666(www) gid=666(www) groups=666(www)

    #测试

    [root@web01 ~]# cd /data/www/

    [root@web01 www]# echo 123 >web01_file.txt

     

    [root@nfs01 www]# ls

    web01_file.txt

  • 相关阅读:
    iframe,modaldialog父子窗口相互通信的问题
    bootstrap基础知识
    基于原生js的图片延迟加载
    通过原生js的ajax或jquery的ajax获取服务器的时间
    转 fiddler教程
    正则表达式
    es6 对象
    ES6
    axios
    javascript闭包和闭包的几种写法和用法
  • 原文地址:https://www.cnblogs.com/wangkaiok/p/11282411.html
Copyright © 2011-2022 走看看