千家信息网

如何利用ceph rbd配置nfs

发表于:2025-01-17 作者:千家信息网编辑
千家信息网最后更新 2025年01月17日,小编给大家分享一下如何利用ceph rbd配置nfs,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!利用ceph rbd配置
千家信息网最后更新 2025年01月17日如何利用ceph rbd配置nfs

小编给大家分享一下如何利用ceph rbd配置nfs,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

利用ceph rbd配置nfs

一种简单实用的存储方法,具体如下:

#安装nfs rpm[root@osd1 current]# yum install nfs-utils rpcbindLoaded plugins: fastestmirror, priorities, refresh-packagekit, securityLoading mirror speeds from cached hostfileepel/metalink                                                                                                  | 5.5 kB     00:00      * base: mirrors.cug.edu.cn * epel: mirrors.yun-idc.com * extras: mirrors.btte.net * rpmforge: ftp.riken.jp * updates: mirrors.btte.netCeph                                                                                                           |  951 B     00:00     Ceph-noarch                                                                                                    |  951 B     00:00     base                                                                                                           | 3.7 kB     00:00     ceph-source                                                                                                    |  951 B     00:00     epel                                                                                                           | 4.4 kB     00:00     epel/primary_db                                                                                                | 6.3 MB     00:01     extras                                                                                                         | 3.4 kB     00:00     rpmforge                                                                                                       | 1.9 kB     00:00     updates                                                                                                        | 3.4 kB     00:00     updates/primary_db                                                                                             | 188 kB     00:00     69 packages excluded due to repository priority protectionsSetting up Install ProcessPackage rpcbind-0.2.0-11.el6.x86_64 already installed and latest versionResolving Dependencies--> Running transaction check---> Package nfs-utils.x86_64 1:1.2.3-39.el6 will be updated---> Package nfs-utils.x86_64 1:1.2.3-54.el6 will be an update--> Finished Dependency ResolutionDependencies Resolved====================================================================================================================================== Package                         Arch                         Version                                Repository                  Size======================================================================================================================================Updating: nfs-utils                       x86_64                       1:1.2.3-54.el6                         base                       326 kTransaction Summary======================================================================================================================================Upgrade       1 Package(s)Total download size: 326 kIs this ok [y/N]: yDownloading Packages:nfs-utils-1.2.3-54.el6.x86_64.rpm                                                                              | 326 kB     00:00     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Updating   : 1:nfs-utils-1.2.3-54.el6.x86_64                                                                                    1/2   Cleanup    : 1:nfs-utils-1.2.3-39.el6.x86_64                                                                                    2/2   Verifying  : 1:nfs-utils-1.2.3-54.el6.x86_64                                                                                    1/2   Verifying  : 1:nfs-utils-1.2.3-39.el6.x86_64                                                                                    2/2 Updated:  nfs-utils.x86_64 1:1.2.3-54.el6           #创建一个块并格式化、挂载[root@osd1 current]# rbd create myrbd/nfs_image -s 1024000 --image-format=2[root@osd1 current]# rbd map myrbd/nfs_image/dev/rbd0[root@osd1 current]# mkdir /mnt/nfs[root@osd1 current]# mkfs.xfs /dev/rbd0log stripe unit (4194304 bytes) is too large (maximum is 256KiB)log stripe unit adjusted to 32KiBmeta-data=/dev/rbd0              isize=256    agcount=33, agsize=8190976 blks         =                       sectsz=512   attr=2, projid32bit=0data     =                       bsize=4096   blocks=262144000, imaxpct=25         =                       sunit=1024   swidth=1024 blksnaming   =version 2              bsize=4096   ascii-ci=0log      =internal log           bsize=4096   blocks=128000, version=2         =                       sectsz=512   sunit=8 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0[root@osd1 current]# mount /dev/rbd0 -o rw,noexec,nodev,noatime,nobarrier /mnt/nfs#改写exports文件,添加一行[root@osd1 current]#  vim /etc/exports/mnt/nfs 192.168.108.0/24(rw,no_root_squash,no_subtree_check,async)[root@osd1 current]# exportfs -r这里还需要执行指令service rpcbind start[root@osd1 current]# service nfs startStarting NFS services:                                     [  OK  ]Starting NFS quotas:                                       [  OK  ]Starting NFS mountd:                                       [  OK  ]Starting NFS daemon:                                       [  OK  ]Starting RPC idmapd:                                       [  OK  ]此时客户端就可以挂载了。客户端运行:showmount -e 192.168.108.2然后进行挂载:mount -t nfs 192.168.108.2:/mnt/nfs /mnt/nfs

如果无法挂载,运行 service rpcbind start或 service portmap start命令试一下。

以上是"如何利用ceph rbd配置nfs"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!

0