• fastdfs/nginx文件系统安装配置


    一,libevent安装(建议使用1.4.xx稳定版本,如1.4.14b)

    cd /usr/local/src

    wget https://github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz

     tar zvxf libevent-1.4.14b-stable.tar.gz 

    cd libevent-1.4.14b-stable 

    ./configure; make; make install 


    为libevent创建软链接到/lib库下,64位系统对应/lib64 

    ln -s /usr/local/lib/libevent* /lib/ 

    ln -s /usr/local/lib/libevent* /lib64/ 

    二,安装fastdfs

    1,cd /usr/local
    wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz 

    tar zvxf FastDFS_v3.11.tar.gz 

    cd FastDFS ./make.sh ./make.sh install

    2,创建存储目录

      mkdir /home/fastdfs

    3,配置tracker_server

      vim /etc/fdfs/tracker.conf

      设置base_path=/home/fastfds

      启动 /usr/bin/fdfs_trackerd    /etc/fdfs/tracker.conf

    4,配置storage_server

      vim /etc/fdfs/storage.conf

      设置base_path=/home/fastdfs

      store_path0=/home/fastdfs

      tracker_server=10.1.20.201:22122

      tracker_server=10.1.20.201:22122(可以指定多个tracker_server,换行即可)

    启动 /usr/bin/fdfs_storaged  /etc/fdfs/storage.conf

    三,nginx插件模块安装

      1,在每台storage server上部署web server,直接对外提供http服务,tracker server上不需要

      部署webserver,如果请求文件在当前storage上不存在,通过文件ID,反解出源storage,直

      接请求源storage,FastDFS扩展模块不依赖于FastDFS server,可以独立存在

      cd /opt 

      wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.11.tar.gz 

      tar zxvf fastdfs-nginx-module_v1.11.tar.gz 

    nginx安装 需要zlib,pcre倚赖包安装

    2,nginx.conf添加的部分

    vim /usr/local/nginx/conf/nginx.conf

    添加

      location /group1/M00

      {

        root /home/fastdfs/data;

        ngx_fastdfs_module;

      }

    启动nginx

    /usr/local/nginx/sbin/nginx

    3,mod_fastdfs模块设置

    cp /opt/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

    vim /etc/fdfs/mod_fastdfs.conf

    设置base_path=/home/fastdfs

      tracker_server=10.1.20.20:22122

      tracker_server=10.1.20.204:22122

      store_path0=/home/fastdfs

      response_mode=proxy

      url_have_group_name=true

      log_file=/opt/fastdfs.log

    4,修改client.conf

      vim /etc/fdfs/client.conf

      base_path=/home/fastdfs

      tracker_server=10.1.20.201:22122

      tracker_server=10.1.20.204:22122

    5,冗余测试

      首先先停掉一个storage server的服务,再上传一个文件,现在就只有一台机器有这个文件。 但是这时候通过浏览器去两个网址请求该文件的时候,都可以拿到该文件,这个就是FastDFS的nginx插件起作用的结果,该插件会检查本地是否有这个文件,如果没有就会向tracker询问到底同组哪台服务器有这个文件,然后作为向拥有这个文件的Nginx请求拿回文件并传回客户的浏览器,相当于一个proxy,这也就是在上面/etc/fdfs/mod_fastdfs.conf里面的response_mode=proxy。这里还有另外一个方法,是默认的redirect,这种方法是没有该文件的服务器会返回一个302,告诉客户去请求另外一个地址

  • 相关阅读:
    【转载】大型系统中使用JMS优化技巧
    【原创】JMS发布者订阅者【异步接收消息】
    【原创】JMS生产者和消费者【PTP异步接收消息】
    泛型
    For-Each循环
    策略模式(Strategy)
    Sort--快速排序
    Serach
    Sort--冒泡排序
    数值交换
  • 原文地址:https://www.cnblogs.com/songjy2116/p/5292741.html
Copyright © 2020-2023  润新知