首页 > 其他 > 详细

FastDFS 4.06 部署与配置

时间:2016-04-02 02:14:55      阅读:355      评论:0      收藏:0      [点我收藏+]

?

作者:黄湘龙
欢迎非商业转载,商业使用请联系我

?

目前官网提供的最新版本是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中:

写道
./fdfs_test ../conf/client.conf upload /home/parallels/Downloads/FastDFS_v4.06.tar.gz

This is FastDFS client test program v4.06

Copyright (C) 2008, Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.

[2016-04-01 15:31:18] DEBUG - base_path=/home/service/fastdfs/client, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0

tracker_query_storage_store_list_without_group:
server 1. group_name=, ip_addr=10.211.55.5, port=23000
server 2. group_name=, ip_addr=10.211.55.6, port=23000

group_name=group1, ip_addr=10.211.55.5, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY.tar.gz
source ip address: 10.211.55.5
file timestamp=2016-04-01 15:31:18
file size=398656
file crc32=1956546227
file url: http://10.211.55.5:8080/group1/M00/00/00/CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY.tar.gz
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY_big.tar.gz
source ip address: 10.211.55.5
file timestamp=2016-04-01 15:31:18
file size=398656
file crc32=1956546227
file url: http://10.211.55.5:8080/group1/M00/00/00/CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY_big.tar.gz

?

从上面可以看见上传的结果有最终的文件名和storage server的组名,通过这两个属性可以将文件下载下来。

测试下载,将刚才上传的文件下载下来:

?

写道
./fdfs_test ../conf/client.conf download group1 M00/00/00/CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY_big.tar.gz

This is FastDFS client test program v4.06

Copyright (C) 2008, Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.

[2016-04-01 15:35:37] DEBUG - base_path=/home/service/fastdfs/client, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0

storage=10.211.55.5:23000
download file success, file size=398656, file save to CtM3BVb-I8aIHIdPAAYVQHSehrMAAAAAQAAAAAABhVY_big.tar.gz

?

?

?

?

FastDFS 4.06 部署与配置

原文:http://fredlong.iteye.com/blog/2288039

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!