




已阅读5页,还剩41页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
北京冠新医卫软件科技有限公司FastDFSUser Guide变更历史版本修改内容修订日期修订人审核人V1.0.02015-11-30崔悦民I目录FastDFS User Guide- 1 -1软件准备- 1 -1.1系统环境- 1 -1.2主要软件- 1 -1.3编译环境- 1 -2架构预览- 2 -2.1架构图- 2 -3安装配置- 2 -3.1安装环境- 2 -3.1.1安装编译环境- 2 -3.2安装依赖库- 3 -3.2.1安装libfastcommon- 3 -3.2.2配置libfastcommon- 4 -3.3安装FastDFS- 4 -3.3.1编译fastdfs- 4 -3.3.2安装fastdfs- 5 -3.4配置- 5 -3.4.1tracker- 5 -3.4.2storage- 16 -4集成Nginx服务- 28 -4.1安装fastdfs-nginx-module模块- 28 -4.1.1说明- 28 -4.1.2解压- 29 -4.1.3配置文件- 29 -4.2安装Nginx- 35 -4.2.1安装依赖- 35 -4.2.2安装- 35 -4.2.3拷贝配置文件http.conf和mime.types- 36 -4.2.4建立软链接- 36 -4.2.5配置Nginx- 36 -4.3启动nginx- 42 -附录:- 42 -1 软件准备1.1 系统环境Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-32-generic x86_64)软件环境1.2 主要软件FastDFS V5.05/happyfish100/fastdfslibfastcommon V1.0.18/happyfish100/libfastcommonfastdfs-nginx-module V1.16/happyfish100/fastdfs-nginx-modulehttp:/osdn.jp/projects/sfnet_fastdfs/releases/nginx V1.9.3/nginx/nginx//1.3 编译环境需要安装必要的编译工具。安装gcc 和 build-essential,执行以下命令:apt-get install gcc apt-get install build-essential2 架构预览2.1 架构图3 安装配置3.1 安装环境3.1.1 安装编译环境 安装gccapt-get install gcc 安装build-essentialapt-get install build-essential3.2 安装依赖库3.2.1 安装libfastcommon解压软件包:将压缩文件放在自定义的目录中,这里放在/home/FastDFS/packages/目录中,新建software目录:mkdir -p /software/解压文件:unzip /home/FastDFS/packages/libfastcommon-master.zip -d /software/进入libfastcommon目录,编译:cd /software/libfastcommon-master./make.sh 显示如下图:安装:./make.sh install显示如下图:进入/usr/lib64目录,查看有libfastcommon.so文件,安装成功。如下图:3.2.2 配置libfastcommonFastDFS主程序设置的lib目录是:/usr/local/lib所以应该创建软链接到这里,执行下面的命令:ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.soln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.soln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.soln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so3.3 安装FastDFS在所有的tracker和storage服务器上都要安装FastDFS。3.3.1 编译fastdfs解压软件包到/software/目录下面:tar -zxvf FastDFS_v5.05.tar.gz -C /software/进入/software/FastDFS目录,执行编译命令:cd /software/FastDFS./make.sh 3.3.2 安装fastdfs进入/software/FastDFS目录,执行安装命令:cd /software/FastDFS./make.sh install显示如下图,安装成功。3.4 配置3.4.1 tracker 配置tracker对所有的tracker服务器,进行如下配置:进入配置目录:该目录下有配置样本,首先复制一份来配置:cp tracker.conf.sample tracker.conf修改配置文件tracker.conf,下面是修改的结果(修改部分高亮+注释):# is this config file disabled# false for enabled# true for disableddisabled=false# bind an address of this host# empty for bind all addresses of this hostbind_addr=# the tracker server portport=22122# connect timeout in seconds# default value is 30sconnect_timeout=30# network timeout in seconds# default value is 30snetwork_timeout=60# the base path to store data and log files# 设置存放元数据和日志的目录,应根据实际情况修改需预先创建。base_path=/home/fastdfs_files/tracker# max concurrent connections this server supportedmax_connections=256# accept thread count# default value is 1# since V4.07accept_threads=1# work thread count, should = max_connections# default value is 4# since V2.00work_threads=4# the method of selecting group to upload files# 0: round robin# 1: specify group# 2: load balance, select the max free space group to upload filestore_lookup=2# which group to upload file# when store_lookup set to 1, must set store_group to the group namestore_group=group2# which storage server to upload file# 0: round robin (default)# 1: the first server order by ip address# 2: the first server order by priority (the minimal)store_server=0# which path(means disk or mount point) of the storage server to upload file# 0: round robin# 2: load balance, select the max free space path to upload filestore_path=0# which storage server to download file# 0: round robin (default)# 1: the source storage server which the current file uploaded todownload_server=0# reserved storage space for system or other applications.# if the free(available) space of any stoarge server in # a group = 64KB# default value is 64KBthread_stack_size = 64KB# auto adjust when the ip address of the storage server changed# default value is truestorage_ip_changed_auto_adjust = true# storage sync file max delay seconds# default value is 86400 seconds (one day)# since V2.00storage_sync_file_max_delay = 86400# the max time of storage sync a file# default value is 300 seconds# since V2.00storage_sync_file_max_time = 300# if use a trunk file to store several small files# default value is false# since V3.00use_trunk_file = false # the min slot size, should slot_min_size# store the upload file to trunk file when its size = 4MB# default value is 64MB# since V3.00trunk_file_size = 64MB# if create trunk file advancely# default value is false# since V3.06trunk_create_file_advance = false# the time base to create trunk file# the time format: HH:MM# default value is 02:00# since V3.06trunk_create_file_time_base = 02:00# the interval of create trunk file, unit: second# default value is 38400 (one day)# since V3.06trunk_create_file_interval = 86400# the threshold to create trunk file# when the free trunk file size less than the threshold, will create # the trunk files# default value is 0# since V3.06trunk_create_file_space_threshold = 20G# if check trunk space occupying when loading trunk free spaces# the occupied spaces will be ignored# default value is false# since V3.09# NOTICE: set this parameter to true will slow the loading of trunk spaces # when startup. you should set this parameter to true when neccessary.trunk_init_check_occupying = false# if ignore storage_trunk.dat, reload from trunk binlog# default value is false# since V3.10# set to true once for version upgrade when your version less than V3.10trunk_init_reload_from_binlog = false# the min interval for compressing the trunk binlog file# unit: second# default value is 0, 0 means never compress# FastDFS compress the trunk binlog when trunk init and trunk destroy# recommand to set this parameter to 86400 (one day)# since V5.01trunk_compress_binlog_min_interval = 0# if use storage ID instead of IP address# default value is false# since V4.00use_storage_id = false# specify storage ids filename, can use relative or absolute path# since V4.00storage_ids_filename = storage_ids.conf# id type of the storage server in the filename, values are:# ip: the ip address of the storage server# id: the server id of the storage server# this paramter is valid only when use_storage_id set to true# default value is ip# since V4.03id_type_in_filename = ip# if store slave file use symbol link# default value is false# since V4.01store_slave_file_use_link = false# if rotate the error log every day# default value is false# since V4.02rotate_error_log = false# rotate error log time base, time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 59# default value is 00:00# since V4.02error_log_rotate_time=00:00# rotate error log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is 0# since V4.02rotate_error_log_size = 0# keep days of the log files# 0 means do not delete old log files# default value is 0log_file_keep_days = 0# if use connection pool# default value is false# since V4.05use_connection_pool = false# connections whose the idle time exceeds this time will be closed# unit: second# default value is 3600# since V4.05connection_pool_max_idle_time = 3600# HTTP port on this tracker serverhttp.server_port=8080# check storage HTTP server alive interval seconds# = 0 for never check# default value is 30http.check_alive_interval=30# check storage HTTP server alive type, values are:# tcp : connect to the storge server with HTTP port only, # do not request and get response# http: storage check alive url must return http status 200# default value is tcphttp.check_alive_type=tcp# check storage HTTP server alive uri/url# NOTE: storage embed HTTP server support uri: /status.htmlhttp.check_alive_uri=/status.html然后创建与配置文件相应的存放文件夹:mkdir -p /home/fastdfs_files/tracker 启动tracker启动:fdfs_trackerd /etc/fdfs/tracker.conf start查看相应进程:netstat -ntlp |grep 221 查看日志-trackerbase_path=/home/FastDFS/files/trackercat $base_path/logs/trackerd.log 开机启动-trackervi /etc/rc.local在exit 0 所在行之前的行添加如下命令,如下图所示:/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf start3.4.2 storage 配置storage对所有的storage服务器作如下配置:cd /etc/fdfs/cp storage.conf.sample storage.confvi storage.conf修改配置文件storage.conf,下面是修改的结果(修改部分高亮+注释):# is this config file disabled# false for enabled# true for disableddisabled=false# the name of the group this storage server belongs to# comment or remove this item for fetching from tracker server,# in this case, use_storage_id must set to true in tracker.conf,# and storage_ids.conf must be configed correctly.# 本storage服务器对应的组名,需要根据实际情况配置group_name=group1# bind an address of this host# empty for bind all addresses of this hostbind_addr=# if bind an address of this host when connect to other servers # (this storage server as a client)# true for binding the address configed by above parameter: bind_addr# false for binding any address of this hostclient_bind=true# the storage server port# 当前storage服务器的端口port=23000# connect timeout in seconds# default value is 30sconnect_timeout=30# network timeout in seconds# default value is 30snetwork_timeout=60# heart beat interval in secondsheart_beat_interval=30# disk usage report interval in secondsstat_report_interval=60# the base path to store data and log files# 当前storage服务器存放元数据和日志文件的目录base_path=/home/fastdfs_files/storage# max concurrent connections the server supported# default value is 256# more max_connections means more memory will be usedmax_connections=256# the buff size to recv / send data# this parameter must more than 8KB# default value is 64KB# since V2.00buff_size = 256KB# accept thread count# default value is 1# since V4.07accept_threads=1# work thread count, should 0, default value is 200mssync_wait_msec=50# after sync a file, usleep milliseconds# 0 for sync successively (never call usleep)sync_interval=0# storage sync start time of a day, time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 59sync_start_time=00:00# storage sync end time of a day, time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 59sync_end_time=23:59# write to the mark file after sync N files# default value is 500write_mark_file_freq=500# path(disk or mount point) count, default value is 1store_path_count=1# store_path#, based 0, if store_path0 not exists, its value is base_path# the paths must be exist# 当前storage服务器存放数据的目录# 这个目录需要预先创建store_path0=/home/fastdfs_files/storage_data#store_path1=/home/yuqing/fastdfs2# subdir_count * subdir_count directories will be auto created under each # store_path (disk), value can be 1 to 256, default value is 256subdir_count_per_path=256# tracker_server can ocur more than once, and tracker_server format is# host:port, host can be hostname or ip address# 集群中的tracker服务器的地址和端口号# 一般需要配置多个tracker_server=0:22122tracker_server=1:22122#standard log level as syslog, case insensitive, value list:# emerg for emergency# alert# crit for critical# error# warn for warning# notice# info# debuglog_level=info#unix group name to run this program, #not set (empty) means run by the group of current userrun_by_group=#unix username to run this program,#not set (empty) means run by current userrun_by_user=# allow_hosts can ocur more than once, host can be hostname or ip address,# * means match all ip addresses, can use range like this: -15,20 or# host01-08,20-25., for example:# allow_hosts=-15,20# allow_hosts=host01-08,20-25.allow_hosts=*# the mode of the files distributed to the data path# 0: round robin(default)# 1: random, distributted by hash codefile_distribute_path_mode=0# valid when file_distribute_to_path is set to 0 (round robin), # when the written file count reaches this number, then rotate to next path# default value is 100file_distribute_rotate_count=100# call fsync to disk when write big file# 0: never call fsync# other: call fsync when written bytes = this bytes# default value is 0 (never call fsync)fsync_after_written_bytes=0# sync log buff to disk every interval seconds# must 0, default value is 10 secondssync_log_buff_interval=10# sync binlog buff / cache to disk every interval seconds# default value is 60 secondssync_binlog_buff_interval=10# sync storage stat info to disk every interval seconds# default value is 300 secondssync_stat_file_interval=300# thread stack size, should = 512KB# default value is 512KBthread_stack_size=512KB# the priority as a source server for uploading file.# the lower this value, the higher its uploading priority.# default value is 10upload_priority=10# the NIC alias prefix, such as eth in Linux, you can see it by ifconfig -a# multi aliases split by comma. empty value means auto set by OS type# default values is emptyif_alias_prefix=# if check file duplicate, when set to true, use FastDHT to store file indexes# 1 or yes: need check# 0 or no: do not check# default value is 0check_file_duplicate=0# file signature method for check file duplicate# hash: four 32 bits hash code# md5: MD5 signature# default value is hash# since V4.01file_signature_method=hash# namespace for storing file indexes (key-value pairs)# this item must be set when check_file_duplicate is true / onkey_namespace=FastDFS# set keep_alive to 1 to enable persistent connection with FastDHT servers# default value is 0 (short connection)keep_alive=0# you can use #include filename (not include double quotes) directive to # load FastDHT server list, when the filename is a relative path such as # pure filename, the base path is the base path of current/this config file.# must set FastDHT server list when check_file_duplicate is true / on# please see INSTALL of FastDHT for detail#include /home/yuqing/fastdht/conf/fdht_servers.conf# if log to access log# default value is false# since V4.00use_access_log = false# if rotate the access log every day# default value is false# since V4.00rotate_access_log = false# rotate access log time base, time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 59# default value is 00:00# since V4.00access_log_rotate_time=00:00# if rotate the error log every day# default value is false# since V4.02rotate_error_log = false# rotate error log time base, time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 59# default value is 00:00# since V4.02error_log_rotate_time=00:00# rotate access log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is 0# since V4.02rotate_access_l
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025西医内科学考试题及答案
- 2024年高级营销师推销技巧知识试题(附含答案)
- 2025电工证考试题库及模拟考试答案低压电工考试题库高压电工考试题库
- 摩托安全知识培训
- 江西省上饶市2024-2025学年八年级下学期期末语文试题(解析版)
- 无损检测技术试题及答案
- 2025汽车买卖合同有效形式与范本
- 2025汽车销售合同范本 汽车销售合同
- 2025劳动合同范例
- 2025年福建省茶叶种植基地预约生产购销合同
- 工程材料设备构配件报审表
- 广西壮族自治区柳州市2024年七年级上学期期末数学试题【附答案】
- 手术室护士骨科手术
- 卫生院医患沟通制度
- 2024年茶叶加工工(中级)职业鉴定理论考试题库(含答案)
- 2024届黑龙江省高三押题卷(四)语文试题(解析版)
- YBT 189-2014 连铸保护渣水分含量(110℃)测定试验方法
- 地铁车站的类型课件讲解
- 石膏深加工产品项目可行性研究报告(年产2万吨α石膏粉及20万吨高性能β石膏粉生产线项目)
- 国家级测试员主讲《普通话培训(2小时精简版)》精美课件
- 板底加钢梁加固方案
评论
0/150
提交评论