上一篇介绍了如何在Linux搭建FastDFS,这篇主要讲解和FastDHT搭配使用。
说在前面
本篇基于前一篇继续完善功能:FastDFS - Linux下搭建FastDFS 文件服务器与Nginx配置(部署和运维)
FastDHT
前置操作
系统环境:CentOS 7.0 64位操作系统
Nginx版本:nginx-1.13.9
FastDFS版本:fastdfs-5.12
以下操作都是单机环境。
我把所有的安装包上传到/usr/local/package/FastDFS下,解压到/usr/local/FastDFS目录。
准备工作务必先看上一篇文章,否则无法继续进行。
准备工作
下载相关软件
下载地址:https://github.com/happyfish100
上传相关软件
将下载好的安装包,通过ftp工具上传到指定文件夹/usr/local/package/FastDFS下
安装FastDHT
解压
解压FastDHT到/usr/local/FastDFS目录。
# unzip fastdht-master.zip -d /usr/local/FastDFS/
打开安装目录
cd FastDFS/fastdht-master/
清除编译结果
./make.sh clean
编译
./make.sh
安装
./make.sh install
检查安装成功
cd etc/fdht/
配置FastDHT
配置文件fdht_servers.conf
vim /etc/fdht/fdht_servers.conf
group0 = 本机ip:11411
配置文件 fdhtd.conf
vi fdhtd.conf
修改以下内容其他默认
bind_addr=自己ip
# the base path to store data and log files
base_path=/home/fastdht/fastdht_log
配置文件storaged.conf
vim /etc/fdfs/storage.conf
在最后一行改成如下,#必须加
# you can use "#include filename" (not include double quotes) directive to
# load FastDHT server list, when the filename is a relative path such as
# pure filename, the base path is the base path of current/this config file.
# must set FastDHT server list when check_file_duplicate is true / on
# please see INSTALL of FastDHT for detail
##include /home/yuqing/fastdht/conf/fdht_servers.conf
#include /etc/fdht/fdht_servers.conf
创建相关目录
mkdir -p /home/fastdht/fastdht_log
启动FastDHT
/usr/local/bin/fdhtd /etc/fdht/fdhtd.conf
查看端口
netstat -ntlp
如果看到下面这样就ok了。
开机启动
vi /etc/rc.local
#fastDHT
/usr/local/bin/fdhtd /etc/fdht/fdhtd.conf
配置防火墙
vi /etc/sysconfig/iptables
条件如下内容:
## FastDHT Port
-A INPUT -m state --state NEW -m tcp -p tcp --dport 11411 -j ACCEPT
重启防火墙
service iptables restart
完事,bye。
下次见~