fastdfs安装与配置
FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等
192.168.12.22(tracker)操作
unzip libfastcommon-master.zip
cd libfastcommon-master
./make.sh
./make.sh install
tar zxvf FastDFS_v5.07.tar.gz
cd FastDFS
./make.sh
./make.sh install
cd /cacti/FastDFS/conf
mkdir -p /home/yuqing/fastdfs
ln -s /cacti/FastDFS/conf/tracker.conf /etc/fdfs/
egrep -v "#" /etc/fdfs/tracker.conf
disabled=false
bind_addr=
port=22122
connect_timeout=30
network_timeout=60
base_path=/fastdfs
max_connections=256
accept_threads=1
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=
run_by_user=
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
trunk_compress_binlog_min_interval = 0
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
log_file_keep_days = 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
/etc/init.d/fdfs_trackerd start
------------以上操作在另一台服务器上操作--192.168.12.25(storaged)-------------------------------
ln -s /cacti/FastDFS/conf/storage.conf /etc/fdfs/
vi storage.conf
tracker_server=192.168.12.22:22122(改成你tracker服务器的ip)
egrep -v "#" /etc/fdfs/storage.conf
disabled=false
group_name=group1
bind_addr=
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/fastdfs
max_connections=256
buff_size = 256KB
accept_threads=1
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=/fastdfs
subdir_count_per_path=256
tracker_server=192.168.12.22:22122
log_level=info
run_by_group=
run_by_user=
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
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888
/etc/init.d/fdfs_storaged start
测试上传12.22操作
ln -s /cacti/FastDFS/conf/client.conf /etc/fdfs/
egrep -v "#" /etc/fdfs/client.conf
connect_timeout=30
network_timeout=60
base_path=/home/yuqing/fastdfs
tracker_server=192.168.12.22:22122
log_level=info
use_connection_pool = false
connection_pool_max_idle_time = 3600
load_fdfs_parameters_from_tracker=false
use_storage_id = false
storage_ids_filename = storage_ids.conf
http.tracker_server_port=80
/usr/bin/fdfs_test /etc/fdfs/client.conf upload test.jpg
This is FastDFS client test program v5.07
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-12-05 22:46:22] DEBUG - base_path=/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.12.25, port=23000
group_name=group1, ip_addr=192.168.12.25, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgMGVZi-L6AAOW6AAAFSmF9eMc904.jpg
source ip address: 192.168.12.25
file timestamp=2015-12-05 22:46:22
file size=1354
file crc32=1635612871
example file url: http://192.168.12.25/group1/M00/00/00/wKgMGVZi-L6AAOW6AAAFSmF9eMc904.jpg
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgMGVZi-L6AAOW6AAAFSmF9eMc904_big.jpg
source ip address: 192.168.12.25
file timestamp=2015-12-05 22:46:22
file size=1354
file crc32=1635612871
example file url: http://192.168.12.25/group1/M00/00/00/wKgMGVZi-L6AAOW6AAAFSmF9eMc904_big.jpg
查看原图
ls /fastdfs/data/00/00
wKgMGVZi9umANr4BAAAFSmF9eMc486.jpg wKgMGVZi-L6AAOW6AAAFSmF9eMc904.jpg
wKgMGVZi-L6AAOW6AAAFSmF9eMc904_big.jpg wKgMGVZi-L6AAOW6AAAFSmF9eMc904.jpg-m
wKgMGVZi-L6AAOW6AAAFSmF9eMc904_big.jpg-m
fastdfs命令
#上传文件:/usr/bin/fdfs_upload_file <config_file> <local_filename>
#下载文件:/usr/bin/fdfs_download_file <config_file> <file_id> [local_filename]
#删除文件:/usr/bin/fdfs_delete_file <config_file> <file_id>
推荐的FastDFS部署方案
文件上传和删除等操作:使用FastDFS client API,目前提供了C、PHP extension和Java的client API
文件下载采用HTTP方式:使用nginx或者apache扩展模块,不推荐使用FastDFS内置的web server
不要做RAID,直接挂载单盘,每个硬盘作为一个mount point
最大并发连接数设置
参数名:max_connections
缺省值:256
说明:FastDFS采用预先分配好buffer队列的做法,分配的内存大小为: max_connections * buff_size,因此配置的连接数越大,消耗的内存越多。不建议配置得过大,以避免无谓的内存开销
工作线程数设置
参数名: work_threads
缺省值:4
说明:为了避免CPU上下文切换的开销,以及不必要的资源消耗,不建议将本参数设置得过大。为了发挥出多个CPU的效能,系统中的线程数总和,应等于CPU总数。
对于tracker server,公式为:
work_threads + 1 = CPU数
对于storage,公式为:
work_threads + 1 + (disk_reader_threads + disk_writer_threads) * store_path_count = CPU数
storage目录数设置
参数名:subdir_count_per_path
缺省值:256
说明:FastDFS采用二级目录的做法,目录会在FastDFS初始化时自动创建。存储海量小文件,打开了trunk存储方式的情况下,建议将本参数适当改小,比如设置为32,此时存放文件的目录数为 32 * 32 = 1024。假如trunk文件大小采用缺省值64MB,磁盘空间为2TB,那么每个目录下存放的trunk文件数均值为:2TB / (1024 * 64MB) = 32个
storage磁盘读写线程设置
disk_rw_separated:磁盘读写是否分离
disk_reader_threads:单个磁盘读线程数
disk_writer_threads:单个磁盘写线程数
如果磁盘读写混合,单个磁盘读写线程数为读线程数和写线程数之后
对于单盘挂载方式,磁盘读写线程分别设置为1即可
如果磁盘做了RAID,那么需要酌情加大读写线程数,这样才能最大程度地发挥磁盘性能
storage同步延迟相关设置
sync_binlog_buff_interval:将binlog buffer写入磁盘的时间间隔,取值大于0,缺省值为60s
sync_wait_msec:如果没有需要同步的文件,对binlog进行轮询的时间间隔,取值大于0,缺省值为100ms
sync_interval:同步完一个文件后,休眠的毫秒数,缺省值为0
为了缩短文件同步时间,可以将上述3个参数适当调小即可
fastdfs安装与配置的更多相关文章
- FastDFS安装、配置、部署(一)-安装和部署 (转)
FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 Fast ...
- FastDFS安装、配置、部署
FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站. Fas ...
- 分布式文件系统FastDFS安装与配置(单机)
安装包如下:fastdfs-nginx-module_v1.16.tar.gzFastDFS_v5.05.tar.gzlibfastcommon-master.zipnginx-1.8.0.tar.g ...
- FastDFS安装和配置,整合Nginx-1.13.3
目录: 一:下载FastDFS 二:安装FastDFS 三:配置 四:整合Nginx和FastDFS FastDFS is an open source high performance distr ...
- django-文件上传和下载--fastDFS安装和配置
5.1 安装fastdfs依赖包 一:下载安装FDFS依赖: libfastcommon 下载地址:https://codeload.github.com/happyfish100/libfastco ...
- FastDFS安装、配置、部署(三)-Storage配置具体解释
1.基本配置 # is this config file disabled # false for enabled # true for disabled disabled=false # the n ...
- [转]Centos7 fastdfs/nginx 安装与配置
https://blog.csdn.net/alex_bean/article/details/78625131 参考文章 分布式文件系统-FastDFS 使用FastDFS搭建图片服务器单实例篇 C ...
- FastDFS安装配置
FastDFS FastDFS为互联网量身定制,充分考虑了冗余备份.负载均衡.线性扩容等机制,并注重高可用.高性能等指标,使用FastDFS很容易搭建一套高性能的文件服务器集群提供文件上传.下载等服务 ...
- FastDFS安装配置手册
文件服务器分布式系统安装手册 本文档详细的介绍了FastDFS的最小集群安装过程.集群环境如下: tracker:20.2.64.133 .用于调度工作,在访问上起负载均衡的作用. group1: s ...
随机推荐
- java中的最重要的 集合框架
java.util这个重要的包包含大量的类和接口,支持很多的功能.例如,java.util具有能产生伪随机数的类,还包括可以管理日期和时间.观察事件.操作位集合.标记字符串.处理格式化数据等的类.ja ...
- 日期选择时两个日期之间的动态控制--My97datepicker日期选择控件
实现效果:如果先选离店日期,再选入住日期的话,入住日期大于离店日期则离店日期+1天否则离店日期不变,先选入店再选离店离店,离店只能选之后的日期,且两个日期之间最多间隔88天 <div class ...
- js 操作对象的引用和操作实际对象的区分
JavaScript高级程序设计-第3版-中 有这么一段话: 在操作对象时,实际上是在操作对象的引用而不是实际的对象.为此,引用类型的值是按引用访问的①. ① 这种说法不严密,当复制保存着对象的某个变 ...
- quartz启动Quartz : org.quartz.SchedulerConfigException: Thread count must be > 0
检查quartz.properties数据源配置是否正常
- nexus配置第三方库文件
进入nexus管理界面 默认用户名密码:admin/admin123 在左侧Views/Repositories中选择Repositories,然后在右侧的面板中选择3rd party,在下方arti ...
- 160601、Websocet服务端实现
今天是六一儿童节,祝愿小朋友们节日快乐!大朋友们事事顺心! Websocet服务端实现 WebSocketConfig.Java ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
- Unknown type name 'UIColor" 的问题
遇到如下的问题 平时都没太注意创建UIViewController的时候Xcode给你引入的类库,所以解决方法是: 在.h里 #import <UIKit/UIKit.h> 解决问题!
- 反编译apk + eclipse中调试smali
1.对apk使用apktool反编译出可调试的smali代码到out文件夹 apktool -d d 定点加粉丝_com.mingniu.wxddjfs_440.apk -o out 这里必须使用-d ...
- Android studio 使用技巧和问题
最近更新Android studio版本到1.2.1.1后 出现了一些问题,首先一个就是创建一个项目后,布局文件会提示 找不到类. 网上找了下答案,原来是这个版本的bug. 其实解决起来很简单,找到 ...
- python自然语言处理——学习笔记:Chapter3纠错
2017-12-06更新:很多代码执行结果与书中不一致,是因为python的版本不一致.如果发现有问题,可以参考英文版: http://www.nltk.org/book/ 第三章,P87有一段处理h ...