1.安装环境
os:centos6.5
Fastdfs版本:FastDFS_v5.08.tar.gz
下载地址:https://sourceforge.net/projects/fastdfs/files/
libfastcommon:
下载地址:https://github.com/happyfish100/libfastcommon
2.安装libfastcommon
#unzip libfastcommon-master.zip #cd libfastcommon-master [root@localhost libfastcommon-master]# ./make.sh [root@localhost libfastcommon-master]# ./make.sh install mkdir -p /usr/lib64 mkdir -p /usr/lib install -m 755 libfastcommon.so /usr/lib64 install -m 755 libfastcommon.so /usr/lib mkdir -p /usr/include/fastcommon install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_define.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h fast_mpool.h fast_allocator.h fast_buffer.h skiplist.h multi_skiplist.h flat_skiplist.h skiplist_common.h system_info.h fast_blocked_queue.h php7_ext_wrapper.h id_generator.h /usr/include/fastcommon
3.安装FastDFS
#tar -zxvf libfastcommon_v1.01.tar.gz #cd FastDFS # ./make.sh #./make.sh install
4.配置tracker.conf
vim ./conf/storage.conf
//将文件中两处修改
port=22122
store_group=group1
5.配置storage.conf
group_name=group1 tracker_server=192.168.1.116:22123 http.domain_name=192.168.1.116
将标红处修改
6.创建存储路径
mkdir -p /home/yuqing/fastdfs
7.启动tracker和storage
fdfs_trackerd /usr/local/fdfs/FastDFS/conf/tracker.conf
fdfs_storaged /usr/local/fdfs/FastDFS/conf/storage.conf
8.测试上传
[root@localhost uploadFiles]# fdfs_test /usr/local/fdfs/FastDFS/conf/client.conf upload 707747_9_0_91467597429888_46.png This is FastDFS client test program v5.08 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page http://www.csource.org/ for more detail. [2016-07-05 20:18:18] DEBUG - base_path=/home/yuqing/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0 tracker_query_storage_store_list_without_group: server 1. group_name=, ip_addr=192.168.1.116, port=63233 group_name=group1, ip_addr=192.168.1.116, port=63233 storage_upload_by_filename group_name=group1, remote_filename=M00/00/00/wKgBdFd7pYqAcRwhAAGoT39l84E165.png source ip address: 192.168.1.116 file timestamp=2016-07-05 20:18:18 file size=108623 file crc32=2137387905 example file url: http://192.168.1.116/group1/M00/00/00/wKgBdFd7pYqAcRwhAAGoT39l84E165.png storage_upload_slave_by_filename group_name=group1, remote_filename=M00/00/00/wKgBdFd7pYqAcRwhAAGoT39l84E165_big.png source ip address: 192.168.1.116 file timestamp=2016-07-05 20:18:18 file size=108623 file crc32=2137387905 example file url: http://192.168.1.116/group1/M00/00/00/wKgBdFd7pYqAcRwhAAGoT39l84E165_big.png