zoukankan      html  css  js  c++  java
  • FastDFS+Nginx分布式文件系统部署安装

    安装:

    ##安装tracker、storage参考:http://www.cnblogs.com/zclzhao/p/5025229.html

                   nginx代理设置参考:http://www.cnblogs.com/zclzhao/p/5033391.html

    192.168.12.92 tracker Nginx
    192.168.12.22  storage nginx
    192.168.12.25  storage nginx

    192.168.12.22
    tar zxvf fastdfs-nginx-module_v1.16.tar.gz
    cd nginx-1.1.7
    ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/cacti/lnmp/openssl-1.0.0a --with-zlib=/cacti/lnmp/zlib-1.2.3 --with-pcre=/cacti/lnmp/pcre-8.20 --add-module=/cacti/lnmp/fastdfs-nginx-module/src
    make
    cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
    cp /cacti/nginx-1.1.7/objs/nginx /usr/local/nginx/sbin/nginx

    ln -s /cacti/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
    vi /etc/fdfs/mod_fastdfs.conf
    connect_timeout=30
    network_timeout=30
    base_path=/tmp
    load_fdfs_parameters_from_tracker=true
    storage_sync_file_max_delay = 86400
    use_storage_id = false
    storage_ids_filename = storage_ids.conf
    tracker_server=192.168.12.92:22122
    storage_server_port=23000
    group_name=group1
    url_have_group_name = true
    store_path_count=1
    store_path0=/fastdfs
    log_level=info
    log_filename=
    response_mode=proxy
    if_alias_prefix=
    flv_support = true
    flv_extension = flv
    group_count = 0
    注意:mod_fastdfs.conf 先关属性配置必须和storage.conf 配置保持一致
    vi /usr/local/nginx/conf/nginx.conf
    location / {
                root   /fastdfs/data/00/00/;
                ngx_fastdfs_module;
                index  index.html index.htm index.php;
            }

    nginx重启:

    /usr/local/nginx/sbin/nginx -s reload

    ---------------------------------------报错处理--------------------------------
    fastdfs-nginx-module/src/common.c:21:25: 错误:fdfs_define.h:没有那个文件或目录
    ln -s /usr/include/fastcommon /usr/local/include/
    ln -s /usr/include/fastdfs /usr/local/include/
    ln -s /usr/lib64/libfastcommon.so /usr/local/lib/

    ##ERROR - file: ini_file_reader.c, line: 394, include file "http.conf" not exists, line: "#include http.conf"
    cd /cacti/FastDFS/conf
    cp http.conf mime.types /etc/fdfs/

    ##ERROR - file: /cacti/fastdfs-nginx-module/src/common.c, line: 586, url length: 1 < 16
    vi /cacti/fastdfs-nginx-module/src/mod_fastdfs.conf
    url_have_group_name = true
    --------------------------------------报错处理----------------------------------

    以上操作在192.168.12.25上操作一遍

    192.168.12.92上安装tracker、Nginx

    vi /usr/local/nginx/conf/nginx.conf
    user  www www;
    worker_processes  1;
    error_log  /cacti/nginx/logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    #pid        logs/nginx.pid;
    events {
        worker_connections  1024;
    }

    http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 128;
    proxy_headers_hash_max_size 51200;
    proxy_headers_hash_bucket_size 6400;
    client_header_buffer_size 4k;
    large_client_header_buffers 4 32k;
    tcp_nopush     on;
    keepalive_timeout 300;
    tcp_nodelay on;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
    server_tokens off;
    client_body_buffer_size 256k;
    send_timeout 3m;
    client_header_timeout 3m;
    client_body_timeout 3m;
    proxy_ignore_client_abort on;
    gzip on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css ap        plication/xml;
    gzip_vary on;
    include vhosts/*.conf;
    }

    vi /usr/local/nginx/conf/vhosts/upstream.conf

    upstream test {
            server 192.168.12.22:80;
            server 192.168.12.25:80;
            }

    vi /usr/local/nginx/conf/vhosts/proxy.conf


    server{
            listen             80;
            server_name  192.168.12.22;

    location / {
            proxy_pass http://test/;
      }
    }
    server{
            listen             80;
            server_name  192.168.12.25;

    location / {
            proxy_pass http://test/;
      }
    }



    vi /cacti/FastDFS/conf/client.conf
    tracker_server=192.168.12.92:22122

    启动trackerd

    /etc/init.d/fdfs_trackerd start

    测试上传

    cd /fastdfs/data

    /usr/bin/fdfs_test /cacti/FastDFS/conf/client.conf upload 234.jpg.

    到此配置完成

  • 相关阅读:
    gThumb 3.1.2 发布,支持 WebP 图像
    航空例行天气预报解析 metaf2xml
    Baruwa 1.1.2 发布,邮件监控系统
    Bisect 1.3 发布,Caml 代码覆盖测试
    MoonScript 0.2.2 发布,基于 Lua 的脚本语言
    Varnish 入门
    快速增量备份程序 DeltaCopy
    恢复模糊的图像 SmartDeblur
    Cairo 1.12.8 发布,向量图形会图库
    iText 5.3.4 发布,Java 的 PDF 开发包
  • 原文地址:https://www.cnblogs.com/zclzhao/p/5039441.html
Copyright © 2011-2022 走看看