Fastdfs 安装

网上说fastdfs5.2 增加了好多功能修复了一些bug,正好我们用的4.多的版本用手机上传图片的时候遇到各种问题,然后决定换成5.2版本的以下是安装的一些笔记

环境:centos 6.5

fastdfs版本 5.2

tracker 192.168.1.100

storage 192.168.1.101

storage 192.168.1.102

[[email protected] ~]# rpm -qa|grep libevent
libevent-1.4.13-4.el6.x86_64
[[email protected] ~]# rpm -e libevent-1.4.13-4.el6.x86_64

[[email protected] ~]# tar xvf libevent-2.0.21-stable.tar.gz 

[[email protected] ~]# cd libevent-2.0.21-stable

[[email protected] libevent-2.0.21-stable]# ./configure && make && make install

[[email protected] libevent-2.0.21-stable]# ln -s /usr/local/lib/libevent* /lib
[[email protected] libevent-2.0.21-stable]# ln -s /usr/local/lib/libevent* /lib64/

[[email protected] ~]# tar xvf FastDFS_v5.02.tar.gz 

[[email protected] ~]# cd FastDFS

[[email protected] FastDFS]# ./make.sh 

[[email protected] FastDFS]# ./make.sh install

tracker

[[email protected] ~]# grep -Ev ‘^$|^#‘ /etc/fdfs/tracker.conf
disabled=false
bind_addr=
port=22122
connect_timeout=30
network_timeout=60
base_path=/opt/fastdfs
max_connections=256
work_threads=4
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=fastdfs
run_by_user=fastdfs
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false 
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html

storage

[[email protected] ~]# grep -Ev ‘^$|^#‘ /etc/fdfs/storage.conf

disabled=false
group_name=root
bind_addr=
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/opt/fastdfs
max_connections=256
buff_size = 256KB
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/opt/fastdfs
subdir_count_per_path=256
tracker_server=192.168.1.100:22122
log_level=info
run_by_group=fastdfs
run_by_user=fastdfs
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=888

[[email protected] ~]# grep -Ev ‘^$|^#‘ /etc/fdfs/mod_fastdfs.conf 
connect_timeout=2
network_timeout=30
base_path=/tmp
load_fdfs_parameters_from_tracker=true
storage_sync_file_max_delay = 86400
use_storage_id = false
storage_ids_filename = storage_ids.conf
tracker_server=192.168.1.100:22122
storage_server_port=23000
group_name=root
url_have_group_name = false
store_path_count=1
log_level=info
log_filename=
response_mode=proxy
if_alias_prefix=
http.need_find_content_type=false
flv_support = true
flv_extension = flv
group_count = 0

[[email protected] ~]# tar xvf fastdfs-nginx-module_v1.15.tar.gz 

[[email protected] ~]# ./configure --user=www --group=www --add-module=/root/fastdfs-nginx-module/src/ --with-http_stub_status_module --with-http_ssl_module --prefix=/usr/local/nginx

nginx.conf 配置
    server {
        listen       80;
        server_name localhost;
        root /opt/fastdfs/data;
        access_log  logs/a.access.log;
        error_log  logs/a.error.log;
        location /root/M00 {
            alias /opt/fastdfs/data;
            ngx_fastdfs_module;
        }
    }

php 模块安装

[[email protected] ~]# cd FastDFS/php_client/

[[email protected] php_client]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

[[email protected] php_client]# ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install

php.ini配置如下

extension = fastdfs_client.so
fastdfs_client.base_path = /opt/fastdfs
fastdfs_client.connect_timeout = 2
fastdfs_client.network_timeout = 60
fastdfs_client.log_level = info
fastdfs_client.log_filename = 
fastdfs_client.http.anti_steal_secret_key = 
fastdfs_client.tracker_group_count = 1
fastdfs_client.tracker_group0 = /etc/fdfs/client.conf
fastdfs_client.use_connection_pool = false
fastdfs_client.connection_pool_max_idle_time = 3600

tracker启动
/usr/local/bin/fdfs_tracker /etc/fdfs/tracker.conf start

storage启动
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf start

[[email protected] ~]# /usr/local/bin/fdfs_test /etc/fdfs/client.conf upload 20150114.txt 
This is FastDFS client test program v5.02

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.

[2015-01-14 13:49:33] 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, 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=192.168.1.101, port=23000
        server 2. group_name=, ip_addr=192.168.1.102, port=23000

group_name=root, ip_addr=192.168.1.101, port=23000
storage_upload_by_filename
group_name=root, remote_filename=M00/00/6A/fdAJ2FS2A22AQhHvAAAAXlctSVo396.txt
source ip address: 192.168.1.101
file timestamp=2015-01-14 13:49:33
file size=94
file crc32=1462585690
example file url: http://192.168.1.101:8080/root/M00/00/6A/fdAJ2FS2A22AQhHvAAAAXlctSVo396.txt
storage_upload_slave_by_filename
group_name=root, remote_filename=M00/00/6A/fdAJ2FS2A22AQhHvAAAAXlctSVo396_big.txt
source ip address: 192.168.1.101
file timestamp=2015-01-14 13:49:34
file size=94
file crc32=1462585690
example file url: http://192.168.1.101:8080/root/M00/00/6A/fdAJ2FS2A22AQhHvAAAAXlctSVo396_big.txt

好了总算是弄通了!

中间过程中遇到了一些问题在这做下记录

报错(一):

ERROR - file: tracker_func.c, line: 360, getgrnam fail, errno: 2, error info: No such file or directory

上边这个错服务启动不起来,网上查了半天,最后才想到因为没有创建对应的帐号fastdfs,创建好帐号后,可以正常启动了

