美文网首页
FastDFS单点安装

FastDFS单点安装

作者: 湫兮若风__流年 | 来源:发表于2018-12-21 11:12 被阅读0次

    需要开启的端口:Storage.conf中配置的server port: 23000;

    1. 准备工作(Tacker和Storage都需要安装):

      1. FastDFS安装包。
      2. 安装gcc: yum install make cmake gcc gcc-c++
    2. 安装libfastcommon(Tacker和Storage都需要安装):libfastcommon.zip在下面统称:lib.zip

      1. 上传lib.zip到/usr/local/software下;
      2. 解压lib.zip到/usr/local/fast/
      3. 进入目录: /usr/local/fast/libfastcommon-master/
      4. 编译: ./make.sh
      5. 安装: ./make.sh isntall;
        **:注意,lib被安装到了/usr/lib64。 但是一般来说,最好我们自己安装的东西都放在/usr/local/下面。
      6. 进行软链接:FastDFS主程序设置的目录为/usr/local/lib/,所以我们需要创建/usr/local/lib64下的一些核心执行程序的软链接文件。
        a. mkdir /usr/local/lib/
        b. ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
        c. ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
        d. ln -s /usr/lib64/libfastclient.so /usr/local/lib/libfastclient.so
        e. ln -s /usr/lib64/libfastclient.so /usr/lib/libfastclient.so
    3. 安装FastDFS:

      1. 进入到/usr/local/software/下,解压:FastDFS_v5.05.tar.gz文件。解压到:/usr/local/fast/
      2. 进入到/usr/local/fast/fastDFS/
      3. 编译: ./make.sh
      4. 安装: ./make install
      5. 采用默认安装方式脚本文件说明:
        1. 服务脚本:/etc/init.d/fast_storaged(fast_tracker):存在这么两个文件。
        2. 配置文件:
          1. /etc/fast/clinet.conf.sample
          2. /etc/fast/storage.conf.sample
          3. /etc/fast/tracker.conf.sample
        3. 命令行工具:/usr/bin/
        4. 因为Fast的服务脚本设置的bin目录在/usr/local/bin下,但是,实际的是安装在/usr/bin下;所以需要修改两个配置文件: /etc/init.d/fast_storaged(fast_tracker);使用: %s+/usr/local/bin+/usr/bin: 全局替换; 把/usr/bin/替换/usr/local/bin/;
    4. 配置Tracker:

      1. 进入/etc/fdfs/: 先复制一份Tracker.conf. 然后再修改Tracker。(注意:因为Tracker和Storaged配置在两台机器上,只在一台机器上修改Tracker.conf)。
      2. 修改Tracker.conf:
        1. base_path = /fastdfs/tracker/; 这个目录就是存放数据和日志的目录;
      3. 创建base_path设置的路径。
      4. 防火墙问题,开启端口;
      5. 启动跟踪器:
        1. 启动:/etc/init.d/fasdfs_trackerd start
        2. 查看进程: ps -el | grep fast
        3. 停止:/etc/init.d/fastdfs_trackerd stop
      6. 配置开机启动:
        1. vim /etc/rc.d/rc.local
        2. 加入配置: /etc/init.d/fdfs_trackerd start
    5. 配置Storage:

      1. 进入/etc/fdfs/: 先复制一份storage.conf. 然后再修改storage。(注意:因为Tracker和Storaged配置在两台机器上,只在一台机器上修改storage.conf)。
      2. 修改storage.conf:
        1. base_path=/fastdfs/storage
        2. store_path0=/fastdfs/storage
        3. tracker_server= Tracker的ip:port;
        4. http.server_port=8888;
      3. 创建目录:mkdir -p /fastdfs/storage
      4. 打开防火墙;
      5. 启动存储:/etc/init.d/fdfs_storage start; 注意: 必须Tracker是开启的;
      6. 配置开机启动:
        1. vim /etc/rc.d/rc.local
        2. 加入配置: /etc/init.d/fdfs_storagestart
    6. 测试:

      1. 使用命令上传一个文件:
        cd /etc/fdfs/
        cp client.conf.sample client.conf
      2. 修改client.conf文件:
        base_path=/fasrdfs/tracker
        tracker_server = Tracker ip:port
      3. 找到命令脚本的位置,使用命令上传:
        cd /usr/bin
        使用file_upload_file上传文件: file_upload_file client.conf file,此命令三部分组成(命令,client配置文件,上传的文件 )
    7. FastDFS 与 nginx 整合:

      1. 首先两台机器里必须安装nginx;
      2. 在存储节点安装fastdfs_nginx-module_v1.16.tar.gz;解压到/usr/local/fast/;
      3. 进入到/url/local/fast/fastdfs_nginx-module/src/
      4. 修改config文件:
        对CORE_INCS:把路径中local都去除了;
      5. 安葬nginx:
        1. 上传nginx.tar.gz;
        2. 解压nginx到 /usr/local/
        3. 下载nginx需要的依赖:
          1. yum install pcre/pcre-devel/zlib/zlib-devel

    相关文章

      网友评论

          本文标题:FastDFS单点安装

          本文链接:https://www.haomeiwen.com/subject/yihmkqtx.html