背景描述
OS
CentOS-6.3_x86-64
tracker
192.168.0.10
storage
192.168.0.11
1,安装libevent
- wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
- tar xvzf libevent-2.0.20-stable.tar.gz
- ./configure
- make
- make install
- 将库文件链接到/lib64
- ln -s /usr/local/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5
2,安装FastDFS
- wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz
- tar xvzf FastDFS_v3.11.tar.gz
- 修改 make.sh
- #WITH_HTTPD --> WITH_HTTPD
- ./make.sh
- ./make.sh install
3,启动FastDFS-->tracker
创建目录/opt/fastdfs
[root@ www.linuxidc.com ~]# mkdir /opt/fastdfs
修改tracker.conf配置
- [root@ www.linuxidc.com ~]# vim /etc/fdfs/tracker.conf
- base_path=/home/yuqing/fastdfs -> base_path=/opt/fastdfs
- ##include http.conf -> #include http.conf
启动tracker
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
重启
/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
4,启动FastDFS-->storage
创建目录/opt/fastdfs
[root@ www.linuxidc.com ~]# mkdir /opt/fastdfs
修改storage.conf配置
- [root@ www.linuxidc.com ~]# vim /etc/fdfs/storage.conf
- base_path=/home/yuqing/fastdfs --> /opt/fastdfs
- store_path0=/home/yuqing/fastdfs --> store_path0=/opt/fastdfs
- group_name=group1
- tracker_server=192.168.209.121:22122 --> tracker_server=192.168.0.10:22122
- ##include http.conf --> #include http.conf
启动storage
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
5,上传测试
修改client.conf
- [root@ www.linuxidc.com ~]# vim /etc/fdfs/client.conf
- vi /etc/fdfs/client.conf
- base_path=/home/yuqing/fastdfs-> base_path=/opt/fastdfs
- tracker_server=192.168.209.121:22122 -> tracker_server=192.168.0.10:22122
- ##include http.conf ->#include http.conf
上传
- [root@ www.linuxidc.com ~]# /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload FastDFS_v3.03.tar.gz
- This is FastDFS client test program v3.11
- 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.
- [2012-09-12 15:43:03] DEBUG - base_path=/opt/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0
- tracker_query_storage_store_list_without_group:
- server 1. group_name=group1, ip_addr=192.168.0.11, port=23000
- group_name=group1, ip_addr=192.168.0.11, port=23000
- storage_upload_by_filename
- group_name=group1, remote_filename=M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc.tar.gz
- source ip address: 192.168.0.11
- file timestamp=2012-09-12 15:43:06
- file size=371181
- file crc32=2146786407
- file url: http://192.168.0.10:8080/group1/M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc.tar.gz
- storage_upload_slave_by_filename
- group_name=group1, remote_filename=M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc_big.tar.gz
- source ip address: 8.0.0.11
- file timestamp=2012-09-12 15:43:06
- file size=371181
- file crc32=2146786407
- file url: http://192.168.0.10:8080/group1/M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc_big.tar.gz