安装fastDFS

https://i-blog.csdnimg.cn/blog_migrate/e1f4b912ddf3fbc97eb4e852051008bf.webp?x-image-process=image/format,png

 

首先要下载GCC编译环境,通过npm包管理器安装

先装tracker

  • 安装 libfastcommon、perl依赖,下载libfastcommon-master.zip,上传到服务器的/usr目录下。
    https://github.com/happyfish100/libfastcommon
  •   [root@localhost usr]# unzip libfastcommon-master.zip
  •   [root@localhost usr]# cd libfastcommon-master
  •   [root@localhost usr]# ./make.sh
  •   [root@localhost usr]# ./make.sh install

   安装perl环境,如果联网使用yum包管理器来安装。

  •   [root@localhost usr]# yum install perl

   如果服务器不能联网,下载安装包http://www.cpan.org/src/5.0/perl-5.16.1.tar.gz  解压

tar -zxvf perl-5.16.1.tar.gz 
./Configure -des -Dprefix=/usr/local/perl

编译安装

make 
make test 
make install

      整个make的过程时间非常长,需要耐心等待。

 

  • 编译安装fastdfs
  •   [root@localhost usr] # tar -zxvf fastdfs-5.08.tar.gz
  •   [root@localhost usr] # cd fastdfs-5.08
  •   [root@localhost fastdfs-5.08] # ./make.sh
  •   [root@localhost fastdfs-5.08] # ./make.sh  install

出现

  mkdir -p /usr/bin

  mkdir -p /etc/fdfs

这样的提示表示FastDFS安装成功。

 

fastDFS命令目录:/usr/bin

fastDFS配置文件目录:/etc/fdfs

  • 创建fastdfs数据目录
  •   mkdir -pv /data/fastdfs/tracker
  • 修改tracker.conf中的 base_path=/data/fastdfs/tracker,即刚才配置的数据文件目录
  •  cp etc/fdfs/tracker.conf.sample etc/fdfs/tracker.conf

 vi  etc/fdfs/tracker.conf



再装storage

  • 创建配置文件
  •   cp etc/fdfs/storage.conf.sample etc/fdfs/storage.conf
  •   vi  etc/fdfs/storage.conf
  • 修改tracker.conf中的
  •   disabled=false #启用配置文件
  •   group_name=group1 #组名,根据实际情况修改
  •   port=23000 #设置 storage 的端口号
  •   base_path=/data/fastdfs/storage #设置 storage 的日志目录(需预先创建)
  •   store_path_count=1 #存储路径个数,需要和 store_path 个数匹配
  •   store_path0=/data/fastdfs/storage #存储路径
  •   tracker_server=192.168.1.177:22122 #tracker 服务器的 IP 地址和端口号
  • 启动
  •   cd /usr/bin
  •   ./fdfs_storaged  /etc/fdfs/storage.conf restart

 

java client

Javaclient的jar包不在maven的中央仓库中,需要下载源码包手工安装到私服中。

下载地址:https://github.com/happyfish100/fastdfs-client-java

我们主要关注storageclient这个类,这个类提供了文件上传下载查询文件信息等主要功能,与系统的集成也主要使用这个api。

 

 

  新建fastDFS.conf配置文件

  connect_timeout = 2

  network_timeout = 20

  #tracker服务器地址,如果有多个tracker可以配置多个tracker_server

  tracker_server=192.168.1.177:22122

  运行源码包中的org.csource.fastdfs.test.testClient.java,注意在main方法中需要传递两个参数,第一个是配置文件,第二个是待上传的文件


重启fastdfs的storage命令

 /etc/init.d/fdfs_storaged start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值