环境:Vmware Workstation 10,CentOS-7-x86_64-DVD-1511.iso,Xshell 4.0,ip:192.168.216.140.
[root@localhost ~]# yum install make cmake gcc gcc-c++
下载安装libfastcommon
[root@localhost ~]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.35.tar.gz
[root@localhost ~]# mv V1.0.35.tar.gz libfastcommon-1.0.35.tar.gz
[root@localhost ~]# tar -zxvf libfastcommon-1.0.35.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/libfastcommon-1.0.35/
[root@localhost libfastcommon-1.0.35]# ./make.sh
[root@localhost libfastcommon-1.0.35]# ./make.sh install
下载安装fastdfs
[root@localhost ~]# wget https://github.com/happyfish100/fastdfs/archive/V5.10.tar.gz
[root@localhost ~]# mv V5.10.tar.gz fastdfs-5.10.tar.gz
[root@localhost ~]# tar -zxvf fastdfs-5.10.tar.gz -C /usr/local/
[root@localhost ~]# mv /usr/local/fastdfs-5.10/ /usr/local/fastdfs
[root@localhost ~]# cd /usr/local/fastdfs/
[root@localhost fastdfs]# ./make.sh
[root@localhost fastdfs]# ./make.sh install
编辑tracker.conf, storage.conf和client.conf配置文件
[root@localhost ~]# mkdir -p /data/fdfs/tracker /data/fdfs/storage /data/fdfs/client
[root@localhost ~]# cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
[root@localhost ~]# cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
[root@localhost ~]# cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
[root@localhost ~]# vim /etc/fdfs/tracker.conf
[root@localhost ~]# vim /etc/fdfs/storage.conf
[root@localhost ~]# vim /etc/fdfs/client.conf
[root@localhost ~]# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
[root@localhost ~]# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
[root@localhost ~]# ps -ef | grep fdfs
root 3483 1 0 10:54 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root 3494 1 3 10:55 ? 00:00:01 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
root 3507 2703 0 10:56 pts/0 00:00:00 grep –color=auto fdfs
[root@localhost ~]# tail -n 50 /data/fdfs/storage/logs/storaged.log
[root@localhost ~]# tail -n 5 /data/fdfs/storage/logs/storaged.log
upload文件
[root@localhost ~]# /usr/bin/fdfs_test /etc/fdfs/client.conf upload ~/turtle.jpg
download文件
[root@localhost ~]# /usr/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKjYjFko7RiAaIAaAABL1JGdlX4889.jpg
delete文件
[root@localhost ~]# /usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKjYjFko7RiAaIAaAABL1JGdlX4889.jpg
[root@localhost ~]# /usr/bin/fdfs_download_file /etc/fdfs/client.conf
group1/M00/00/00/wKjYjFko7RiAaIAaAABL1JGdlX4889.jpg
[2017-05-27 11:13:29] ERROR - file: tracker_proto.c, line: 48, server: 192.168.216.140:23000, response status 2 != 0
[2017-05-27 11:13:29] ERROR - file: ../client/storage_client.c, line: 598, fdfs_recv_header fail, result: 2
download file fail, error no: 2, error info: No such file or directory