FastDFS安装教程

1.下载

FastDFS下载:https://codeload.github.com/happyfish100/fastdfs/zip/master

库文件下载:https://codeload.github.com/happyfish100/libfastcommon/zip/master

2.安装

2.1安装库

unzip /tmp/libfastcommon.zip
cd libfastcommon-master
./make.sh
./make.sh install

2.2安装FastDFS

unzip fastdfs-master.zip
cd fastdfs-master
./make.sh
./make.sh install

3.配置

首先先创建一个目录用于存放日志和数据,如:mkdir -p /yxxt/fdfs

3.1配置并启动tracker

cd /etc/fdsf
cp tracker.conf.sample tracker.conf
vi tracker.conf

编缉tracker.conf主要修改base_path项为之前创建的目录:

base_path=/yxxt/fdfs

启动tracker:

service fdfs_trackerd start

3.2配置并启动storage

cd /etc/fdfs
cp storage.conf.sample storage.conf
vi storage.conf

编缉tracker.conf主要修改base_path项和tracker_server项:

base_path=/yxxt/fdfs
tracker_server=91.2.60.2:

启动storage:

service fdfs_storaged start

3.3配置client

cd /etc/fdsf
cp client.conf.sample client.conf
vi client.conf

编缉client.conf主要修改base_path和tracker_server两项:

base_path=/yxxt/fdfs
tracker_server=91.2.60.2:

4.测试

上传文件:

[root@ls ~]#fdfs_upload_file /etc/fdfs/client.conf /etc/passwd
group1/M00///WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909

查看文件信息:

[root@ls ~]#fdfs_file_info /etc/fdfs/client.conf group1/M00///WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909
source storage id:
source ip address: 91.2.60.2
file create timestamp: -- ::
file size:
file crc32: (0x3CF9FC59)

下载文件:

[root@ls ~]#fdfs_download_file /etc/fdfs/client.conf group1/M00///WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909 /tmp/testx

查看下载的文件是否有内容,内容和上传的文件是否一致:

cat /etc/testx

参考:

http://xinzong.blog.51cto.com/10018904/1834466

上一篇:js 技巧 (一)


下一篇:poj 2774 后缀数组 两个字符串的最长公共子串