goofys挂载对象存储OSS
Last updated
2023-08-31 11:10:09
{"value":"\n#### **\u4e00\u3001goofys\u7b80\u4ecb**\n\ngoofys \u4f7f\u7528go\u8bed\u8a00\u7f16\u5199\uff0c\u901a\u8fc7fuse\u7528\u6237\u7a7a\u95f4\u6587\u4ef6\u7cfb\u7edf\u5b9e\u73b0,\uff0c\u53ef\u4ee5\u5c06 S3 \u5b58\u50a8 bucket \u6302\u8f7d\u4e3a\u6587\u4ef6\u7cfb\u7edf\u3002\n\n#### **\u4e8c\u3001goofys\u4e0b\u8f7d**\n\n\u4e0b\u8f7d\u6700\u65b0\u7248\u7684 goofys \u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\uff1a\n\n\u5efa\u8bae\u4e0b\u8f7d\u5230\/usr\/local\/bin\u76ee\u5f55\u4e0b\n\n`wget https:\/\/github.com\/kahing\/goofys\/releases\/latest\/download\/goofys`\n\n\u8bbe\u7f6e goofys \u7684\u53ef\u6267\u884c\u6743\u9650\uff1a\n\n`chmod +x goofys`\n\n#### **\u4e09\u3001goofys\u914d\u7f6e**\n\n\u5efa\u7acb ~\/.aws \u8fd9\u4e2a\u653e\u7f6e\u914d\u7f6e\u6587\u4ef6\u7684\u76ee\u5f55\uff1a\n\n`mkdir ~\/.aws`\n\n\u7136\u540e\u5efa\u7acb ~\/.aws\/credentials \u914d\u7f6e\u6587\u4ef6\uff1a\n\n`vi ~\/.aws\/credentials`\n\n\u5728 ~\/.aws\/credentials \u8bbe\u7f6e\u6587\u4ef6\u4e2d\u586b\u5165 \u5bf9\u8c61\u5b58\u50a8OSS \u7684 access key \u4e0e secret key\uff1a\n\n```\n[default]\n\naws_access_key_id = AKID1234567890\n\naws_secret_access_key = xCBasoZHLsVMulg10Romt3zY60ApsP9qaniqlUvK\n```\n\naccess key \u4e0e secret key\u53ef\u901a\u8fc7\u5bf9\u8c61\u5b58\u50a8\u63a7\u5236\u53f0\u67e5\u770b\uff1a\n![](https:\/\/tp2lravq.hk03.1112oss.com\/20230831110430rto0hbog57aa7nr4fg4neq82petr2pog.png)\n![](https:\/\/tp2lravq.hk03.1112oss.com\/20230831110443c2bptnlh56hkulf8rgcouavsflpndw8t.png)\n#### **\u56db\u3001goofys\u6302\u8f7d**\n\n\u8fdb\u884c\u6302\u8f7d\u5bf9\u8c61\u5b58\u50a8 bucket \u4e4b\u524d\uff0c\u5148\u5efa\u7acb\u6302\u8f7d\u70b9\u76ee\u5f55\uff1a\n\n`mkdir \/data`\n\n\u63a5\u7740\u4f7f\u7528 goofys \u5c06 \u5bf9\u8c61\u5b58\u50a8\u7684\u7f16\u53f7\u4e3a9rp7ed6i \u7684bucket \u6302\u8f7d\u81f3 \/data \u76ee\u5f55\u4e0b\uff0c\u9ed8\u8ba4\u4f1a\u4ee5 ~\/.aws\/credentials \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684 default \u8bbe\u7f6e\u7684\u91d1\u94a5\u8fdb\u884c\u6302\u8f7d\uff1a\n\n`.\/goofys --endpoint https:\/\/s3.hk02.1113oss.com\/ 9rp7ed6i \/data`\n\nbucket\u7f16\u53f7\u67e5\u770b\u5982\u4e0b\uff1a\n\n \n\n![](https:\/\/tp2lravq.hk03.1112oss.com\/20230831110504r0a2kwna01hra8mi2cjf51rvf21kgvk2.png)\n\n**\u51fa\u73b0\u4ee5\u4e0b\u5185\u5bb9\u5c31\u7b97\u662f\u6302\u8f7d\u6210\u529f\u4e86\uff0c\u53ef\u4ee5\u5f53\u505a\u4e00\u5757\u6b63\u5e38\u78c1\u76d8\u4f7f\u7528\u4e86**\n\n![](https:\/\/tp2lravq.hk03.1112oss.com\/20230831110511a8g2i6mfe4ofkev9pigj3jj3g8hiratc.png)\n\n#### **\u4e94\u3001goofys\u5378\u8f7d**\n\n\u5b89\u88c5fuse\uff1a\n\n`yum -y install fuse`\n\n\u82e5\u8981\u5378\u8f7d\u901a\u8fc7 goofys \u6302\u8f7d\u7684 \u5bf9\u8c61\u5b58\u50a8bucket\uff0c\u53ef\u4ee5\u4f7f\u7528 fusermount\uff1a\n\n`fusermount -u \/data`\n\n \n\n#### **\u516d\u3001\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f**\n\n\u5728\/etc\/fstab\u6587\u4ef6\u4e0b\u6dfb\u52a0\u4e00\u4e0b\u5185\u5bb9\n\n\u6ce8\u610f\uff1a\u5f00\u673a\u81ea\u542f\u4e5f\u9700\u8981\u6709fuse\u8f6f\u4ef6\n\n```\n[root@xxzz ~]# vim \/etc\/fstab\n\ngoofys#li6e0hxz \/data fuse _netdev,allow_other,--file-mode=0644,--dir-mode=0777,--debug_s3,--endpoint=https:\/\/s3.hk02.1113oss.com\n```\n\n"}