NFS服务搭建使用
2024-08-30 03:49:11
需求:由于线上业务有一些数据存在了Redis数据库和mysql数据库中了,导致了数据较大迁移起来比较麻烦,所以准备搭建NFS来做WEB的共享磁盘,存储这些数据。
服务端搭建:
查看本机关于nfs的包
[root@vm-10-112-38-104 ]# yum search nfs
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: 10.127.91.220:8050
* epel: 10.183.91.217:8050
* extras: 10.127.91.220:8050
* le-pkgs: 10.183.91.217:8050
* updates: 10.127.91.220:8050
base | 3.0 kB 00:00
epel | 3.0 kB 00:00
epel/primary_db | 14 MB 00:00
extras | 2.9 kB 00:00
le-pkgs | 2.9 kB 00:00
le-pkgs/primary_db | 17 kB 00:00
updates | 2.9 kB 00:00
updates/primary_db | 8.2 MB 00:00
================================================================================== N/S Matched: nfs ==================================================================================
nfs-ganesha.x86_64 : NFS Server running in user space
nfs-ganesha-nullfs.x86_64 : The NFS-GANESHA's NULLFS Stackable FSAL
nfs-ganesha-proxy.x86_64 : The NFS-GANESHA's PROXY FSAL
nfs-ganesha-utils.x86_64 : The NFS-GANESHA's util scripts
nfs-ganesha-vfs.x86_64 : The NFS-GANESHA's VFS FSAL
nfs-utils.x86_64 : NFS utilities and supporting clients and daemons for the kernel NFS server
nfs-utils-lib-devel.i686 : Development files for the nfs-utils-lib library
nfs-utils-lib-devel.x86_64 : Development files for the nfs-utils-lib library
nfs4-acl-tools.x86_64 : The nfs4 ACL tools
nfsometer.noarch : NFS Performance Framework Tool
pcp-pmda-nfsclient.x86_64 : Performance Co-Pilot (PCP) metrics for NFS Clients
perl-File-NFSLock.noarch : Perl module to do NFS (or not) locking
sblim-cmpi-nfsv3.i686 : SBLIM nfsv3 instrumentation
sblim-cmpi-nfsv3.x86_64 : SBLIM nfsv3 instrumentation
sblim-cmpi-nfsv3-test.x86_64 : SBLIM Nfsv3 Instrumentation Testcases
sblim-cmpi-nfsv4.i686 : SBLIM nfsv4 instrumentation
sblim-cmpi-nfsv4.x86_64 : SBLIM nfsv4 instrumentation
sblim-cmpi-nfsv4-test.x86_64 : SBLIM Nfsv4 Instrumentation Testcases
fedfs-utils-devel.i686 : Development files for the FedFS NFS plug-in
fedfs-utils-devel.x86_64 : Development files for the FedFS NFS plug-in
fedfs-utils-lib.i686 : The FedFS NFS plug-in run-time library
fedfs-utils-lib.x86_64 : The FedFS NFS plug-in run-time library
funionfs.x86_64 : Union filesystem in userspace
nfs-ganesha-mount-9P.x86_64 : a 9p mount helper
nfs-utils-lib.x86_64 : Network File System Support Library
nfs-utils-lib.i686 : Network File System Support Library
pcp-pmda-slurm.x86_64 : Performance Co-Pilot (PCP) metrics for NFS Clients Name and summary matches only, use "search all" for everything.
[root@vm-10-112-38-104]#
yum 安装,启动 (有错误,是因为rpcbind服务没启动)
[root@vm-10-112-38-104 ]#yum install nfs-utils-* -y
[root@vm-10-112-38-104 ]# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS mountd: [FAILED]
Starting NFS daemon:
先启动rpcbind服务
[root@vm-10-112-38-104 ]# /etc/init.d/rpcbind restart
Stopping rpcbind: [FAILED]
Starting rpcbind: [ OK ]
[root@vm-10-112-38-104 ]# /etc/init.d/rpcbind restart
启动NFS服务
[root@vm-10-112-38-104 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
更改配置文件: 共享/nfs目录,rw读写权限,sync时时同步,no_root_squash root用户有所有权限,no_subtree_check如果卷的一部分被输出,从客户端发出请求文件的一个常规的调用子目录检查验证卷的相应部分。如果是整个卷输出,禁止这个检查可以加速传输。
[root@vm-10-112-38-104 ~]# vi /etc/exports /nfs *(rw,sync,no_root_squash,no_subtree_check)
客户端测试:
挂载到本地目录:
[root@vm-10-129-93-51 ~]# mkdir /nfs
[root@vm-10-129-93-51 ~]#
[root@vm-10-129-93-51 ~]#
[root@vm-10-129-93-51 ~]#
[root@vm-10-129-93-51 ~]#
[root@vm-10-129-93-51 ~]#
[root@vm-10-129-93-51 ~]# mount -t nfs 10.112.38.104:/nfs /nfs
[root@vm-10-129-93-51 ~]#
写入/etc/fstab ,开机自动加载
echo "10.112.x.x:/nfs /nfs nfs defaults 0 0" >> /etc/fstab
最新文章
- 阿里云VPS服务器,ROS内网穿透
- 阿里提前批校招内推offer经历
- 数据存储--沙盒sandBox
- C# 鼠标穿透窗体功能
- ListCtrl控件的使用
- 从Wolframserver获取DC comics卡通人物数据
- readn、write、readline
- yumdebug
- sql server 2012 数据库还原方法
- atitit查询表改动表字段没反应--解锁锁定的表
- 【sort】 基数排序
- linux和Windows实现文件共享之samba的安装与配置
- MySql_5-7安装教程
- C#执行PowserShell 脚本
- java.util.ConcurrentHashMap (JDK 1.8)
- luogu P1659 [国家集训队]拉拉队排练
- radio日志sim卡信号状态分析
- Java基础构造方法和this关键字整理
- [字符串][NOIP2012]Vigenère密码
- Linux内存管理1---内存寻址