当前位置 主页 > 服务器问题 > nginx问题汇总 >

    nginx的FastDFS分布式存储模块测试方法(3)

    栏目:nginx问题汇总 时间:2018-12-11 16:50

    3.建立tracker 和 storage 的根目录

    # trackertracker $> mkdir -p /home/eric# storagestorage $> 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.gzstorage $> 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.gzstorage $> cd nginx-0.8.53storage $> ./configure --prefix=/usr/local/nginx --add-module=/root/fastdfs-nginx-module-read-only/srcstorage $> makestorage $> 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

    # 启动 trackertracker $> /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf# 启动 storagestorage $> /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf# 启动 storage2storage2 $> /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf#在 storage启动 nginxstorage $> /usr/local/nginx/sbin/nginx

    9、上传文件测试。
    # 修改客户端配置文件

    storage $> vim /etc/fdfs/client.confconnect_timeout=30network_timeout=60base_path=/home/yangzitracker_server=192.168.6.102:22122log_level=info#下面参数无所谓了反正没有用到http 服务http.tracker_server_port=80
    storage $> vim a.htmltest FastDFS!
    storage $> /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload a.htmlThis is FastDFS client test program v2.04Copyright (C) 2008, Happy Fish / YuQingFastDFS may be copied only under the terms of the GNU GeneralPublic 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=0tracker_query_storage_store_list_without_group:    server 1. group_name=group1, ip_addr=192.168.6.100, port=23000group_name=group1, ip_addr=192.168.6.100, port=23000storage_upload_by_filenamegroup_name=group1, remote_filename=M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73.htmlsource ip address: 192.168.6.100file timestamp=2010-12-02 17:16:03file size=14file crc32=674197143file url: http://192.168.6.100/group1/M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73.htmlstorage_upload_slave_by_filenamegroup_name=group1, remote_filename=M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73_big.htmlsource ip address: 192.168.6.100file timestamp=2010-12-02 17:16:03file size=14file crc32=674197143file url: http://192.168.6.100/group1/M00/00/00/wKgGvEz3Y9MAAAAAAAAADigvbpc73_big.html

    打开IE浏览器访问: