1.下载
FastDFS下载:
库文件下载:
2.安装
2.1安装库
unzip /tmp/libfastcommon.zipcd libfastcommon-master./make.sh./make.sh install
2.2安装FastDFS
unzip fastdfs-master.zipcd fastdfs-master./make.sh./make.sh install
3.配置
首先先创建一个目录用于存放日志和数据,如:mkdir -p /yxxt/fdfs
3.1配置并启动tracker
cd /etc/fdsfcp tracker.conf.sample tracker.confvi tracker.conf
编缉tracker.conf主要修改base_path项为之前创建的目录:
base_path=/yxxt/fdfs
启动tracker:
service fdfs_trackerd start
3.2配置并启动storage
cd /etc/fdfscp storage.conf.sample storage.confvi storage.conf
编缉tracker.conf主要修改base_path项和tracker_server项:
base_path=/yxxt/fdfstracker_server=91.2.60.2:22122
启动storage:
service fdfs_storaged start
3.3配置client
cd /etc/fdsfcp client.conf.sample client.confvi client.conf
编缉client.conf主要修改base_path和tracker_server两项:
base_path=/yxxt/fdfstracker_server=91.2.60.2:22122
4.测试
上传文件:
[root@ls ~]#fdfs_upload_file /etc/fdfs/client.conf /etc/passwdgroup1/M00/00/00/WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909
查看文件信息:
[root@ls ~]#fdfs_file_info /etc/fdfs/client.conf group1/M00/00/00/WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909source storage id: 0source ip address: 91.2.60.2file create timestamp: 2017-09-27 17:50:43file size: 1972file crc32: 1023016025 (0x3CF9FC59)
下载文件:
[root@ls ~]#fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/WwI8AlnLdHOAaLXSAAAHtDz5_Fk1425909 /tmp/testx
查看下载的文件是否有内容,内容和上传的文件是否一致:
cat /etc/testx
参考: