{"id":317,"date":"2022-03-11T14:58:42","date_gmt":"2022-03-11T06:58:42","guid":{"rendered":"https:\/\/blog.sfgz.com.cn\/?p=317"},"modified":"2022-03-11T14:58:42","modified_gmt":"2022-03-11T06:58:42","slug":"centos7-%e5%88%9b%e5%bb%banfs%e6%9c%8d%e5%8a%a1%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8c%82%e8%bd%bd","status":"publish","type":"post","link":"https:\/\/blog.sfgz.com.cn\/index.php\/2022\/03\/11\/centos7-%e5%88%9b%e5%bb%banfs%e6%9c%8d%e5%8a%a1%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8c%82%e8%bd%bd\/","title":{"rendered":"Centos7 \u521b\u5efaNFS\u670d\u52a1&amp;\u5ba2\u6237\u7aef\u6302\u8f7d"},"content":{"rendered":"<h1><strong>Centos7 \u521b\u5efaNFS\u670d\u52a1&amp;\u5ba2\u6237\u7aef\u6302\u8f7d<\/strong><\/h1>\n<hr \/>\n<h1>\u670d\u52a1\u7aef\u64cd\u4f5c\uff1a<\/h1>\n<h2>1\u3001\u5b89\u88c5NFS\u670d\u52a1<\/h2>\n<pre><code class=\"language-json\">yum -y install rpcbind nfs-utils<\/code><\/pre>\n<h2>2\u3001\u521b\u5efa\u5171\u4eab\u76ee\u5f55\u5e76\u8d4b\u4e88\u6743\u9650<\/h2>\n<pre><code class=\"language-json\">mkdir \/data\/\nchmod 777 -R \/data<\/code><\/pre>\n<h2>3\u3001\u914d\u7f6eNFS\u6587\u4ef6\u76ee\u5f55&amp;\u5ba2\u6237\u7aefIP<\/h2>\n<p><code>vi \/etc\/exports<\/code><\/p>\n<pre><code class=\"language-json\">\/data 10.127.0.53(rw,no_root_squash,no_all_squash,sync)\n\/data 10.127.0.54(rw,no_root_squash,no_all_squash,sync)\n\/data 10.127.0.55(rw,no_root_squash,no_all_squash,sync)\n\/data 10.127.0.XXX(rw,no_root_squash,no_all_squash,sync)<\/code><\/pre>\n<ul>\n<li>rw \u8868\u793a\u8bbe\u7f6e\u76ee\u5f55\u53ef\u8bfb\u5199\u3002<\/li>\n<li>sync \u8868\u793a\u6570\u636e\u4f1a\u540c\u6b65\u5199\u5165\u5230\u5185\u5b58\u548c\u786c\u76d8\u4e2d\uff0c\u76f8\u53cd rsync \u8868\u793a\u6570\u636e\u4f1a\u5148\u6682\u5b58\u4e8e\u5185\u5b58\u4e2d\uff0c\u800c\u975e\u76f4\u63a5\u5199\u5165\u5230\u786c\u76d8\u4e2d\u3002<\/li>\n<li>no_root_squash NFS\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u7aef\u65f6\u5982\u679c\u4f7f\u7528\u7684\u662froot\u7684\u8bdd\uff0c\u90a3\u4e48\u5bf9\u670d\u52a1\u7aef\u5206\u4eab\u7684\u76ee\u5f55\u6765\u8bf4\uff0c\u4e5f\u62e5\u6709root\u6743\u9650\u3002<\/li>\n<li>no_all_squash \u4e0d\u8bbaNFS\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u7aef\u65f6\u4f7f\u7528\u4ec0\u4e48\u7528\u6237\uff0c\u5bf9\u670d\u52a1\u7aef\u5206\u4eab\u7684\u76ee\u5f55\u6765\u8bf4\u90fd\u4e0d\u4f1a\u62e5\u6709\u533f\u540d\u7528\u6237\u6743\u9650\u3002<\/li>\n<\/ul>\n<blockquote>\n<p>\u4f7f\u914d\u7f6e\u7acb\u5373\u751f\u6548<\/p>\n<\/blockquote>\n<p><code>exportfs -r<\/code><\/p>\n<h2>4\u3001\u8bbe\u7f6e\u9632\u706b\u5899<\/h2>\n<h3>\u68c0\u67e5\u9632\u706b\u5899\u72b6\u6001<\/h3>\n<p><code>systemctl status firewalld.service <\/code><\/p>\n<h4>\u5982\u679c\u662f\u5173\u95ed\u72b6\u6001\u5219\u4e0d\u9700\u8981\u505a\u5982\u4e0b\u914d\u7f6e,\u5426\u5219\u9700\u8981\u6253\u5f00\u8fd9\u90e8\u5206\u7aef\u53e3\uff1b<\/h4>\n<ol>\n<li>\n<p>NFS\u670d\u52a1\u7684\u7aef\u53e3\u914d\u7f6e\u6587\u4ef6 \u4fee\u6539\/etc\/sysconfig\/nfs\u6587\u4ef6\uff0c\u5c06\u4e0b\u5217\u5185\u5bb9\u7684\u6ce8\u91ca\u53bb\u6389\uff0c\u5982\u679c\u6ca1\u6709\u5219\u6dfb\u52a0<br \/>\n<code>vi \/etc\/sysconfig\/nfs<\/code><\/p>\n<pre><code class=\"language-json\">RQUOTAD_PORT=1001\nLOCKD_TCPPORT=30001\nLOCKD_UDPPORT=30002\nMOUNTD_PORT=1002<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4fdd\u5b58\u597d\u540e\uff0c\u5c06\u7aef\u53e3\u52a0\u5165\u5230\u9632\u706b\u5899\u5141\u8bb8\u7b56\u7565\u4e2d\u3002\u6267\u884c\uff1a<br \/>\n<code>firewall-cmd --zone=public --add-port=111\/tcp --add-port=111\/udp --add-port=2049\/tcp --add-port=2049\/udp --add-port=1001\/tcp --add-port=1001\/udp --add-port=1002\/tcp --add-port=1002\/udp --add-port=30001\/tcp --add-port=30002\/udp --permanent <\/code><\/p>\n<\/li>\n<li>\n<p>\u91cd\u65b0\u52a0\u8f7d\u9632\u706b\u5899<br \/>\n<code>firewall-cmd --reload<\/code><\/p>\n<\/li>\n<\/ol>\n<h2>5\u3001\u542f\u52a8\u670d\u52a1<\/h2>\n<h3>\u6309\u987a\u5e8f\u542f\u52a8rpcbind\u548cnfs\u670d\u52a1<\/h3>\n<p><code>systemctl start rpcbind<\/code><br \/>\n<code>systemctl start nfs<\/code><\/p>\n<h3>\u52a0\u5165\u5f00\u673a\u542f\u52a8\uff1a<\/h3>\n<p><code>systemctl enable rpcbind<\/code><br \/>\n<code>systemctl enable nfs<\/code><\/p>\n<hr \/>\n<h1>\u5ba2\u6237\u7aef\u64cd\u4f5c\uff1a<\/h1>\n<h2>1\u3001\u5b89\u88c5NFS\u670d\u52a1<\/h2>\n<p><code>yum -y install nfs-utils rpcbind<\/code><\/p>\n<h2>2\u3001\u67e5\u770b\u670d\u52a1\u7aef\u5df2\u5171\u4eab\u7684\u76ee\u5f55<\/h2>\n<p><code>showmount -e 10.127.0.52<\/code>  ##10.127.0.52\u4e3a\u670d\u52a1\u7aefIP<\/p>\n<h2>3\u3001\u5efa\u7acb\u6302\u8f7d\u76ee\u5f55\uff0c\u6267\u884c\u6302\u8f7d\u547d\u4ee4\uff1a<\/h2>\n<p><code>mkdir \/data<\/code><br \/>\n<code>mount -t nfs4 10.127.0.52:\/data \/data<\/code> <\/p>\n<blockquote>\n<p>\u5982\u679c\u8981\u89e3\u9664\u6302\u8f7d\uff0c\u53ef\u6267\u884c\u547d\u4ee4\uff1a<br \/>\n<code>umount \/data<\/code><\/p>\n<\/blockquote>\n<h2>4\u3001\u5f00\u673a\u81ea\u52a8\u6302\u8f7d<\/h2>\n<p><code>vi \/etc\/fstab<\/code><\/p>\n<pre><code class=\"language-json\">10.127.0.52:\/data \/data nfs4 rw,tcp,intr 0 1<\/code><\/pre>\n<blockquote>\n<p>\u4fdd\u5b58,\u901a\u8fc7mount&amp;umount\u6d4b\u8bd5\uff1b\u6700\u540e\u91cd\u542f\u6d4b\u8bd5<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Centos7 \u521b\u5efaNFS\u670d\u52a1&amp;\u5ba2\u6237\u7aef\u6302\u8f7d \u670d\u52a1\u7aef\u64cd\u4f5c\uff1a 1\u3001\u5b89\u88c5NFS &hellip; <a href=\"https:\/\/blog.sfgz.com.cn\/index.php\/2022\/03\/11\/centos7-%e5%88%9b%e5%bb%banfs%e6%9c%8d%e5%8a%a1%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8c%82%e8%bd%bd\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-317","post","type-post","status-publish","format-standard","hentry","category-server"],"_links":{"self":[{"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=317"}],"version-history":[{"count":9,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/317\/revisions"}],"predecessor-version":[{"id":327,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/317\/revisions\/327"}],"wp:attachment":[{"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sfgz.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}