CentOS下搭建FastDFS

本文详细介绍了如何在 CentOS-6.3 上部署 FastDFS 集群,包括安装 libevent 和 FastDFS,配置 tracker 和 storage 服务,上传测试文件,并通过客户端进行文件上传验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景描述
OS
CentOS-6.3_x86-64

tracker
192.168.0.10

storage
192.168.0.11


1,安装libevent

wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
tar xvzf libevent-2.0.20-stable.tar.gz
./configure
make
make install

将库文件链接到/lib64
ln -s /usr/local/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5



2,安装FastDFS

wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz
tar xvzf FastDFS_v3.11.tar.gz

修改 make.sh
#WITH_HTTPD --> WITH_HTTPD

./make.sh
./make.sh install



3,启动FastDFS-->tracker

创建目录/opt/fastdfs
[code="java"]
# mkdir /opt/fastdfs
[/code]

修改tracker.conf配置
[code="java"]
# vim /etc/fdfs/tracker.conf
base_path=/home/yuqing/fastdfs -> base_path=/opt/fastdfs
##include http.conf -> #include http.conf

[/code]

启动tracker

/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf



重启

/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf



4,启动FastDFS-->storage

创建目录/opt/fastdfs
[code="java"]
# mkdir /opt/fastdfs
[/code]

修改storage.conf配置
[code="java"]
# vim /etc/fdfs/storage.conf
base_path=/home/yuqing/fastdfs --> /opt/fastdfs
store_path0=/home/yuqing/fastdfs --> store_path0=/opt/fastdfs
group_name=group1
tracker_server=192.168.209.121:22122 --> tracker_server=192.168.0.10:22122
##include http.conf --> #include http.conf

[/code]

启动storage

/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf



5,上传测试

修改client.conf
[code="java"]
# vim /etc/fdfs/client.conf
vi /etc/fdfs/client.conf
base_path=/home/yuqing/fastdfs-> base_path=/opt/fastdfs
tracker_server=192.168.209.121:22122 -> tracker_server=192.168.0.10:22122
##include http.conf ->#include http.conf

[/code]

上传
[code="java"]
# /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload FastDFS_v3.03.tar.gz
This is FastDFS client test program v3.11

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.

[2012-09-12 15:43:03] DEBUG - base_path=/opt/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0

tracker_query_storage_store_list_without_group:
server 1. group_name=group1, ip_addr=192.168.0.11, port=23000

group_name=group1, ip_addr=192.168.0.11, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc.tar.gz
source ip address: 192.168.0.11
file timestamp=2012-09-12 15:43:06
file size=371181
file crc32=2146786407
file url: http://192.168.0.10:8080/group1/M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc.tar.gz
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc_big.tar.gz
source ip address: 8.0.0.11
file timestamp=2012-09-12 15:43:06
file size=371181
file crc32=2146786407
file url: http://192.168.0.10:8080/group1/M00/00/00/CAAAC1BQPQqy0zXVAAWp7X_1XGc_big.tar.gz


[/code]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值