?
作者:黄湘龙 欢迎非商业转载,商业使用请联系我?
目前官网提供的最新版本是4.06,官网的部署包下载地址是:
https://code.google.com/archive/p/fastdht/downloads
我们针对这个版本的部署细节进行描述:
?
?
1.依赖部署
依赖libevent,需要删除本机低版本的libevent,然后安装libevent的配对版本libevent-2.0.22-stable.tar.gz
libevent下载地址为:http://libevent.org/
安装libevent-2.0.22-stable.tar.gz步骤:
1) 移除之前的版本:
apt-get remove libevent*
2) 运行安装命令,注意需要参数安装
./configure --prefix=/usr/local/libevent
make && make install
3) 链接动态库?
ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
如果是64位系统,需要链接:?
ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
?
2.安装脚本确认
?
因为make.sh中的libpthread.so 、libpthread.a的路径和服务器的不一致,可能会导致运行make.sh的时候出错,我们需要先确认这两个库的地址和make.sh中的一致,如果不一直,需要加软链。
确认两个库的位置:
find / -name ‘libpthread.a‘
/usr/lib/x86_64-linux-gnu/libpthread.a
?
find / -name ‘libpthread.so‘
/usr/lib/x86_64-linux-gnu/libpthread.so
?
make.sh中对这两个库的引用位置并没有上面两个位置:
if [ -f /usr/lib/libpthread.so ] || [ -f /usr/local/lib/libpthread.so ] || [ -f /lib64/libpthread.so ] || [ -f /usr/lib64/libpthread.so ] || [ -f /usr/lib/libpthread.a ] || [ -f /usr/local/lib/libpthread.a ] || [ -f /lib64/libpthread.a ] || [ -f /usr/lib64/libpthread.a ];
?
增加软链:
link /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/libpthread.so
link /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/libpthread.a
?
如果不增加软链,在运行make.sh的时候可能会遇到以下错误:
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [fdfs_storaged] Error 1
?
?
3.部署步骤
?
准备工作做完后,部署过程就会比较顺利,首先我们修改下make.sh中的安装位置:
vim make.sh,将TARGET_PREFIX=/usr/local 修改为 /usr/local/fastdfs,TARGET_CONF_PATH=/etc/fdfs 修改为 /usr/local/fastdfs/conf
?
然后运行:
./make.sh C_INCLUDE_PATH=/usr/local/libevent/include LIBRARY_PATH=/usr/local/libevent/lib
./make.sh install
?
?
4.配置
已经把所有涉及的配置项已经全部翻译过来,由于篇幅比较大,不在本篇文章中详细说明,请点击链接:
tracer.conf
http://fredlong.iteye.com/blog/2287817
?
storage.conf
http://fredlong.iteye.com/blog/2287899
?
client.conf
http://fredlong.iteye.com/blog/2287999
?
5.启动与关闭
启动:
?
? ? /usr/local/fastdfs/bin/fdfs_trackerd ../conf/tracker.conf
? ? /usr/local/fastdfs/bin/fdfs_storaged ../conf/storage.conf
?
? ? ? ?关闭:
?
/usr/local/fastdfs/bin/stop.sh fdfs_trackerd
? ? ? /usr/local/fastdfs/bin/stop.sh fdfs_storaged
?
6.测试
测试上传:
将本机的/home/parallels/Downloads/FastDFS_v4.06.tar.gz?文件上传到FastDFS中:
?
从上面可以看见上传的结果有最终的文件名和storage server的组名,通过这两个属性可以将文件下载下来。
测试下载,将刚才上传的文件下载下来:
?
?
?
?
?
原文:http://fredlong.iteye.com/blog/2288039