3.建立tracker 和 storage 的根目录
# tracker tracker $> mkdir -p /home/eric # storage storage $> mkdir -p /home/yangzi
4.在 一台storage上下载,比如我在 192.168.6.100上下载 nginx 和 fastdfs-nginx-module 模块
storage $> wget http://www.nginx.org/download/nginx-0.8.53.tar.gz storage $> svn export http://fastdfs-nginx-module.googlecode.com/svn/trunk/ fastdfs-nginx-module-read-only
5.编译安装 nginx 附带 fastdfs-nginx-module 模块
storage $> tar zxvf nginx-0.8.53.tar.gz storage $> cd nginx-0.8.53 storage $> ./configure --prefix=/usr/local/nginx --add-module=/root/fastdfs-nginx-module-read-only/src storage $> make storage $> make install # 拷贝mod_fastdfs.conf 到/etc/fdfs/ storage $> cp /root/fastdfs-nginx-module-read-only/src/mod_fastdfs.conf /etc/fdfs/
6.修改 nginx 配置文件增加
storage $> vim /usr/local/nginx/conf/nginx.conf
# 增加一下
location /M00 {
alias /home/eric/data;
ngx_fastdfs_module;
}
7. 给 storage 的存储目录做一个软连接
storage $> ln -s /home/yangzi/data /home/yangzi/data/M00
8. 启动两台 storage 和tracker nginx
# 启动 tracker tracker $> /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf # 启动 storage storage $> /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf # 启动 storage2 storage2 $> /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf #在 storage启动 nginx storage $> /usr/local/nginx/sbin/nginx
9、上传文件测试。
# 修改客户端配置文件
storage $> vim /etc/fdfs/client.conf connect_timeout=30 network_timeout=60 base_path=/home/yangzi tracker_server=192.168.6.102:22122 log_level=info #下面参数无所谓了反正没有用到http 服务 http.tracker_server_port=80
storage $> vim a.html test FastDFS!
storage $> /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload a.html
This is FastDFS client test program v2.04
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.
base_path=/home/yangzi, 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.6.100, port=23000
group_name=group1, ip_addr=192.168.6.100, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73.html
source ip address: 192.168.6.100
file timestamp=2010-12-02 17:16:03
file size=14
file crc32=674197143
file url: http://192.168.6.100/group1/M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73.html
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73_big.html
source ip address: 192.168.6.100
file timestamp=2010-12-02 17:16:03
file size=14
file crc32=674197143
file url: http://192.168.6.100/group1/M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73_big.html








