1. 安装准备

    yum install \
    vim \
    git \
    gcc \
    gcc-c++ \
    wget \
    make \
    libtool \
    automake \
    autoconf \
    -y \
  2. 安装libfastcommon

    cd /root
    git clone https://github.com/happyfish100/libfastcommon.git
    cd libfastcommon/
    ./make.sh
    ./make.sh install
  3. 安装fastdfs

    cd /root
    wget https://github.com/happyfish100/fastdfs/archive/V5.10.tar.gz
    tar -zxvf V5.10.tar.gz
    cd fastdfs-5.10
    ./make.sh
    ./make.sh install
  4. 如果只想安装FastDFS php客户端,请直接向下,找到php安装FastDFS扩展
  5. 创建目录

    mkdir /data/
    mkdir /data/fdfs
    # 代码服务器执行
    mkdir /data/fdfs/client
    # 存储服务器执行
    mkdir /data/fdfs/storage
    # 跟踪服务器执行
    mkdir /data/fdfs/tracker
  6. 配置的建议

    1. 每一台client配置上所有tracker服务器地址
    2. 每一台storage配置上所有tracker服务器地址
    3. 每一个group至少有2个storage服务互为备份机
    4. group name建议从group0开始命名(兼容FastDHT)
  7. 配置client(在client服务器[代码服务器])

    cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
    vim /etc/fdfs/client.conf base_path=/data/fdfs/client
    tracker_server=192.168.1.101:22122 #tracker服务器1 ip地址
    tracker_server=192.168.1.102:22122 #tracker服务器2 ip地址 ESC
    :wq
  8. 配置storage(在storage服务器)

    cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
    vim /etc/fdfs/storage.conf group_name=group0
    base_path=/data/fdfs/storage
    #这样配置只有M00
    store_path0=/data/fdfs/storage
    #这样配置就有M01(一般用于磁盘挂载的情况)
    #store_path1=/mnt/fdfs/storage
    #设置storage最大连接数
    max_connections=1024
    #tracker服务器1 ip地址
    tracker_server=192.168.1.101:22122
    #只有一台tracker不要增加这条↓!!!!!!!!
    #tracker_server=192.168.1.102:22122 #tracker服务器2 ip地址 #以下配置安装FastDHT才配置!!!!!!!!
    #以下配置安装FastDHT才配置!!!!!!!!
    #以下配置安装FastDHT才配置!!!!!!!! check_file_duplicate=1
    key_namespace=FastDFS
    keep_alive=1
    #include /etc/fdht/fdht_servers.conf ESC
    :wq
  9. 配置tracker(在tracker服务器)

    cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
    vim /etc/fdfs/tracker.conf bind_addr=192.168.1.101
    base_path=/data/fdfs/tracker
    # 0轮询 1指定组 2最大剩余空间
    store_lookup=2
    max_connections=1024
    # work_threads <= max_connections
    work_threads=16 ESC
    :wq
  10. 启动及测试【注意】

    # 如果storage.conf做了FastDHT配置,一定要先安装FastDHT
  11. 启动tracker和storage

    # 用来做tracker的服务器执行
    /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf # 用来做storage的服务器执行
    /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
  12. 启动与停止

    # 只能在对应服务器上进行对应操作!!!!!!!!
    # 只能在对应服务器上进行对应操作!!!!!!!!
    # 只能在对应服务器上进行对应操作!!!!!!!!
    # 启动
    /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
    /usr/bin/fdfs_storaged /etc/fdfs/storage.conf # 关闭
    /usr/bin/stop.sh /usr/bin/fdfs_trackerd
    /usr/bin/stop.sh /usr/bin/fdfs_storaged # 重启
    /usr/bin/restart.sh /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
    /usr/bin/restart.sh /usr/bin/fdfs_storaged /etc/fdfs/storage.conf # 查看集群storage分布(在storage服务器执行)
    /usr/bin/fdfs_monitor /etc/fdfs/storage.conf # 删除某个group中的一个storage(在storage服务器执行)
    /usr/local/bin/fdfs_monitor /etc/fdfs/storage.conf delete [group name] [ip address]
  13. 开机启动

    # 用来做tracker的服务器执行
    vim /etc/rc.local /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf ESC
    :wq chmod +x /etc/rc.local # 用来做storage的服务器执行
    vim /etc/rc.local /usr/bin/fdfs_storaged /etc/fdfs/storage.conf ESC
    :wq chmod +x /etc/rc.local
  14. 可通过日志查看是否启动成功

    # 用来做storage的服务器执行
    cat /data/fdfs/storage/logs/storaged.log|grep ERROR
    cat /data/fdfs/storage/logs/storaged.log|grep WARNING # 用来做tracker的服务器执行
    cat /data/fdfs/tracker/logs/trackerd.log|grep ERROR
    cat /data/fdfs/tracker/logs/trackerd.log|grep WARNING # 在storage服务器创建软连接
    # 配置Nginx才添加!!!!!!!!
    # 配置Nginx才添加!!!!!!!!
    # 配置Nginx才添加!!!!!!!!
    mkdir /www/fastdfs/group0
    ln -s /data/fdfs/storage/data/ /www/fastdfs/group0/M00
  15. 防火墙相关配置

    yum install firewalld
    
    systemctl enable firewalld
    systemctl start firewalld firewall-cmd --zone=public --add-port=11411/tcp --permanent
    firewall-cmd --zone=public --add-port=22122/tcp --permanent
    firewall-cmd --zone=public --add-port=23000/tcp --permanent firewall-cmd --reload
  16. 测试功能是否正常

    mkdir /test
    cd /test
    vim test.txt
    This is a test file.
    ESC
    :wq
    #上传
    /usr/bin/fdfs_test /etc/fdfs/client.conf upload /test/test.txt #下载
    /usr/bin/fdfs_download_file /etc/fdfs/client.conf group0/M00/00/00/xxx.txt
    #查看下载文件
    ll /test
    #删除下载文件
    rm /xxx.txt #删除
    /usr/bin/fdfs_delete_file /etc/fdfs/client.conf group0/M00/00/00/xxx.cfg
  17. 为php安装fastdfs_client扩展

    cd /root/fastdfs-5.10/php_client
    phpize
    ./configure make
    make install cat /root/fastdfs-5.10/php_client/fastdfs_client.ini >> /usr/local/php/lib/php.ini
    kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
  18. 为php安装fastcommon扩展

    cd /root/libfastcommon/php-fastcommon
    phpize
    ./configure make
    make install vim /usr/local/php/lib/php.ini extension=fastcommon.so ESC
    :wq kill -USR2 `cat /usr/local/php-7.1.4/var/run/php-fpm.pid`

