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 ...
随机推荐
- linux下如何启动nginx?
命令: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ........... [root@localhost sbin ...
- ORA-28000: the account is locked
1.用system账号登录 2.执行一下sql: ALTER USER username ACCOUNT UNLOCK; 此处username 可能为scott或者你要解锁的用户名. ........ ...
- 170315、spring:@Autowired等注解的别样玩法
适用场景: 1.IOC容器完成启动就想加载进来的数据 2.多个已经定义好的组件,想在使用的时候通过一行代码就全部拿到 3.等等.... 联想:@Autowired.@Resources等也可以类似使用 ...
- json序列化懒加载问题
如果框架使用了json序列化对象,当配置了hibernate懒加载时,可能会抛出异常,或者出现N+1的问题,或者出现无限循环的问题.网上很多解决方案, 基本是这些:@JsonIgnore忽略可能出问题 ...
- Jquery 中 .trigger 的用法
项目中有个需求,数据加载完成后,默认模拟点击某个元素节点(选中某个元素节点)并触发事件 $('.course_list dd').on('click', function () { //取当前 ...
- BSSID,SSID,ESSID区别
SSID(Service Set Identifier) SSID,AP唯一的ID码,许多人认为可以将SSID写成ESSID,其实不然,SSID是个笼统的概念,包含了ESSID和BSSID,用来区 ...
- Enables DNS lookups on client IP addresses
w虚拟域名访问,路由可以到达,但无输出. http://httpd.apache.org/docs/2.2/mod/core.html#hostnamelookups
- 如何在 windows 配置 libtorch c++ 前端库?
如何在 windows 配置 libtorch c++ 前端库? 下载 pytorch 已经编译好的库: 此库不带 gpu,主要方便演示.支持 win7 win10 系统. 下载地址:https:// ...
- Ubutun使用记录——语系错误(转)
add by zhj: 对原文有修改,原文是在创建用户时出现的问题,而我是在使用psql时出现的, 但问题是相同的. 原文:http://www.douban.com/note/362250557/ ...
- 网络编程(基于udp协议的套接字/socketserver模块/进程简介)
一.基于UDP协议的套接字 TCP是建立可靠连接,并且通信双方都可以以流的形式发送数据.相对TCP,UDP则是面向无连接的协议. 使用UDP协议时,不需要建立连接,只需要知道对方的IP地址和端口号,就 ...