centos7下安装fastdfs

来源:互联网 发布:视倾角换算软件 编辑:程序博客网 时间:2024/06/05 00:39
参考文献:http://dorole.com/tag/fastdfs/

  • 安装编译环境
[html] view plain copy
  1. yum -y groupinstall 'Development Tools'   
  2. yum -y install wget   
  • 下载安装libfastcommon
[html] view plain copy
  1. git clone https://github.com/happyfish100/libfastcommon.git  
  2. cd libfastcommon/  
  3. ./make.sh   
  4. ./make.sh install  
  • 下载安装fastdfs
[html] view plain copy
  1. https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz  
  2. tar -zxvf V5.05.tar.gz   
  3. cd fastdfs-5.05/  
  4. ./make.sh  
  5. ./make.sh install  
  • 修改配置文件
    • 创建目录,存储日志和数据,如下
[html] view plain copy
  1. -data  
  2.     -fdfs  
  3.         -tracker  
  4.         -storage  
  5.         -client  
    • 配置tracker
 
[html] view plain copy
  1. cd /etc/fdfs  
  2. mv tracker.conf.sample tracker.conf  
  3. vi tracker.conf  
  4. //...  
  5. base_path=/data/fdfs/tracker  
  6. //...  
    • 配置storage
[html] view plain copy
  1. cd /etc/fdfs  
  2. mv storage.conf.sample storage.conf  
  3. vi storage.conf  
  4. //...  
  5. base_path=/data/fdfs/storage #指定日志位置  
  6. store_path0=/data/fdfs/storage #指定数据位置  
  7. tracker_server=192.168.153.130:22122  #指定tracker服务器地址  
  8. //...  
    • 配置client
[html] view plain copy
  1. cd /etc/fdfs  
  2. mv client.conf.sample client.conf  
  3. vi client.conf  
  4. //...  
  5. base_path=/data/fdfs/client  
  6. tracker_server=192.168.153.130:22122  
  7. //...  
  • 启动tracker和storage
[html] view plain copy
  1. /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf   
  2. /usr/bin/fdfs_storaged /etc/fdfs/storage.conf   

可通过日志查看是否启动成功
[html] view plain copy
  1. tail -f /data/fdfs/storage/logs/storaged.log   
  2. tail -f /data/fdfs/tracker/logs/trackerd.log   
  • 测试
利用dfds自带的测试类进行测试

[html] view plain copy
  1. #上传  
  2. /usr/bin/fdfs_test /etc/fdfs/client.conf  upload /home/lily/a.txt  
  3.   
  4. #下载  
  5. /usr/bin/fdfs_download_file  /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt  
  6.   
  7. #删除  
  8. /usr/bin/fdfs_delete_file  /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt  

注:路径中的M00是基路径。fastdfs支持多个磁盘(base_path),如果base_path只有一个,那么就是M00,如果有两个,第二个是M01(Mxx中xx是十六进制

转载自:http://blog.csdn.net/xll233xx/article/details/50619170

原创粉丝点击