FastDFS

首先是安装FastDFS,然后分别对tracker和storage分别进行配置,这里采用的是纯粹的单机模式。即tracker和storage都在同一台服务器上,没有涉及分布式的tarcker和storage。

1.安装

安装需要的依赖libfastcommon:

wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz    #下载安装包
tar zxvf libfastcommon-1.0.7.tar.gz    #解压
./make.sh && ./make.sh install    #编译安装

 

安装FastDFS:

wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
tar zxvf fastdfs-5.05.tar.gz    #解压
./make.sh && ./make.sh install    #编译安装

2.配置Tracker

进入 cd /etc/fdfs目录

下面有三个模板文件 client.conf.sample  tracker.conf.sample  storage.conf.sample

分别对应client,tracker,storage的配置文件,使用的时候要去掉后面的.sample。

首先修改 tracker.conf.sample:

cp tracker.conf.sample tracker.conf

vi tracker.conf

需要注意的配置有两个:

# the base path to store data and log files
base_path=/usr/data/tracker

# the tracker server port
port=22122

# HTTP port on this tracker server
http.server_port=8080

注意配置完成后,启动tracker服务之前,一定要确保base_path目录存在。

firewall-cmd --add-port=22122/tcp --permanent    #启动前开放端口
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf    #启动命令

lsof -i:22122命令,可以看到端口已被监听。

3.配置storage

/etc/fdfs/storage.conf:

# the base path to store data and log files
base_path=/usr/data/storage

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.1.1:22122

# the port of the web server on this storage server
http.server_port=8888

启动服务之前同上,确保base_path目录存在且8888端口开放。启动命令:

/usr/bin/fdfs_storged /etc/fdfs/storage.conf

lsof查看是否启动成功:

lsof -i:8888

4.测试
 

测试之前要配置下/ect/fdfs/client.conf

# the base path to store log files
base_path=/usr/data/client

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.1.1:22122

#HTTP settings
http.tracker_server_port=80

测试上传:

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /var/test/test.jpg

上传成功:

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值