报错(二)

ERROR - file: tracker_client_thread.c, line: 275, connect to tracker server 192.168.1.100:22122 fail, errno: 4

, error info: Interrupted system call

这个错是防火墙的原因,当时只把端口加到防火墙了,但是没有重启,所以没有生效

报错(三)

ERROR - file: tracker_proto.c, line: 48, server: 192.168.1.102:23000, response status 17 != 0

这个错是因为以前的文件系统挪到现在新环境中,并且多加了一台storage ,两边一直报这个错,这段时间上传文件两个storage不能同步,我猜想可能是两个storage之间正在校对文件,20分钟后日志也不报错了,文件也正常同步了

以前都是在测试机器上安装fastdfs,这次是正式服务器安装,并且还需要把旧文件放在新环境上中间遇到了比较多的问题

时间: 2024-08-25 23:21:22

Fastdfs 安装的相关文章

fastdfs安装,配置

一:fastdfs安装 1.需要装备的包  fastdfs5.10  libevent-2.0.18-stable.tar  libfastcommon-master 2.先安装libfastcommon-master unzip libfastcommon-master.zip cd libfastcommon-master ./make.sh ./make.sh install libfastcommon 默认安装到了/usr/lib64/libfastcommon.so/usr/lib64

Centos6.5 -- fastdfs安装(虚拟机搭建集群)

一.操作系统概述 电脑型号     X64 兼容 台式电脑  (扫描时间:2016年11月14日) 操作系统     Windows 7 旗舰版 64位 SP1 ( DirectX 11 ) 处理器  英特尔 Core i7-6700K @ 4.00GHz 四核 主板      华硕 B150M-A/M.2 ( 英特尔 Skylake-S - 100 Series/C230 Series 芯片组 Family - A148 ) 内存      16 GB ( Avexir DDR4 2400MH

FastDFS安装与部署

(一)下载依赖库libevent(不管解压在哪里必须安装在/usr目录下,否则FastDFS找不到) wget https://github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz tar zvxf libevent-1.4.14b-stable.tar.gz ./configure --prefix=/usr make clean; make make install (二)下载FastDFS安装包及ngin

FastDFS安装、配置、部署(一)

摘要: FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 声明:对于分布式的一些技术点在网上都可以查到,这边对于一些基本的操作做了些相关的总结,并作为分布式框架技术的支持文档,希望可以帮助到大家 FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点

FastDFS安装使用实战三(使用篇)

经过前面的安装.配置.启动,马上就可以看到FastDFS的效果了,我们先上传一个文件,然后再通过http下载. 相关阅读: FastDFS安装使用实战一(安装篇) http://www.linuxidc.com/Linux/2012-01/52112.htm FastDFS安装使用实战二(配置篇) http://www.linuxidc.com/Linux/2012-01/52113.htm 一.上传文件 FastDFS安装包中,自带了客户端程序,通过程序可以进行文件上传.在使用这个客户端程序之

FastDFS安装、配置、API使用(一)-安装和部署

FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 FastDFS有两个角色:跟踪服务(tracker)和存储服务(storage),跟踪服务控制,调度文件以负载均衡的方式访问:存储服务包括:文件存储,文件同步,提供文件访问接口,同时以key value的方式管理文件的元数据 跟踪和存储服务可以由1台或者多台服务器组成,同时可以动态的添加,删除跟踪和存储服务

FastDFS安装配置手册

FastDFS安装配置手册 目录 FastDFS安装配置手册... 1 一.         安装... 3 (一)       下载FastDFS安装包... 3 (二)       安装tracker. 3 1.      安装... 3 2.      配置... 5 3.      运行... 5 (三)       安装storage. 6 1.      安装... 6 2.      配置... 8 3.      运行... 8 (四)       在storage上安装ngin

FastDFS安装扩展篇——安装PHP、Apache及Nginx的FastDFS扩展【所有fastdfs文档】

FastDFS安装扩展篇——安装PHP.Apache及Nginx的FastDFS扩展 公司项目准备用fastdfs开始我就不知道这个是什么意思的,忙活了一个星期才大致明白,然后配置加使用,所有的东西都是从不懂到懂,前提是你要勇敢的面对他.东西就是让人用的,一个星期不会用,花费一个月的时间,只要刻苦钻研,一定会战胜的! 关于linux下如何安装FastDFS请参考:http://www.icultivator.com/p/4843.html 一.安装配置FastDFS支持PHP FastDFS不是

FastDFS安装使用实战一 (安装篇)

最近在研究负载均衡和集群,其中涉及到一个主要问题是,如何让集群中的real server共享一套文件系统.在网上查到FastDFS,国人(happy fish,感谢他的开源精神)开发的一套轻量级分布式文件系统.实际搭建了一下,感觉还不错,小巧易用,支持http下载. 虽然FastDFS官方网站 上已经有比较详细的按照使用手册,但在实际搭建过程中,还是遇到了很多问题,希望我的记录可以让后来的同学们少走一些弯路:) 下面进入正题. FastDFS安装使用实战(安装篇) Keywords:FastDF

FastDFS安装使用实战二(配置篇)

FastDFS安装使用实战二(配置篇) Keywords:FastDFS.分布式文件系统.Ubuntu Author:soartju 转载请注明出处:http://soartju.iteye.com/blog/803524 FastDFS的配置文件在%FastDFS%/conf目录下,其中包括 Client.conf    客户端上传配置文件 Storage.conf    文件存储服务器配置文件 Tracker.conf    负责均衡调度服务器配置文件 http.conf        ht