背景
随着云计算和大数据的发展,越来越多的客户根据自己的业务选择对象存储去做为数据存储的主要方式,但是面对一些小文件的处理场景,对文件的增,删,改,查,文件系统使用起来便是更加方便,故在用户只有对象存储的情况下,可以将对象存储的某个存储桶变为文件系统目录使用。下面便是介绍,对象存储转为文件系统的方式方法
对象存储转文件目录方法介绍
Goofys
安装
- go环境配置
tar xf go1.8.linux-amd64.tar.gz
mv go /usr/sbin
vim /etc/profile
"
export GOROOT=/go
export PATH=$GOROOT/bin:$PATH
export GOPATH=~/workspace
source /etc/profile
"
- 程序安装
go get github.com/kahing/goofys
go install github.com/kahing/goofys
配置运行
- 配置
vim ~/.aws/credentials
[default]
aws_access_key_id =
aws_secret_access_key =
- 运行
/root/workspace/bin/goofys --endpoint http://127.0.0.1:7480 -debug_s3 --debug_fuse -f bucket /home/bucket
Riofs
安装
yum install glib2-devel fuse-devel libevent-devel libxml2-devel openssl-devel
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable && ./configure && make && make install
echo "/usr/local/lib/" > /etc/ld.so.conf.d/riofs.conf
ldconfig
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cd ..
wget https://github.com/skoobe/riofs/archive/master.zip
unzip master.zip
cd riofs-master && ./autogen.sh && ./configure &&make && make install
配置运行
- 配置
vim /usr/local/etc/riofs/riofs.conf.xml
<endpoint type...>
<access_key_id...>
<secret_access_key ...>
- 运行
mkdir /s3mnt && chmod 777 /s3mnt
riofs -v -o "allow_other" bucket /s3mnt
S3fs
安装
yum install fuse.x86_64 fuse-devel.x86_64 fuse-libs.x86_64 libconfuse-devel.x86_64 libconfuse.x86_64
yum install gcc-c++.noarch
yum install curl.x86_64 libcurl-devel.x86_64 libcurl.x86_64
yum install libxml2.x86_64 libxml2-devel.x86_64
yum install openssl-devel.x86_64
git clone GitHub - s3fs-fuse/s3fs-fuse: FUSE-based file system backed by Amazon S3
cd s3fs;
./configure --prefix=/usr/local
make && make install
配置运行
- 配置
echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
- 运行
s3fs bucket /home/bucket -o url=http://127.0.0.1:7480 -o use_path_request_style -f -d