搭建NFS存储

NFS服务端:


[[email protected] ~]# rpm -qa rpcbind nfs-utils
  [[email protected] ~]# yum -y install rpcbind nfs-utils

[[email protected] ~]# rpm -qa rpcbind nfs-utils       
  rpcbind-0.2.0-11.el6.x86_64
  nfs-utils-1.2.3-54.el6.x86_64
  [[email protected] ~]# /etc/init.d/rpcbind start
  Starting rpcbind:                                          [  OK  ]
  [[email protected] ~]# /etc/init.d/nfs start    
  Starting NFS services:                                     [  OK  ]
  Starting NFS quotas:                                       [  OK  ]
  Starting NFS mountd:                                       [  OK  ]
  Starting NFS daemon:                                       [  OK  ]
  Starting RPC idmapd:                                       [  OK  ]

[[email protected] ~]# mkdir /data/www/www/upload -p
  [[email protected] ~]# mkdir /data/www/bbs/upload -p   
  [[email protected] ~]# mkdir /data/www/blog/upload -p

[[email protected] ~]# vim /etc/exports 
  #print for share files and sync web-server files by yvonne 2015-7-6 18:22:56.
  /data/www/blog/upload 192.168.10.0/24(rw,sync,all_squash)
  /data/www/bbs/upload 192.168.10.0/24(rw,sync,all_squash)
  /data/www/www/upload 192.168.10.0/24(rw,sync,all_squash)

~

[[email protected] ~]# /etc/init.d/nfs reload

[[email protected] ~]# showmount -e 192.168.10.103
  Export list for 192.168.10.103:
  /data/www/www/upload  192.168.10.0/24
  /data/www/bbs/upload  192.168.10.0/24
  /data/www/blog/upload 192.168.10.0/24

[[email protected] ~]# chown -R  nfsnobody /data/www/www/upload/
  [[email protected] ~]# chown -R  nfsnobody /data/www/bbs/upload/
  [[email protected] ~]# chown -R  nfsnobody /data/www/blog/upload/

[[email protected] ~]# touch /data/www/www/upload/iam_nfs_server

[[email protected] ~]# vim /etc/rc.local     开机启动服务
  
  #!/bin/sh
  #
  # This script will be executed *after* all the other init scripts.
  # You can put your own initialization stuff in here if you don‘t
  # want to do the full Sys V style init stuff.
  
  touch /var/lock/subsys/local
  /etc/init.d/iptables stop
  
  /etc/init.d/rpcbind start
  /etc/init.d/nfs start


搭好NFS-server后,将此web配置为NFS-client
:

[[email protected] ~]# rpm -qa rpcbind nfs-utils
 [[email protected] ~]# yum -y install rpcbind nfs-utils

[[email protected] ~]# /etc/init.d/rpcbind start
 Starting rpcbind:                                          [  OK  ]

[[email protected] ~]# ps -ef |grep rpcbind |grep -v grep
 rpc        7938      1  0 18:28 ?        00:00:00 rpcbind
 [[email protected] ~]# netstat -lntup |grep rpcbind
 tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      7938/rpcbind        
 tcp        0      0 :::111                      :::*                        LISTEN      7938/rpcbind        
 udp        0      0 0.0.0.0:111                 0.0.0.0:*                               7938/rpcbind        
 udp        0      0 0.0.0.0:905                 0.0.0.0:*                               7938/rpcbind        
 udp        0      0 :::111                      :::*                                    7938/rpcbind        
 udp        0      0 :::905                      :::*                                    7938/rpcbind        
 [[email protected] ~]#

[[email protected] ~]# mkdir /data/www/www/upload
 [[email protected] ~]# mkdir /data/www/bbs/upload
 [[email protected] ~]# mkdir /data/www/blog/upload

[[email protected] ~]# mount -t nfs 192.168.10.103:/data/www/www/upload/ /data/www/www/upload/ 
 [[email protected] ~]# mount -t nfs 192.168.10.103:/data/www/bbs/upload/ /data/www/bbs/upload/   
 [[email protected] ~]# mount -t nfs 192.168.10.103:/data/www/blog/upload/ /data/www/blog/upload/ 
 [[email protected] ~]#

[[email protected] ~]# mount
 /dev/sda2 on / type ext4 (rw)
 proc on /proc type proc (rw)
 sysfs on /sys type sysfs (rw)
 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
 /dev/sda1 on /boot type ext4 (rw)
 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
 sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
 192.168.10.103:/data/www/www/upload/ on /data/www/www/upload type nfs (rw,vers=4,addr=192.168.10.103,clientaddr=192.168.10.104)
 192.168.10.103:/data/www/bbs/upload/ on /data/www/bbs/upload type nfs (rw,vers=4,addr=192.168.10.103,clientaddr=192.168.10.104)
 192.168.10.103:/data/www/blog/upload/ on /data/www/blog/upload type nfs (rw,vers=4,addr=192.168.10.103,clientaddr=192.168.10.104)
 [[email protected] ~]#

[[email protected] ~]# ls /data/www/www/upload/
 iam_nfs_server
 [[email protected] ~]#

[[email protected] ~]# vim /etc/rc.local     
 开机自动挂载

 #!/bin/sh
 #
 # This script will be executed *after* all the other init scripts.
 # You can put your own initialization stuff in here if you don‘t
 # want to do the full Sys V style init stuff.
 
 touch /var/lock/subsys/local
 /etc/init.d/iptables stop
 
 
 /etc/init.d/rpcbind start
 mount -t nfs 192.168.10.103:/data/www/www/upload/ /data/www/www/upload/
 mount -t nfs 192.168.10.103:/data/www/bbs/upload/ /data/www/bbs/upload/                    
 mount -t nfs 192.168.10.103:/data/www/blog/upload/ /data/www/blog/upload/
