1,安装libevent
-
wget https:
-
将其拷贝到 /usr/local/lib下
-
tar xvzf libevent-
2.0
.
20
-stable.tar.gz
-
./configure
-
make
-
make install
-
-
测试libevent是否安装成功
ls -al /usr/lib | grep libevent
出来一大列东西,就说明安装成功了。
-
如果libevent的安装目录为/usr/local/lib下,则还需要建立
libevent-
2.0
.so.
5
到
/usr/lib 的软连接,这样其他程序运行时才能找到libevent库:
-
ln -s /usr/local/lib/libevent-
2.0
.so.
5
/usr/lib/libevent-
2.0
.so.
5
-
否则会出现
./tracker/fdfs_trackerd: error while loading shared
libraries:
libevent-2.0.so.5: cannot open shared object file: No such file or
directory)
2,安装FastDFS
-
wget http:
-
将其拷贝到/usr/local下
-
tar xvzf FastDFS_v3.
11
.tar.gz
-
-
修改 make.sh
-
#WITH_HTTPD=1 --> WITH_HTTPD =1
-
-
./make.sh
-
./make.sh install
3,启动FastDFS-->tracker
创建目录/opt/fastdfs
[root
@ www.linuxidc.com
~]# mkdir /opt/fastdfs
修改tracker.conf配置
-
[root
@ www.linuxidc.com
~]# vim /etc/fdfs/tracker.conf
-
base_path=/home/yuqing/fastdfs -> base_path=/opt/fastdfs
-
#
改成你想要的
http
端口,将来
http
下载文件的端口就是它了。
http.server_port=8080
->
http.server_port=8090
-
#http
支持
##include http.conf
->
#include
http.conf
-
#
默认
4GB
,如果空间不足,建议调小,否则会报
no
free space
的异常,无法正常启动。
reserved_storage_space = 4GB
->
reserved_storage_space = 1GB
-
#tracker server
对
storage
server
供服务的端口,使用默认的即可,也可以自定义
port=22122
启动tracker
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
进入/opt/fastdfs/
fastdfs_tracker/logs/trackerd.log
查看
tracker
的启动日志,
恭喜你,
tracker
server
已经启动成功!
重启
/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
关闭
/usr/local/bin/stop.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
4,启动FastDFS-->storage
创建目录/opt/fastdfs
[root@ www.linuxidc.com ~]# mkdir /opt/fastdfs
修改storage.conf配置
-
[root
@ www.linuxidc.com
~]# 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.217.130
:
22122
-
##include http.conf --> #include http.conf
启动storage
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
5,上传测试
修改client.conf
-
[root
@ www.linuxidc.com
~]# 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.217.130
:
22122
-
##include http.conf ->#include http.conf
-
[root
@ www.linuxidc.com
~]# /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload FastDFS_v3.
03
.tar.gz //假设当前目录下有
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:
-
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:
-
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:
6,
下载文件
在浏览器中,输入
http:
,
tracker
server
会自动重定向到存储文件的
storage
server
,文件下载成功。至此,已经成功搭建了
FastDFS
,编写你自己的
client
来进行访问吧;
7,监视器
# fdfs_monitor /etc/fdfs/storage.conf
测试代码
package com.test;
import java.net.InetSocketAddress;
import org.csource.common.NameValuePair;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerGroup;
import org.csource.fastdfs.TrackerServer;
public class JavaClient {
public JavaClient(){}
public static void doTest(){
try
{
String local_file_name ="/Users/ckwang17/Desktop/DCIM/100NCD90/DSC_0003.JPG";
String conf_filename = "/Users/ckwang17/Student/workspace/fastdfs/src/com/test/fdfs_client.conf";
NameValuePair []pair = {new NameValuePair("1111","222")};
ClientGlobal.init(conf_filename);
TrackerGroup group = new TrackerGroup(
new InetSocketAddress[]{
new InetSocketAddress("192.168.217.130",22122)
});
TrackerClient client = new TrackerClient(group);
TrackerServer ts = client.getConnection();
StorageServer storage = client.getStoreStorage(ts);
//System.out.println(storage.getSocket().);
StorageClient s_client = new StorageClient(ts,storage);
String url [] = s_client.upload_file(local_file_name, "jpg", pair);
storage.close();
for (int i = 0; i < url.length; i++) {
System.out.println(url[i]);
s_client.download_file(url[0], url[1], "/Users/ckwang17/Student/workspace/fastdfs/11.jpg");
}
}catch(Exception io){
io.printStackTrace();
}
}
public static void main(String[] args)throws Exception {
doTest();
}
}
分享到:
相关推荐
制作U盘安装CentOS 6.2是一个常见的系统部署任务,尤其对于IT专业人士而言,了解这一过程至关重要。这里我们将深入探讨如何使用给定的文件来完成这个任务。 首先,我们需要两个关键工具,从提供的文件列表中可以...
CentOS 6.2 安装超详细图解教程 CentOS 6.2 安装是许多 Linux 初学者和服务器管理员需要掌握的基本技能之一。本资源提供了超详细的图解教程,指导用户从下载 CentOS 6.2 镜像文件到安装完成整个过程。通过这个教程...
在CentOS 6.2系统下配置Django与Python环境是一项关键任务,尤其对于那些希望在稳定的企业级Linux操作系统上部署动态网站或Web应用的开发者而言。以下将详细阐述整个配置流程,涵盖从安装必要的软件包到最终启动...
centos6.2安装 CentOS 6.2安装 实验环境:VMware 6.5.2 安装镜像:CentOS-6.2-i386-bin-DVD1.iso CentOS-6.2镜像共两张DVD1和DVD2,安装操作系统只用DVD1即可 镜像下载地址: 32位DVD1...
centos6.2安装手册,用于宇视相关软件部署、开局所用。
安装日志中会提示 FastDFS 安装到了 /etc/fdfs 目录下。 配置 FastDFS 需要将三个示例文件复制一份,去掉.sample:cp client.conf.sample client.conf、cp storage.conf.sample storage.conf、cp tracker.conf....
本篇文章将详细介绍如何在CentOS7上进行离线安装FastDFS的过程,以及配合博客步骤来实现这一目标。 首先,我们需要获取FastDFS的安装包。通常,我们可以从FastDFS的官方网站或者其他可信源下载最新的源码包,比如`...
### CentOS 6.5 下安装 FastDFS #### 一、前言 FastDFS 是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载等),解决了大容量存储和负载均衡的...
### CentOS6.2硬盘安装全解析 #### 一、下载CentOS6.2镜像文件 在准备硬盘安装CentOS6.2之前,首要任务是从官方或其他可信赖的渠道下载正确的ISO镜像文件。根据需求,可以选择不同类型的镜像: 1. **CentOS-6.2-...
在CentOS 6.2操作系统环境下安装Sybase是一项重要的任务,尤其对于那些依赖于Sybase数据库系统的用户。本文将详细阐述在CentOS 6.2上安装Sybase的步骤,确保您能够顺利进行。 首先,我们需要创建一个专门用于运行...
在CentOS 6.2 64位操作系统中安装Oracle 11g涉及多个关键步骤,包括系统和配置要求、软件环境准备、用户环境设置以及后续的安装过程。以下是详细的知识点说明: 1. **系统及配置要求**: - 操作系统版本:CentOS ...
安装过程中,你需要按照"centos6.2下安装sybase--详细操作步骤.doc"中的指导进行。这通常包括解压安装文件,运行配置脚本,配置数据库实例,指定实例的端口、日志路径和数据文件位置。在配置过程中,确保遵循Sybase...
在 CentOS 6.2 操作系统上,NTP 服务器是系统自带的,不需要安装任何软件包。只需要配置 NTP 服务器的配置文件 `/etc/ntp.conf`,并添加 restrict 语句来限制访问权限。 ``` #vim /etc/ntp.conf restrict 220.130....
CentOS 6.2 rpm 方式安装 MySQL 的文档,简单实用!
CentOS 6.2编译安装LAMP最详细教程!