• Centos7 上安装 FastDFS


    获取安装包

    wget https://github.com/happyfish100/libfastcommon/archive/V1.0.39.tar.gz -SO libfastcommon.tar.gz
    wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz -SO fastdfs.tar.gz
    wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.20.tar.gz -SO fastdfs-nginx-module.tar.gz

    解压

    tar -xf xxx.tar.gz

    安装 libfastcommon

    cd libfastcommon-1.0.39
    ./make.sh
    ./make.sh install

    安装 fastdfs

    cd fastdfs-5.11

    ./make.sh
    ./make.sh install

    而配置文件是在/etc/fdfs下,但是这些配置文件不全,需要从fastdfs包中拷贝,并修改配置

    cd  ~/fastdfs-5.11/conf
    $ ls
    anti-steal.jpg client.conf http.conf mime.types storage.conf storage_ids.conf tracker.conf
    $ sudo cp ~/fastdfs-5.11/conf/*  /etc/fdfs

    修改配置

    sudo vi /etc/fdfs/tracker.conf

    # the tracker server port
    port=22122

    # the base path to store data and log files

    base_path=/home/caibh/fdfs

    # HTTP port on this tracker server

    http.server_port=80  # 与nginx配置一样

    修改 sudo vi /etc/fdfs/storage.conf

    # storage所属的组


    group_name=group1

     # the storage server port


    port=23000

     # the base path to store data and log files


    base_path=/home/caibh/fdfs

     # store_path#, based 0, if store_path0 not exists, it's value is base_path

    # the paths must be exist


    store_path0=/home/caibh/fdfs

    #store_path1=/home/caibh/fdfs2

    # tracker服务器,虽然是同一台机器上,但是不能写127.0.0.1。这项配置可以出现一次或多次


    tracker_server=191.8.1.77:22122

    # the port of the web server on this storage server


    http.server_port=80  # 与nginx配置一样

    修改 sudo vi /etc/fdfs/client.conf

    # the base path to store log files


    base_path=/home/caibh/fdfs/client

    # tracker_server can ocur more than once, and tracker_server format is

    #  "host:port", host can be hostname or ip address

    tracker_server=191.8.1.77.22122

    #HTTP settings

    http.tracker_server_port=80  # 与nginx配置一样

    模块操纵

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

    vim /etc/fdfs/mod_fastdfs.conf


    base_path=/tmp

    tracker_server=191.8.1.77:22122

    storage_server_port=23000

    group_name=group1

    #文件 url 中是否有 group 名

    url_have_group_name = true

    store_path0=/home/caibh/fdfs

    配置过程中有几点要注意:

     确保配置中用到的目录已经创建了。比如

    ~/fdfs/client

    ~/fdfs/data

     ~/fdfs/logs

    确保各种配置文件之间引用的端口一直。比如:

    mod_fastdfs.conf文件中 tracker_server  port 一致

    mod_fastdfs.conf文件中 storage_server_port的端口应该跟storage.conf中port 一致

    其他配置或文件虽然不用修改,但是

     fastdfs-nginx-module模块会用到:

    anti-steal.jpg

    http.conf

    mime.types

    启动FASTDFS

    fdfs_trackerd /etc/fdfs/tracker.conf restart

    默认端口是22122

    netstat -antp|grep trackerd

    启动FASTDFS

    fdfs_storaged /etc/fdfs/storage.conf restart

     

    Nginx安装依赖于pcre、zlib、openssl,在编译前配置时如果有问题
    可以使用yum方式安装三个包(pcre-devel、zlib-devel、openssl-devel)

    yum install -y pcre-devel zlib-devel openssl-devel wget gcc tree vim gd gd-devel  libxml2 libxml2-dev libxslt-dev libgd-dev

    wget http://nginx.org/download/nginx-1.10.3.tar.gz
    tar -xv nginx-1.10.3.tar.gz

    cd nginx-1.10.3

    ./configure
    --prefix=/usr/share/nginx
    --conf-path=/etc/nginx/nginx.conf
    --http-log-path=/var/log/nginx/access.log
    --error-log-path=/var/log/nginx/error.log
    --lock-path=/var/lock/nginx.lock
    --pid-path=/run/nginx.pid
    --http-client-body-temp-path=/var/lib/nginx/body
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi
    --http-proxy-temp-path=/var/lib/nginx/proxy
    --http-scgi-temp-path=/var/lib/nginx/scgi
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi
    --with-debug
    --with-pcre-jit
    --with-ipv6
    --with-http_ssl_module
    --with-http_stub_status_module
    --with-http_realip_module
    --with-http_auth_request_module
    --with-http_addition_module
    --with-http_dav_module
    --with-http_gunzip_module
    --with-http_gzip_static_module
    --with-http_image_filter_module
    --with-http_v2_module
    --with-http_sub_module
    --with-http_xslt_module
    --with-stream
    --with-stream_ssl_module
    --with-mail
    --with-mail_ssl_module
    --with-threads
    --add-module=/data/fastdfs-nginx-module-1.20/src

    make && make install

    如果报错

    /usr/local/include/fastdfs/fdfs_define.h:15:27: 致命错误:common_define.h:没有那个文件或目录

    编辑 fastdfs-nginx-module-1.20/src/config 文件

    vim fastdfs-nginx-module-1.20/src/config

    改变的文件内容

    ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
    CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

    重新编译

    ./configure
    --prefix=/usr/share/nginx
    --conf-path=/etc/nginx/nginx.conf
    --http-log-path=/var/log/nginx/access.log
    --error-log-path=/var/log/nginx/error.log
    --lock-path=/var/lock/nginx.lock
    --pid-path=/run/nginx.pid
    --http-client-body-temp-path=/var/lib/nginx/body
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi
    --http-proxy-temp-path=/var/lib/nginx/proxy
    --http-scgi-temp-path=/var/lib/nginx/scgi
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi
    --with-debug
    --with-pcre-jit
    --with-ipv6
    --with-http_ssl_module
    --with-http_stub_status_module
    --with-http_realip_module
    --with-http_auth_request_module
    --with-http_addition_module
    --with-http_dav_module
    --with-http_gunzip_module
    --with-http_gzip_static_module
    --with-http_image_filter_module
    --with-http_v2_module
    --with-http_sub_module
    --with-http_xslt_module
    --with-stream
    --with-stream_ssl_module
    --with-mail
    --with-mail_ssl_module
    --with-threads
    --add-module=/data/fastdfs-nginx-module-1.20/src

    make && make install

    修改nginx配置文件

    修改listen部分

    listen 80;
    server_name 192.168.221.131;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location /group1/M00/ {
        root /data/app/fdfs/data;
        ngx_fastdfs_module;
    }

    location / {
    root html;
    index index.html index.htm;
    }

    本地测试

    $ fdfs_test /etc/fdfs/client.conf upload ~/caibh/test_images/XinXiJuZhiWang.jpg
    This is FastDFS client test program v5.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.

    [2019-02-22 14:54:33] DEBUG - base_path=/home/xxxx/fdfs/client, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0

    tracker_query_storage_store_list_without_group:
    server 1. group_name=, ip_addr=191.8.2.203, port=23000

    group_name=group1, ip_addr=191.8.2.203, port=23000
    storage_upload_by_filename
    group_name=group1, remote_filename=M00/00/00/vwgCy1xvnKmAIDXDAAEM3XOobI4945.jpg
    source ip address: 191.8.2.203
    file timestamp=2019-02-22 14:54:33
    file size=68829
    file crc32=1940417678
    example file url: http://191.8.2.203:9270/group1/M00/00/00/vwgCy1xvnKmAIDXDAAEM3XOobI4945.jpg
    storage_upload_slave_by_filename
    group_name=group1, remote_filename=M00/00/00/vwgCy1xvnKmAIDXDAAEM3XOobI4945_big.jpg
    source ip address: 191.8.2.203
    file timestamp=2019-02-22 14:54:33
    file size=68829
    file crc32=1940417678
    example file url: http://191.8.2.203:9270/group1/M00/00/00/vwgCy1xvnKmAIDXDAAEM3XOobI4945_big.jpg

    http://191.8.2.203:8777/M00/00/00/vwgCy1xvnKmAIDXDAAEM3XOobI4945_big.jpg

    # 如果能看到图片则表示安装fastdfs-nginx-module成功

    版权声明:本文根据网上资源以及自己安装实践完成,如有侵权请留言,我会在第一时间下架!

  • 相关阅读:
    pywinauto首页、文档和下载
    Android UI自动化测试最佳实践
    5个最佳的Android测试框架(带示例) – 码农网
    (转)使用graphviz绘制流程图
    使用 Graphviz 生成自动化系统图
    程序员的绘图利器 — Graphviz
    绘图工具graphviz学习使用
    Git Book 中文版
    [git] 更新到某个指定版本
    LindDotNetCore~Aspect面向方面编程
  • 原文地址:https://www.cnblogs.com/asia90li/p/13803136.html
Copyright © 2020-2023  润新知