时间: 2024-08-03 21:44:01

搭建NFS存储的相关文章

搭建nfs共享存储服务之三客户端配置及实战测试故障总结

在客户端操作的: 1. 检查客户端有没有安装nfs-utils和rpcbind软件程序 (这两个必须安装) [[email protected] ~]# rpm -qa nfs-utils rpcbindnfs-utils-1.2.3-75.el6.x86_64rpcbind-0.2.0-13.el6_9.1.x86_64 如果没有安装,需要用yum安装.安装方法参考:搭建nfs共享存储服务之二 [[email protected] ~]# /etc/init.d/rpcbind statusr

1.搭建NFS环境,用于存储数据

作者 微信:tangy8080 电子邮箱:[email protected] 更新时间:2019-06-12 14:59:50 星期三 欢迎您订阅和分享我的订阅号,订阅号内会不定期分享一些我自己学习过程中的编写的文章 如您在阅读过程中发现文章错误,可添加我的微信 tangy8080 进行反馈.感谢您的支持. 文章主题 搭建NFS服务器,用于存储ElasticSearch的数据. 前置条件 有一个可用的K8s集群 已经部署好了Helm 正文 为什么需要NFS 由于pod是可变的,这意味这如果把es

NFS存储服务深度实践

第1章 NFS介绍 1.1 什么是NFS? NFS 是Network File System的缩写,中文意思是网络文件系统.它的主要功能是通过网络(一般是局域网)让不同的主机系统之间可以共享文件或目录.NFS客户端(一般为应用服务器,例如web)可以通过挂载(mount)的方式将NFS服务器端共享的数据目录挂载到NFS客户端本地系统中(就是某一个挂载点下).从客户端本地看,NFS服务器端共享的目录就好像是客户端自己的磁盘分区或者目录一样,而实际上却是远端的NFS服务器的目录. NFS网络文件系统

连接ESXI 部署NAS/NFS存储

这几天刚刚接触虚拟化,觉得很好玩,今天又自己部署了NFS存储,以便更轻松的访问计算机资源. ESXi 是vSphere产品套件中的重要部分,负责将计算机的物理资源转化为逻辑资源,从而保证高效地使用计算机资源. ESXi 支持下列类型的存储器: 本地存储器将虚拟机文件存储在内部存储磁盘或直接连接的外部存储磁盘上. 网络存储器将虚拟机文件存储在通过直接连接或高速网络与主机相连的外部存储磁盘或阵列上. 下面搭建的环境是:以飞康CDP作为存储设备(磁盘柜),ESXI通过vSphere连接到Vcenter

RedHat搭建NFS服务器

首先说一下什么是NFS,其实就是Network File System的缩写,是sun公司开发的.能够实现不同的机器,不同的操作系统乐意彼此共享文件.在我前面的文章中有提到Samba,它也是一种文件共享服务器.不同的是,NFS实现的是linux客户机之间的文件共享,而Samba主要是为了实现windows和linux之间的文件共享,前者相对简单,后者相对复杂,但是复杂必然有复杂的道理. 下面我介绍下如何搭建NFS服务器,以及客户机如何能够实现文件共享: 场景 某单位需要配置 NFS 服务器, 为

Win7系统下搭建NFS服务器

Win7系统下搭建NFS服务器 采用Linux系统的服务器管理员都知道linux系统中能用NFS网络文件系统这套程序实现linux和unix系统之间的文件共享.那么能否在windows系统中采用NFS功能实现文件共享,让Linux系统来访问呢?答案是可以实现.但是必须在windows系统中安装一个实现NFS功能的第3方软件haneWin.本文在win7旗舰版系统中安装和配置NFS软件.然后在win7.Linux的客户端挂载我电脑共享的文件夹就可以实现了. 第1步,安装haneWin软件.下载地址

NFS存储高可用快速实施方案

Note:以下为NFS+DRBD+HEARTBEAT快速实施文档,若要用于生产环境,请仔细阅读官方文档并结合实际业务调整参数,涉及数据部署请慎重!!! (个人建议:在基于个人熟悉服务的情况下并通过测试环境才可在线上使用.) 存储高可用 NFS+DRBD+HEARTBEAT快速实施方案 环境: nfs-utils-1.2.3-75.el6_9.x86_64 heartbeat-3.0.4-2.el6.x86_64 drbd84-utils-8.9.8-1.el6.elrepo.x86_64 Cen

搭建NFS共享目录,解决wordpress负载均衡图片上传问题

1.剧情回顾 在之前的博客里面,我搭建了两个WEB服务器,然后在前端搭建了一个Nginx负载均衡服务器,用来分发请求给两个不同的服务器(http://blog.51cto.com/superpcm/2095324).之前的测试没有问题,原因在于测试程序是单纯的静态网站,不会发生变动的静态网站.后来我搭建在两台WEB上都搭建了wordpress服务,然后上传图片的时候做测试.发现图片上传只传到其中的一台服务器上(比如说web01),当我关闭web01的时候,web02就没法看到看到那个图片了. 这

k8s无脑系列(三)-NFS存储(简单版本)

k8s无脑系列(三)-NFS存储(简单版本) 1.概念 搞清楚pv,pvc pv = PersistentVolume 持久化存储控制器,面向集群而不是namespace. pvc = PersistentVolumeClaim 对接pod与pv, 关系,官方说明 A PVC to PV binding is a one-to-one mapping, using a ClaimRef which is a bi-directional binding between the Persisten