CentOS7.X安装FastDFS-5.10的更多相关文章

  1. Centos7 上安装FastDFS

    Centos7 上安装 FastDFS 本文章摘抄于 风止鱼歇  博客地址:https://www.cnblogs.com/yufeng218/p/8111961.html 1.安装gcc(编译时需要 ...

  2. Linux CentOS7下安装Zookeeper-3.4.10服务(最新)

    Linux CentOS7下安装Zookeeper-3.4.10服务(最新) 2017年10月27日 01:25:26 极速-蜗牛 阅读数:1933   版权声明:本文为博主原创文章,未经博主允许不得 ...

  3. Centos7 上安装 FastDFS

    1.安装gcc(编译时需要) FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc yum install -y gcc ...

  4. centos7.x 安装 fastDFS

    环境准备 使用的系统软件 名称 说明 centos 7.x libfatscommon FastDFS分离出的一些公用函数包 FastDFS FastDFS本体 fastdfs-nginx-modul ...

  5. Centos7编译安装lnmp(nginx1.10 php7.0.2)

    我使用的是阿里云的服务器 Centos7 64位的版本 1. 连接服务器 这个是Xshell5的版本 安装好之后我们开始连接服务器 2. 安装nginx 首先安装nginx的依赖 yum instal ...

  6. CentOS7.0安装Nginx 1.10.0

    首先由于nginx的一些模块依赖一些lib库,所以在安装nginx之前,必须先安装这些lib库,这些依赖库主要有g++.gcc.openssl-devel.pcre-devel和zlib-devel ...

  7. CentOS7.2 安装RabbitMQ3.6.10

    CentOS上面使用yum安装比较方便 先记录一些rabbitmq的基本操作命令: $ sudo chkconfig rabbitmq-server on # 添加开机启动RabbitMQ服务 $ s ...

  8. Centos7下安装MongoDB4.0.10

    前言 模式自由 :可以把不同结构的文档存储在同一个数据库里 面向集合的存储:适合存储 JSON风格文件的形式 完整的索引支持:对任何属性可索引 复制和高可用性:支持服务器之间的数据复制,支持主-从模式 ...

  9. Linux centOS7 下安装mysql5.7.10

    1:下载二进制安装包 http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz 2:解压到 ...

  10. centos7下安装docker(10容器底层--cgroup和namespace)

    cgroup和namespace是实现容器底层的重要技术 cgroup:实现资源限制 namespace:实现资源隔离 1.cgroup:control group Linux操作系统通过cgroup ...

随机推荐

  1. SQL Puzzle

    1. 按条件分块取数据 有表A(CD),数据为 要求:当有CD为0的记录时,取得结果为0, 当表中没有CD=0的记录时,取得的结果为1,2,3(将CD<>0的记录都取出来) 可行SQL脚本 ...

  2. Spring框架中AOP特性

    1.AOP介绍 即:面向切面编程,在不改变原有方法的定义与使用.也不改变原程序流程的情况下,可以改变原有方法的功能{增加一些附加的功能,在指定的地方添加其他函数方法:} 2.其他的方法:[需要的四个接 ...

  3. Git-第N篇碰见的一些问题

    1.关于windows平台自动换行问题 warning: LF will be replaced by CRLF in readme.txt. The file will have its origi ...

  4. 使用ssh协议在linux主机之间快速上传和下载文件

    scp 要上传的文件 上传主机用户名@主机地址:要上传的主机目录 例如: scp *20181111*.gz inas@10.2.13.57:/INAS/dsgbak/20181110 表示将当前目录 ...

  5. 问题 H: 小k的简单问题

    问题 H: 小k的简单问题 时间限制: 1 Sec  内存限制: 128 MB提交: 107  解决: 57[提交] [状态] [命题人:jsu_admin] 题目描述 地图上有n个村庄,小k每个月需 ...

  6. 汇编移位: SHL、SHR、SAL、SAR、ROL、ROR、RCL、RCR

    SHL.SHR.SAL.SAR: 移位指令 ;SHL(Shift Left):      逻辑左移 ;SHR(Shift Right):      逻辑右移 ;SAL(Shift Arithmetic ...

  7. js+css实现点击回到顶部的效果(最低兼容至ie7)

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  8. Ext.js性能优化漫谈

    Ext.js是一个用于建立企业级应用的纯JS框架.毫无疑问,它为我们提供了大量的组件,比如container,panel,field,grid,这些组件使用起来很方便,不需要去写js和html,但是e ...

  9. Vue简单封装axios—解决post请求后端接收不到参数问题

    1.在src/下新建api文件夹,api/下新建index.js和public.js 在public.js中: import axios from 'axios'; import qs from 'q ...

  10. .NET File 多图上传

    HTML代码: <div> <div> <input type="file" style="display:none" id=&q ...