fastdfs-v6.0.8\v6.0.9 docker构建镜像和安装手册
Signed-off-by: liyanjing <919927181@qq.com>pull/585/head
parent
e6fcd3ecdd
commit
296df8c5fe
|
|
@ -0,0 +1,22 @@
|
||||||
|
# FastDFS Dockerfile local (本地包构建)
|
||||||
|
|
||||||
|
感谢余大的杰作!
|
||||||
|
|
||||||
|
本目录包含了docker构建镜像,集群安装帮助手册
|
||||||
|
|
||||||
|
1、目录结构
|
||||||
|
./build_image-v6.0.9 fastdfs-v6.0.9版本的构建docker镜像
|
||||||
|
|
||||||
|
./fastdfs-conf 配置文件,其实和build_image_v.x下的文件是相同的。
|
||||||
|
|--setting_conf.sh 设置配置文件的脚本
|
||||||
|
|
||||||
|
./自定义镜像和安装手册.txt
|
||||||
|
|
||||||
|
./qa.txt 来自于bbs论坛的问题整理:http://bbs.chinaunix.net/forum-240-1.html
|
||||||
|
|
||||||
|
|
||||||
|
2、fastdfs 版本安装变化
|
||||||
|
|
||||||
|
+ v6.0.9 依赖libevent、libfastcommon和libserverframe, v6.0.8及以下依赖libevent和libfastcommon两个库,其中libfastcommon是 FastDFS 自身提供的。
|
||||||
|
|
||||||
|
+ v6.0.9 适配fastdfs-nginx-module-1.23(及以上版本),v6.0.8及以下是fastdfs-nginx-module-1.22
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
# 选择系统镜像作为基础镜像,可以使用超小的Linux镜像alpine
|
||||||
|
#FROM centos:7
|
||||||
|
FROM alpine:3.12
|
||||||
|
|
||||||
|
LABEL MAINTAINER liyanjing 284223249@qq.com
|
||||||
|
|
||||||
|
# 0.安装包位置,fdfs的基本目录和存储目录
|
||||||
|
ENV INSTALL_PATH=/usr/local/src \
|
||||||
|
LIBFASTCOMMON_VERSION="1.0.57" \
|
||||||
|
FASTDFS_VERSION="6.08" \
|
||||||
|
FASTDFS_NGINX_MODULE_VERSION="1.22" \
|
||||||
|
NGINX_VERSION="1.22.0" \
|
||||||
|
TENGINE_VERSION="2.3.3"
|
||||||
|
|
||||||
|
# 0.change the system source for installing libs
|
||||||
|
RUN echo "http://mirrors.aliyun.com/alpine/v3.12/main" > /etc/apk/repositories \
|
||||||
|
&& echo "http://mirrors.aliyun.com/alpine/v3.12/community" >> /etc/apk/repositories
|
||||||
|
|
||||||
|
# 1.复制安装包
|
||||||
|
ADD soft ${INSTALL_PATH}
|
||||||
|
|
||||||
|
# 2.环境安装
|
||||||
|
# - 创建fdfs的存储目录
|
||||||
|
# - 安装依赖
|
||||||
|
# - 安装libfastcommon
|
||||||
|
# - 安装fastdfs
|
||||||
|
# - 安装nginx,设置nginx和fastdfs联合环境,并配置nginx
|
||||||
|
#Run yum -y install -y gcc gcc-c++ libevent libevent-devel make automake autoconf libtool perl pcre pcre-devel zlib zlib-devel openssl openssl-devel zip unzip net-tools wget vim lsof \
|
||||||
|
RUN apk update && apk add --no-cache --virtual .build-deps bash autoconf gcc libc-dev make pcre-dev zlib-dev linux-headers gnupg libxslt-dev gd-dev geoip-dev wget \
|
||||||
|
&& cd ${INSTALL_PATH} \
|
||||||
|
&& tar -zxf libfastcommon-${LIBFASTCOMMON_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf fastdfs-${FASTDFS_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf fastdfs-nginx-module-${FASTDFS_NGINX_MODULE_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf nginx-${NGINX_VERSION}.tar.gz \
|
||||||
|
\
|
||||||
|
&& cd ${INSTALL_PATH}/libfastcommon-${LIBFASTCOMMON_VERSION}/ \
|
||||||
|
&& ./make.sh \
|
||||||
|
&& ./make.sh install \
|
||||||
|
&& cd ${INSTALL_PATH}/fastdfs-${FASTDFS_VERSION}/ \
|
||||||
|
&& ./make.sh \
|
||||||
|
&& ./make.sh install \
|
||||||
|
\
|
||||||
|
&& cd ${INSTALL_PATH}/nginx-${NGINX_VERSION}/ \
|
||||||
|
&& ./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-stream=dynamic \
|
||||||
|
--add-module=${INSTALL_PATH}/fastdfs-nginx-module-${FASTDFS_NGINX_MODULE_VERSION}/src/ \
|
||||||
|
&& make \
|
||||||
|
&& make install \
|
||||||
|
\
|
||||||
|
&& rm -rf ${INSTALL_PATH}/* \
|
||||||
|
&& apk del .build-deps gcc libc-dev make linux-headers gnupg libxslt-dev gd-dev geoip-dev wget
|
||||||
|
|
||||||
|
# 3.添加配置文件,目标路径以/结尾,docker会把它当作目录,不存在时,会自动创建
|
||||||
|
COPY conf/*.* /etc/fdfs/
|
||||||
|
COPY nginx_conf/nginx.conf /usr/local/nginx/conf/
|
||||||
|
COPY nginx_conf.d/*.conf /usr/local/nginx/conf.d/
|
||||||
|
COPY start.sh /
|
||||||
|
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
# 4.更改启动脚本执行权限,设置时区为中国时间
|
||||||
|
RUN chmod u+x /start.sh \
|
||||||
|
&& apk add --no-cache bash pcre-dev zlib-dev \
|
||||||
|
\
|
||||||
|
&& apk add -U tzdata \
|
||||||
|
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
|
||||||
|
&& apk del tzdata && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
EXPOSE 22122 23000 9088
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# 镜像启动
|
||||||
|
ENTRYPOINT ["/bin/bash","/start.sh"]
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.0.196:22122
|
||||||
|
tracker_server = 192.168.0.197:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = false
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V4.05
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker = false
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V4.05
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
|
||||||
|
#HTTP settings
|
||||||
|
http.tracker_server_port = 80
|
||||||
|
|
||||||
|
#use "#include" directive to include HTTP other settiongs
|
||||||
|
##include http.conf
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
# HTTP default content type
|
||||||
|
http.default_content_type = application/octet-stream
|
||||||
|
|
||||||
|
# MIME types mapping filename
|
||||||
|
# MIME types file format: MIME_type extensions
|
||||||
|
# such as: image/jpeg jpeg jpg jpe
|
||||||
|
# you can use apache's MIME file: mime.types
|
||||||
|
http.mime_types_filename = mime.types
|
||||||
|
|
||||||
|
# if use token to anti-steal
|
||||||
|
# default value is false (0)
|
||||||
|
http.anti_steal.check_token = false
|
||||||
|
|
||||||
|
# token TTL (time to live), seconds
|
||||||
|
# default value is 600
|
||||||
|
http.anti_steal.token_ttl = 900
|
||||||
|
|
||||||
|
# secret key to generate anti-steal token
|
||||||
|
# this parameter must be set when http.anti_steal.check_token set to true
|
||||||
|
# the length of the secret key should not exceed 128 bytes
|
||||||
|
http.anti_steal.secret_key = FastDFS1234567890
|
||||||
|
|
||||||
|
# return the content of the file when check token fail
|
||||||
|
# default value is empty (no file sepecified)
|
||||||
|
http.anti_steal.token_check_fail = /home/yuqing/fastdfs/conf/anti-steal.jpg
|
||||||
|
|
||||||
|
# if support multi regions for HTTP Range
|
||||||
|
# default value is true
|
||||||
|
http.multi_range.enabed = true
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,137 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
connect_timeout=15
|
||||||
|
|
||||||
|
# network recv and send timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout=30
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path=/data/fastdfs_data
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V1.12
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker=true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.12
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V1.13
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.13
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
# FastDFS tracker_server can ocur more than once, and tracker_server format is
|
||||||
|
# "host:port", host can be hostname or ip address
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is true
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
# the port of the local storage server
|
||||||
|
# the default value is 23000
|
||||||
|
storage_server_port=23000
|
||||||
|
|
||||||
|
# the group name of the local storage server
|
||||||
|
group_name=group1
|
||||||
|
|
||||||
|
# if the url / uri including the group name
|
||||||
|
# set to false when uri like /M00/00/00/xxx
|
||||||
|
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
|
||||||
|
# default value is false
|
||||||
|
url_have_group_name = true
|
||||||
|
|
||||||
|
# path(disk or mount point) count, default value is 1
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path_count=1
|
||||||
|
|
||||||
|
# store_path#, based 0, if store_path0 not exists, it's value is base_path
|
||||||
|
# the paths must be exist
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path0=/data/fastdfs/upload/path0
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level=info
|
||||||
|
|
||||||
|
# set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
|
||||||
|
# empty for output to stderr (apache and nginx error_log file)
|
||||||
|
log_filename=
|
||||||
|
|
||||||
|
# response mode when the file not exist in the local file system
|
||||||
|
## proxy: get the content from other storage server, then send to client
|
||||||
|
## redirect: redirect to the original storage server (HTTP Header is Location)
|
||||||
|
response_mode=proxy
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# this paramter used to get all ip address of the local host
|
||||||
|
# default values is empty
|
||||||
|
if_alias_prefix=
|
||||||
|
|
||||||
|
# use "#include" directive to include HTTP config file
|
||||||
|
# NOTE: #include is an include directive, do NOT remove the # before include
|
||||||
|
#include http.conf
|
||||||
|
|
||||||
|
|
||||||
|
# if support flv
|
||||||
|
# default value is false
|
||||||
|
# since v1.15
|
||||||
|
flv_support = true
|
||||||
|
|
||||||
|
# flv file extension name
|
||||||
|
# default value is flv
|
||||||
|
# since v1.15
|
||||||
|
flv_extension = flv
|
||||||
|
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组。单组为0.
|
||||||
|
## 一台服务器没有必要运行多个group的storage,因为stroage本身支持多存储目录的
|
||||||
|
# set the group count
|
||||||
|
# set to none zero to support multi-group on this storage server
|
||||||
|
# set to 0 for single group only
|
||||||
|
# groups settings section as [group1], [group2], ..., [groupN]
|
||||||
|
# default value is 0
|
||||||
|
# since v1.14
|
||||||
|
group_count = 0
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组
|
||||||
|
# group settings for group #1
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group on this storage server, uncomment following section
|
||||||
|
#[group1]
|
||||||
|
#group_name=group1
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=2
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# group settings for group #2
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group, uncomment following section as neccessary
|
||||||
|
#[group2]
|
||||||
|
#group_name=group2
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=1
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = 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 configured correctly.
|
||||||
|
group_name = group1
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# if bind an address of this host when connect to other servers
|
||||||
|
# (this storage server as a client)
|
||||||
|
# true for binding the address configured by the above parameter: "bind_addr"
|
||||||
|
# false for binding any address of this host
|
||||||
|
client_bind = true
|
||||||
|
|
||||||
|
# the storage server port
|
||||||
|
port = 23000
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the heart beat interval in seconds
|
||||||
|
# the storage server send heartbeat to tracker server periodically
|
||||||
|
# default value is 30
|
||||||
|
heart_beat_interval = 30
|
||||||
|
|
||||||
|
# disk usage report interval in seconds
|
||||||
|
# the storage server send disk usage report to tracker server periodically
|
||||||
|
# default value is 300
|
||||||
|
stat_report_interval = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
# NOTE: the binlog files maybe are large, make sure
|
||||||
|
# the base path has enough disk space,
|
||||||
|
# eg. the disk free space should > 50GB
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections the server supported,
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# the buff size to recv / send data from/to network
|
||||||
|
# this parameter must more than 8KB
|
||||||
|
# 256KB or 512KB is recommended
|
||||||
|
# default value is 64KB
|
||||||
|
# since V2.00
|
||||||
|
buff_size = 256KB
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# if disk read / write separated
|
||||||
|
## false for mixed read and write
|
||||||
|
## true for separated read and write
|
||||||
|
# default value is true
|
||||||
|
# since V2.00
|
||||||
|
disk_rw_separated = true
|
||||||
|
|
||||||
|
# disk reader thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_reader_threads = 1
|
||||||
|
|
||||||
|
# disk writer thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_writer_threads = 1
|
||||||
|
|
||||||
|
# when no entry to sync, try read binlog again after X milliseconds
|
||||||
|
# must > 0, default value is 200ms
|
||||||
|
sync_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 59
|
||||||
|
sync_start_time = 00:00
|
||||||
|
|
||||||
|
# storage sync end time of a day, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
sync_end_time = 23:59
|
||||||
|
|
||||||
|
# write to the mark file after sync N files
|
||||||
|
# default value is 500
|
||||||
|
write_mark_file_freq = 500
|
||||||
|
|
||||||
|
# disk recovery thread count
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
disk_recovery_threads = 3
|
||||||
|
|
||||||
|
# store path (disk or mount point) count, default value is 1
|
||||||
|
store_path_count = 1
|
||||||
|
|
||||||
|
# store_path#, based on 0, to configure the store paths to store files
|
||||||
|
# if store_path0 not exists, it's value is base_path (NOT recommended)
|
||||||
|
# the paths must be exist.
|
||||||
|
#
|
||||||
|
# IMPORTANT NOTE:
|
||||||
|
# the store paths' order is very important, don't mess up!!!
|
||||||
|
# the base_path should be independent (different) of the store paths
|
||||||
|
|
||||||
|
store_path0 = /data/fastdfs/upload/path0
|
||||||
|
#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 256
|
||||||
|
subdir_count_per_path = 256
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group =
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# the mode of the files distributed to the data path
|
||||||
|
# 0: round robin(default)
|
||||||
|
# 1: random, distributted by hash code
|
||||||
|
file_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.
|
||||||
|
# rotate to the first path (00/00) after the last path (such as FF/FF).
|
||||||
|
# default value is 100
|
||||||
|
file_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 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# sync binlog buff / cache to disk every interval seconds
|
||||||
|
# default value is 60 seconds
|
||||||
|
sync_binlog_buff_interval = 1
|
||||||
|
|
||||||
|
# sync storage stat info to disk every interval seconds
|
||||||
|
# default value is 300 seconds
|
||||||
|
sync_stat_file_interval = 300
|
||||||
|
|
||||||
|
# thread stack size, should >= 512KB
|
||||||
|
# default value is 512KB
|
||||||
|
thread_stack_size = 512KB
|
||||||
|
|
||||||
|
# the priority as a source server for uploading file.
|
||||||
|
# the lower this value, the higher its uploading priority.
|
||||||
|
# default value is 10
|
||||||
|
upload_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 empty
|
||||||
|
if_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 0
|
||||||
|
check_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.01
|
||||||
|
file_signature_method = hash
|
||||||
|
|
||||||
|
# namespace for storing file indexes (key-value pairs)
|
||||||
|
# this item must be set when check_file_duplicate is true / on
|
||||||
|
key_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.00
|
||||||
|
use_access_log = false
|
||||||
|
|
||||||
|
# if rotate the access log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
rotate_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.00
|
||||||
|
access_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old access log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_access_log = false
|
||||||
|
|
||||||
|
# compress the access log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_access_log_days_before = 7
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_access_log_size = 0
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if skip the invalid record when sync file
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
file_sync_skip_invalid_record = false
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if compress the binlog files by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog = true
|
||||||
|
|
||||||
|
# try to compress binlog time, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 01:30
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog_time = 01:30
|
||||||
|
|
||||||
|
# if check the mark of store path to prevent confusion
|
||||||
|
# recommend to set this parameter to true
|
||||||
|
# if two storage servers (instances) MUST use a same store path for
|
||||||
|
# some specific purposes, you should set this parameter to false
|
||||||
|
# default value is true
|
||||||
|
# since V6.03
|
||||||
|
check_store_path_mark = true
|
||||||
|
|
||||||
|
# use the ip address of this storage server if domain_name is empty,
|
||||||
|
# else this domain name will ocur in the url redirected by the tracker server
|
||||||
|
http.domain_name =
|
||||||
|
|
||||||
|
# the port of the web server on this storage server
|
||||||
|
http.server_port = 8888
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# <id> <group_name> <ip_or_hostname[:port]>
|
||||||
|
#
|
||||||
|
# id is a natural number (1, 2, 3 etc.),
|
||||||
|
# 6 bits of the id length is enough, such as 100001
|
||||||
|
#
|
||||||
|
# storage ip or hostname can be dual IPs seperated by comma,
|
||||||
|
# one is an inner (intranet) IP and another is an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs
|
||||||
|
# for example: 192.168.2.100,122.244.141.46
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21
|
||||||
|
#
|
||||||
|
# the port is optional. if you run more than one storaged instances
|
||||||
|
# in a server, you must specified the port to distinguish different instances.
|
||||||
|
|
||||||
|
#100001 group1 192.168.0.196
|
||||||
|
#100002 group1 192.168.0.197
|
||||||
|
|
@ -0,0 +1,329 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = false
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# the tracker server port
|
||||||
|
port = 22122
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections this server support
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# the min network buff size
|
||||||
|
# default value 8KB
|
||||||
|
min_buff_size = 8KB
|
||||||
|
|
||||||
|
# the max network buff size
|
||||||
|
# default value 128KB
|
||||||
|
max_buff_size = 128KB
|
||||||
|
|
||||||
|
# the method for selecting group to upload files
|
||||||
|
# 0: round robin
|
||||||
|
# 1: specify group
|
||||||
|
# 2: load balance, select the max free space group to upload file
|
||||||
|
store_lookup = 2
|
||||||
|
|
||||||
|
# which group to upload file
|
||||||
|
# when store_lookup set to 1, must set store_group to the group name
|
||||||
|
store_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)
|
||||||
|
# Note: if use_trunk_file set to true, must set store_server to 1 or 2
|
||||||
|
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 file
|
||||||
|
store_path = 0
|
||||||
|
|
||||||
|
# which storage server to download file
|
||||||
|
# 0: round robin (default)
|
||||||
|
# 1: the source storage server which the current file uploaded to
|
||||||
|
download_server = 0
|
||||||
|
|
||||||
|
# reserved storage space for system or other applications.
|
||||||
|
# if the free(available) space of any stoarge server in
|
||||||
|
# a group <= reserved_storage_space, no file can be uploaded to this group.
|
||||||
|
# bytes unit can be one of follows:
|
||||||
|
### G or g for gigabyte(GB)
|
||||||
|
### M or m for megabyte(MB)
|
||||||
|
### K or k for kilobyte(KB)
|
||||||
|
### no unit for byte(B)
|
||||||
|
### XX.XX% as ratio such as: reserved_storage_space = 10%
|
||||||
|
reserved_storage_space = 20%
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group=
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# sync log buff to disk every interval seconds
|
||||||
|
# default value is 10 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# check storage server alive interval seconds
|
||||||
|
check_active_interval = 120
|
||||||
|
|
||||||
|
# thread stack size, should >= 64KB
|
||||||
|
# default value is 256KB
|
||||||
|
thread_stack_size = 256KB
|
||||||
|
|
||||||
|
# auto adjust when the ip address of the storage server changed
|
||||||
|
# default value is true
|
||||||
|
storage_ip_changed_auto_adjust = true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# the max time of storage sync a file
|
||||||
|
# default value is 300 seconds
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_time = 300
|
||||||
|
|
||||||
|
# if use a trunk file to store several small files
|
||||||
|
# default value is false
|
||||||
|
# since V3.00
|
||||||
|
use_trunk_file = false
|
||||||
|
|
||||||
|
# the min slot size, should <= 4KB
|
||||||
|
# default value is 256 bytes
|
||||||
|
# since V3.00
|
||||||
|
slot_min_size = 256
|
||||||
|
|
||||||
|
# the max slot size, should > slot_min_size
|
||||||
|
# store the upload file to trunk file when it's size <= this value
|
||||||
|
# default value is 16MB
|
||||||
|
# since V3.00
|
||||||
|
slot_max_size = 1MB
|
||||||
|
|
||||||
|
# the alignment size to allocate the trunk space
|
||||||
|
# default value is 0 (never align)
|
||||||
|
# since V6.05
|
||||||
|
# NOTE: the larger the alignment size, the less likely of disk
|
||||||
|
# fragmentation, but the more space is wasted.
|
||||||
|
trunk_alloc_alignment_size = 256
|
||||||
|
|
||||||
|
# if merge contiguous free spaces of trunk file
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
trunk_free_space_merge = true
|
||||||
|
|
||||||
|
# if delete / reclaim the unused trunk files
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
delete_unused_trunk_files = false
|
||||||
|
|
||||||
|
# the trunk file size, should >= 4MB
|
||||||
|
# default value is 64MB
|
||||||
|
# since V3.00
|
||||||
|
trunk_file_size = 64MB
|
||||||
|
|
||||||
|
# if create trunk file advancely
|
||||||
|
# default value is false
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_advance = false
|
||||||
|
|
||||||
|
# the time base to create trunk file
|
||||||
|
# the time format: HH:MM
|
||||||
|
# default value is 02:00
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_time_base = 02:00
|
||||||
|
|
||||||
|
# the interval of create trunk file, unit: second
|
||||||
|
# default value is 38400 (one day)
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_interval = 86400
|
||||||
|
|
||||||
|
# the threshold to create trunk file
|
||||||
|
# when the free trunk file size less than the threshold,
|
||||||
|
# will create he trunk files
|
||||||
|
# default value is 0
|
||||||
|
# since V3.06
|
||||||
|
trunk_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.10
|
||||||
|
trunk_init_reload_from_binlog = false
|
||||||
|
|
||||||
|
# the min interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# FastDFS compress the trunk binlog when trunk init and trunk destroy
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V5.01
|
||||||
|
trunk_compress_binlog_min_interval = 86400
|
||||||
|
|
||||||
|
# the interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_interval = 86400
|
||||||
|
|
||||||
|
# compress the trunk binlog time base, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 03:00
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_time_base = 03:00
|
||||||
|
|
||||||
|
# max backups for the trunk binlog file
|
||||||
|
# default value is 0 (never backup)
|
||||||
|
# since V6.05
|
||||||
|
trunk_binlog_max_backups = 7
|
||||||
|
|
||||||
|
# if use storage server ID instead of IP address
|
||||||
|
# if you want to use dual IPs for storage server, you MUST set
|
||||||
|
# this parameter to true, and configure the dual IPs in the file
|
||||||
|
# configured by following item "storage_ids_filename", such as storage_ids.conf
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# this parameter is valid only when use_storage_id set to true
|
||||||
|
# since V4.00
|
||||||
|
storage_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.03
|
||||||
|
id_type_in_filename = id
|
||||||
|
|
||||||
|
# if store slave file use symbol link
|
||||||
|
# default value is false
|
||||||
|
# since V4.01
|
||||||
|
store_slave_file_use_link = false
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# HTTP port on this tracker server
|
||||||
|
http.server_port = 8080
|
||||||
|
|
||||||
|
# check storage HTTP server alive interval seconds
|
||||||
|
# <= 0 for never check
|
||||||
|
# default value is 30
|
||||||
|
http.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 tcp
|
||||||
|
http.check_alive_type = tcp
|
||||||
|
|
||||||
|
# check storage HTTP server alive uri/url
|
||||||
|
# NOTE: storage embed HTTP server support uri: /status.html
|
||||||
|
http.check_alive_uri = /status.html
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
worker_processes 1;
|
||||||
|
worker_rlimit_nofile 65535; #务必先修改服务器的max open files 数。
|
||||||
|
|
||||||
|
error_log /data/fastdfs_data/logs/nginx-error.log;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll; #服务器若是Linux 2.6+,你应该使用epoll。
|
||||||
|
worker_connections 65535;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /data/fastdfs_data/logs/nginx-access.log main;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 2k;
|
||||||
|
gzip_buffers 8 32k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_comp_level 2;
|
||||||
|
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
include /usr/local/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# fastdfs 配置文件,我设置的存储路径,需要提前创建
|
||||||
|
FASTDFS_BASE_PATH=/data/fastdfs_data \
|
||||||
|
FASTDFS_STORE_PATH=/data/fastdfs/upload \
|
||||||
|
|
||||||
|
# 启用参数
|
||||||
|
# - tracker : 启动tracker_server 服务
|
||||||
|
# - storage : 启动storage 服务
|
||||||
|
start_parameter=$1
|
||||||
|
|
||||||
|
if [ ! -d "$FASTDFS_BASE_PATH" ]; then
|
||||||
|
mkdir -p ${FASTDFS_BASE_PATH};
|
||||||
|
fi
|
||||||
|
|
||||||
|
function start_tracker(){
|
||||||
|
|
||||||
|
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
|
||||||
|
tail -f /data/fastdfs_data/logs/trackerd.log
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_storage(){
|
||||||
|
if [ ! -d "$FASTDFS_STORE_PATH" ]; then
|
||||||
|
mkdir -p ${FASTDFS_STORE_PATH}/{path0,path1,path2,path3};
|
||||||
|
fi
|
||||||
|
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf;
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# nginx日志存储目录为/data/fastdfs_data/logs/,手动创建一下,防止storage启动慢,还没有来得及创建logs目录
|
||||||
|
if [ ! -d "$FASTDFS_BASE_PATH/logs" ]; then
|
||||||
|
mkdir -p ${FASTDFS_BASE_PATH}/logs;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/local/nginx/sbin/nginx;
|
||||||
|
tail -f /data/fastdfs_data/logs/storaged.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run (){
|
||||||
|
|
||||||
|
case ${start_parameter} in
|
||||||
|
tracker)
|
||||||
|
echo "启动tracker"
|
||||||
|
start_tracker
|
||||||
|
;;
|
||||||
|
storage)
|
||||||
|
echo "启动storage"
|
||||||
|
start_storage
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "请指定要启动哪个服务,tracker还是storage(二选一),传参为tracker | storage"
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
run
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
# 选择系统镜像作为基础镜像,可以使用超小的Linux镜像alpine
|
||||||
|
#FROM centos:7
|
||||||
|
FROM alpine:3.16
|
||||||
|
|
||||||
|
LABEL MAINTAINER liyanjing 284223249@qq.com
|
||||||
|
|
||||||
|
# 注意
|
||||||
|
# v6.0.9 依赖libfastcommon和libserverframe, v6.0.8及以下依赖libevent和libfastcommon两个库,其中libfastcommon是 FastDFS 官方提供的
|
||||||
|
# v6.0.9 适配fastdfs-nginx-module-1.23,v6.0.8及以下是fastdfs-nginx-module-1.22
|
||||||
|
|
||||||
|
# 0.安装包位置,fdfs的基本目录和存储目录
|
||||||
|
ENV INSTALL_PATH=/usr/local/src \
|
||||||
|
LIBFASTCOMMON_VERSION="1.0.60" \
|
||||||
|
LIBSERVERFRAME_VERSION="1.1.19" \
|
||||||
|
FASTDFS_VERSION="V6.09" \
|
||||||
|
FASTDFS_NGINX_MODULE_VERSION="1.23" \
|
||||||
|
NGINX_VERSION="1.22.0" \
|
||||||
|
TENGINE_VERSION="2.3.3"
|
||||||
|
|
||||||
|
# 0.change the system source for installing libs
|
||||||
|
RUN echo "http://mirrors.aliyun.com/alpine/v3.16/main" > /etc/apk/repositories \
|
||||||
|
&& echo "http://mirrors.aliyun.com/alpine/v3.16/community" >> /etc/apk/repositories
|
||||||
|
|
||||||
|
# 1.复制安装包
|
||||||
|
ADD soft ${INSTALL_PATH}
|
||||||
|
|
||||||
|
# 2.环境安装
|
||||||
|
# - 创建fdfs的存储目录
|
||||||
|
# - 安装依赖
|
||||||
|
# - 安装libfastcommon
|
||||||
|
# - 安装fastdfs
|
||||||
|
# - 安装nginx,设置nginx和fastdfs联合环境
|
||||||
|
#Run yum -y install -y gcc gcc-c++ libevent libevent-devel make automake autoconf libtool perl pcre pcre-devel zlib zlib-devel openssl openssl-devel zip unzip net-tools wget vim lsof \
|
||||||
|
RUN apk update && apk add --no-cache --virtual .build-deps bash autoconf gcc libc-dev make pcre-dev zlib-dev linux-headers gnupg libxslt-dev gd-dev geoip-dev wget \
|
||||||
|
&& cd ${INSTALL_PATH} \
|
||||||
|
&& tar -zxf libfastcommon-${LIBFASTCOMMON_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf libserverframe-${LIBSERVERFRAME_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf fastdfs-${FASTDFS_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf fastdfs-nginx-module-${FASTDFS_NGINX_MODULE_VERSION}.tar.gz \
|
||||||
|
&& tar -zxf nginx-${NGINX_VERSION}.tar.gz \
|
||||||
|
\
|
||||||
|
&& cd ${INSTALL_PATH}/libfastcommon-${LIBFASTCOMMON_VERSION}/ \
|
||||||
|
&& ./make.sh \
|
||||||
|
&& ./make.sh install \
|
||||||
|
&& cd ${INSTALL_PATH}/libserverframe-${LIBSERVERFRAME_VERSION}/ \
|
||||||
|
&& ./make.sh \
|
||||||
|
&& ./make.sh install \
|
||||||
|
&& cd ${INSTALL_PATH}/fastdfs-${FASTDFS_VERSION}/ \
|
||||||
|
&& ./make.sh \
|
||||||
|
&& ./make.sh install \
|
||||||
|
\
|
||||||
|
&& cd ${INSTALL_PATH}/nginx-${NGINX_VERSION}/ \
|
||||||
|
&& ./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-stream=dynamic \
|
||||||
|
--add-module=${INSTALL_PATH}/fastdfs-nginx-module-${FASTDFS_NGINX_MODULE_VERSION}/src/ \
|
||||||
|
&& make \
|
||||||
|
&& make install \
|
||||||
|
\
|
||||||
|
&& rm -rf ${INSTALL_PATH}/* \
|
||||||
|
&& apk del .build-deps gcc libc-dev make linux-headers gnupg libxslt-dev gd-dev geoip-dev wget
|
||||||
|
|
||||||
|
# 3.添加配置文件,目标路径以/结尾,docker会把它当作目录,不存在时,会自动创建
|
||||||
|
COPY conf/*.* /etc/fdfs/
|
||||||
|
COPY nginx_conf/nginx.conf /usr/local/nginx/conf/
|
||||||
|
COPY nginx_conf.d/*.conf /usr/local/nginx/conf.d/
|
||||||
|
COPY start.sh /
|
||||||
|
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
# 4.更改启动脚本执行权限,设置时区为中国时间
|
||||||
|
RUN chmod u+x /start.sh \
|
||||||
|
&& apk add --no-cache bash pcre-dev zlib-dev \
|
||||||
|
\
|
||||||
|
&& apk add -U tzdata \
|
||||||
|
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
|
||||||
|
&& apk del tzdata && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
EXPOSE 22122 23000 9088
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# 镜像启动
|
||||||
|
ENTRYPOINT ["/bin/bash","/start.sh"]
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -0,0 +1,71 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.0.196:22122
|
||||||
|
tracker_server = 192.168.0.197:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = false
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V4.05
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker = false
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V4.05
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
|
||||||
|
#HTTP settings
|
||||||
|
http.tracker_server_port = 80
|
||||||
|
|
||||||
|
#use "#include" directive to include HTTP other settiongs
|
||||||
|
##include http.conf
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
# HTTP default content type
|
||||||
|
http.default_content_type = application/octet-stream
|
||||||
|
|
||||||
|
# MIME types mapping filename
|
||||||
|
# MIME types file format: MIME_type extensions
|
||||||
|
# such as: image/jpeg jpeg jpg jpe
|
||||||
|
# you can use apache's MIME file: mime.types
|
||||||
|
http.mime_types_filename = mime.types
|
||||||
|
|
||||||
|
# if use token to anti-steal
|
||||||
|
# default value is false (0)
|
||||||
|
http.anti_steal.check_token = false
|
||||||
|
|
||||||
|
# token TTL (time to live), seconds
|
||||||
|
# default value is 600
|
||||||
|
http.anti_steal.token_ttl = 900
|
||||||
|
|
||||||
|
# secret key to generate anti-steal token
|
||||||
|
# this parameter must be set when http.anti_steal.check_token set to true
|
||||||
|
# the length of the secret key should not exceed 128 bytes
|
||||||
|
http.anti_steal.secret_key = FastDFS1234567890
|
||||||
|
|
||||||
|
# return the content of the file when check token fail
|
||||||
|
# default value is empty (no file sepecified)
|
||||||
|
http.anti_steal.token_check_fail = /home/yuqing/fastdfs/conf/anti-steal.jpg
|
||||||
|
|
||||||
|
# if support multi regions for HTTP Range
|
||||||
|
# default value is true
|
||||||
|
http.multi_range.enabed = true
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,137 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
connect_timeout=15
|
||||||
|
|
||||||
|
# network recv and send timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout=30
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path=/data/fastdfs_data
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V1.12
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker=true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.12
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V1.13
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.13
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
# FastDFS tracker_server can ocur more than once, and tracker_server format is
|
||||||
|
# "host:port", host can be hostname or ip address
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is true
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
# the port of the local storage server
|
||||||
|
# the default value is 23000
|
||||||
|
storage_server_port=23000
|
||||||
|
|
||||||
|
# the group name of the local storage server
|
||||||
|
group_name=group1
|
||||||
|
|
||||||
|
# if the url / uri including the group name
|
||||||
|
# set to false when uri like /M00/00/00/xxx
|
||||||
|
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
|
||||||
|
# default value is false
|
||||||
|
url_have_group_name = true
|
||||||
|
|
||||||
|
# path(disk or mount point) count, default value is 1
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path_count=1
|
||||||
|
|
||||||
|
# store_path#, based 0, if store_path0 not exists, it's value is base_path
|
||||||
|
# the paths must be exist
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path0=/data/fastdfs/upload/path0
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level=info
|
||||||
|
|
||||||
|
# set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
|
||||||
|
# empty for output to stderr (apache and nginx error_log file)
|
||||||
|
log_filename=
|
||||||
|
|
||||||
|
# response mode when the file not exist in the local file system
|
||||||
|
## proxy: get the content from other storage server, then send to client
|
||||||
|
## redirect: redirect to the original storage server (HTTP Header is Location)
|
||||||
|
response_mode=proxy
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# this paramter used to get all ip address of the local host
|
||||||
|
# default values is empty
|
||||||
|
if_alias_prefix=
|
||||||
|
|
||||||
|
# use "#include" directive to include HTTP config file
|
||||||
|
# NOTE: #include is an include directive, do NOT remove the # before include
|
||||||
|
#include http.conf
|
||||||
|
|
||||||
|
|
||||||
|
# if support flv
|
||||||
|
# default value is false
|
||||||
|
# since v1.15
|
||||||
|
flv_support = true
|
||||||
|
|
||||||
|
# flv file extension name
|
||||||
|
# default value is flv
|
||||||
|
# since v1.15
|
||||||
|
flv_extension = flv
|
||||||
|
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组。单组为0.
|
||||||
|
## 一台服务器没有必要运行多个group的storage,因为stroage本身支持多存储目录的
|
||||||
|
# set the group count
|
||||||
|
# set to none zero to support multi-group on this storage server
|
||||||
|
# set to 0 for single group only
|
||||||
|
# groups settings section as [group1], [group2], ..., [groupN]
|
||||||
|
# default value is 0
|
||||||
|
# since v1.14
|
||||||
|
group_count = 0
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组
|
||||||
|
# group settings for group #1
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group on this storage server, uncomment following section
|
||||||
|
#[group1]
|
||||||
|
#group_name=group1
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=2
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# group settings for group #2
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group, uncomment following section as neccessary
|
||||||
|
#[group2]
|
||||||
|
#group_name=group2
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=1
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = 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 configured correctly.
|
||||||
|
group_name = group1
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# if bind an address of this host when connect to other servers
|
||||||
|
# (this storage server as a client)
|
||||||
|
# true for binding the address configured by the above parameter: "bind_addr"
|
||||||
|
# false for binding any address of this host
|
||||||
|
client_bind = true
|
||||||
|
|
||||||
|
# the storage server port
|
||||||
|
port = 23000
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the heart beat interval in seconds
|
||||||
|
# the storage server send heartbeat to tracker server periodically
|
||||||
|
# default value is 30
|
||||||
|
heart_beat_interval = 30
|
||||||
|
|
||||||
|
# disk usage report interval in seconds
|
||||||
|
# the storage server send disk usage report to tracker server periodically
|
||||||
|
# default value is 300
|
||||||
|
stat_report_interval = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
# NOTE: the binlog files maybe are large, make sure
|
||||||
|
# the base path has enough disk space,
|
||||||
|
# eg. the disk free space should > 50GB
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections the server supported,
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# the buff size to recv / send data from/to network
|
||||||
|
# this parameter must more than 8KB
|
||||||
|
# 256KB or 512KB is recommended
|
||||||
|
# default value is 64KB
|
||||||
|
# since V2.00
|
||||||
|
buff_size = 256KB
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# if disk read / write separated
|
||||||
|
## false for mixed read and write
|
||||||
|
## true for separated read and write
|
||||||
|
# default value is true
|
||||||
|
# since V2.00
|
||||||
|
disk_rw_separated = true
|
||||||
|
|
||||||
|
# disk reader thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_reader_threads = 1
|
||||||
|
|
||||||
|
# disk writer thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_writer_threads = 1
|
||||||
|
|
||||||
|
# when no entry to sync, try read binlog again after X milliseconds
|
||||||
|
# must > 0, default value is 200ms
|
||||||
|
sync_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 59
|
||||||
|
sync_start_time = 00:00
|
||||||
|
|
||||||
|
# storage sync end time of a day, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
sync_end_time = 23:59
|
||||||
|
|
||||||
|
# write to the mark file after sync N files
|
||||||
|
# default value is 500
|
||||||
|
write_mark_file_freq = 500
|
||||||
|
|
||||||
|
# disk recovery thread count
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
disk_recovery_threads = 3
|
||||||
|
|
||||||
|
# store path (disk or mount point) count, default value is 1
|
||||||
|
store_path_count = 1
|
||||||
|
|
||||||
|
# store_path#, based on 0, to configure the store paths to store files
|
||||||
|
# if store_path0 not exists, it's value is base_path (NOT recommended)
|
||||||
|
# the paths must be exist.
|
||||||
|
#
|
||||||
|
# IMPORTANT NOTE:
|
||||||
|
# the store paths' order is very important, don't mess up!!!
|
||||||
|
# the base_path should be independent (different) of the store paths
|
||||||
|
|
||||||
|
store_path0 = /data/fastdfs/upload/path0
|
||||||
|
#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 256
|
||||||
|
subdir_count_per_path = 256
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group =
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# the mode of the files distributed to the data path
|
||||||
|
# 0: round robin(default)
|
||||||
|
# 1: random, distributted by hash code
|
||||||
|
file_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.
|
||||||
|
# rotate to the first path (00/00) after the last path (such as FF/FF).
|
||||||
|
# default value is 100
|
||||||
|
file_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 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# sync binlog buff / cache to disk every interval seconds
|
||||||
|
# default value is 60 seconds
|
||||||
|
sync_binlog_buff_interval = 1
|
||||||
|
|
||||||
|
# sync storage stat info to disk every interval seconds
|
||||||
|
# default value is 300 seconds
|
||||||
|
sync_stat_file_interval = 300
|
||||||
|
|
||||||
|
# thread stack size, should >= 512KB
|
||||||
|
# default value is 512KB
|
||||||
|
thread_stack_size = 512KB
|
||||||
|
|
||||||
|
# the priority as a source server for uploading file.
|
||||||
|
# the lower this value, the higher its uploading priority.
|
||||||
|
# default value is 10
|
||||||
|
upload_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 empty
|
||||||
|
if_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 0
|
||||||
|
check_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.01
|
||||||
|
file_signature_method = hash
|
||||||
|
|
||||||
|
# namespace for storing file indexes (key-value pairs)
|
||||||
|
# this item must be set when check_file_duplicate is true / on
|
||||||
|
key_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.00
|
||||||
|
use_access_log = false
|
||||||
|
|
||||||
|
# if rotate the access log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
rotate_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.00
|
||||||
|
access_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old access log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_access_log = false
|
||||||
|
|
||||||
|
# compress the access log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_access_log_days_before = 7
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_access_log_size = 0
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if skip the invalid record when sync file
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
file_sync_skip_invalid_record = false
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if compress the binlog files by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog = true
|
||||||
|
|
||||||
|
# try to compress binlog time, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 01:30
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog_time = 01:30
|
||||||
|
|
||||||
|
# if check the mark of store path to prevent confusion
|
||||||
|
# recommend to set this parameter to true
|
||||||
|
# if two storage servers (instances) MUST use a same store path for
|
||||||
|
# some specific purposes, you should set this parameter to false
|
||||||
|
# default value is true
|
||||||
|
# since V6.03
|
||||||
|
check_store_path_mark = true
|
||||||
|
|
||||||
|
# use the ip address of this storage server if domain_name is empty,
|
||||||
|
# else this domain name will ocur in the url redirected by the tracker server
|
||||||
|
http.domain_name =
|
||||||
|
|
||||||
|
# the port of the web server on this storage server
|
||||||
|
http.server_port = 8888
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# <id> <group_name> <ip_or_hostname[:port]>
|
||||||
|
#
|
||||||
|
# id is a natural number (1, 2, 3 etc.),
|
||||||
|
# 6 bits of the id length is enough, such as 100001
|
||||||
|
#
|
||||||
|
# storage ip or hostname can be dual IPs seperated by comma,
|
||||||
|
# one is an inner (intranet) IP and another is an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs
|
||||||
|
# for example: 192.168.2.100,122.244.141.46
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21
|
||||||
|
#
|
||||||
|
# the port is optional. if you run more than one storaged instances
|
||||||
|
# in a server, you must specified the port to distinguish different instances.
|
||||||
|
|
||||||
|
#100001 group1 192.168.0.196
|
||||||
|
#100002 group1 192.168.0.197
|
||||||
|
|
@ -0,0 +1,329 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = false
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# the tracker server port
|
||||||
|
port = 22122
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections this server support
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# the min network buff size
|
||||||
|
# default value 8KB
|
||||||
|
min_buff_size = 8KB
|
||||||
|
|
||||||
|
# the max network buff size
|
||||||
|
# default value 128KB
|
||||||
|
max_buff_size = 128KB
|
||||||
|
|
||||||
|
# the method for selecting group to upload files
|
||||||
|
# 0: round robin
|
||||||
|
# 1: specify group
|
||||||
|
# 2: load balance, select the max free space group to upload file
|
||||||
|
store_lookup = 2
|
||||||
|
|
||||||
|
# which group to upload file
|
||||||
|
# when store_lookup set to 1, must set store_group to the group name
|
||||||
|
store_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)
|
||||||
|
# Note: if use_trunk_file set to true, must set store_server to 1 or 2
|
||||||
|
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 file
|
||||||
|
store_path = 0
|
||||||
|
|
||||||
|
# which storage server to download file
|
||||||
|
# 0: round robin (default)
|
||||||
|
# 1: the source storage server which the current file uploaded to
|
||||||
|
download_server = 0
|
||||||
|
|
||||||
|
# reserved storage space for system or other applications.
|
||||||
|
# if the free(available) space of any stoarge server in
|
||||||
|
# a group <= reserved_storage_space, no file can be uploaded to this group.
|
||||||
|
# bytes unit can be one of follows:
|
||||||
|
### G or g for gigabyte(GB)
|
||||||
|
### M or m for megabyte(MB)
|
||||||
|
### K or k for kilobyte(KB)
|
||||||
|
### no unit for byte(B)
|
||||||
|
### XX.XX% as ratio such as: reserved_storage_space = 10%
|
||||||
|
reserved_storage_space = 20%
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group=
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# sync log buff to disk every interval seconds
|
||||||
|
# default value is 10 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# check storage server alive interval seconds
|
||||||
|
check_active_interval = 120
|
||||||
|
|
||||||
|
# thread stack size, should >= 64KB
|
||||||
|
# default value is 256KB
|
||||||
|
thread_stack_size = 256KB
|
||||||
|
|
||||||
|
# auto adjust when the ip address of the storage server changed
|
||||||
|
# default value is true
|
||||||
|
storage_ip_changed_auto_adjust = true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# the max time of storage sync a file
|
||||||
|
# default value is 300 seconds
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_time = 300
|
||||||
|
|
||||||
|
# if use a trunk file to store several small files
|
||||||
|
# default value is false
|
||||||
|
# since V3.00
|
||||||
|
use_trunk_file = false
|
||||||
|
|
||||||
|
# the min slot size, should <= 4KB
|
||||||
|
# default value is 256 bytes
|
||||||
|
# since V3.00
|
||||||
|
slot_min_size = 256
|
||||||
|
|
||||||
|
# the max slot size, should > slot_min_size
|
||||||
|
# store the upload file to trunk file when it's size <= this value
|
||||||
|
# default value is 16MB
|
||||||
|
# since V3.00
|
||||||
|
slot_max_size = 1MB
|
||||||
|
|
||||||
|
# the alignment size to allocate the trunk space
|
||||||
|
# default value is 0 (never align)
|
||||||
|
# since V6.05
|
||||||
|
# NOTE: the larger the alignment size, the less likely of disk
|
||||||
|
# fragmentation, but the more space is wasted.
|
||||||
|
trunk_alloc_alignment_size = 256
|
||||||
|
|
||||||
|
# if merge contiguous free spaces of trunk file
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
trunk_free_space_merge = true
|
||||||
|
|
||||||
|
# if delete / reclaim the unused trunk files
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
delete_unused_trunk_files = false
|
||||||
|
|
||||||
|
# the trunk file size, should >= 4MB
|
||||||
|
# default value is 64MB
|
||||||
|
# since V3.00
|
||||||
|
trunk_file_size = 64MB
|
||||||
|
|
||||||
|
# if create trunk file advancely
|
||||||
|
# default value is false
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_advance = false
|
||||||
|
|
||||||
|
# the time base to create trunk file
|
||||||
|
# the time format: HH:MM
|
||||||
|
# default value is 02:00
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_time_base = 02:00
|
||||||
|
|
||||||
|
# the interval of create trunk file, unit: second
|
||||||
|
# default value is 38400 (one day)
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_interval = 86400
|
||||||
|
|
||||||
|
# the threshold to create trunk file
|
||||||
|
# when the free trunk file size less than the threshold,
|
||||||
|
# will create he trunk files
|
||||||
|
# default value is 0
|
||||||
|
# since V3.06
|
||||||
|
trunk_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.10
|
||||||
|
trunk_init_reload_from_binlog = false
|
||||||
|
|
||||||
|
# the min interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# FastDFS compress the trunk binlog when trunk init and trunk destroy
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V5.01
|
||||||
|
trunk_compress_binlog_min_interval = 86400
|
||||||
|
|
||||||
|
# the interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_interval = 86400
|
||||||
|
|
||||||
|
# compress the trunk binlog time base, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 03:00
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_time_base = 03:00
|
||||||
|
|
||||||
|
# max backups for the trunk binlog file
|
||||||
|
# default value is 0 (never backup)
|
||||||
|
# since V6.05
|
||||||
|
trunk_binlog_max_backups = 7
|
||||||
|
|
||||||
|
# if use storage server ID instead of IP address
|
||||||
|
# if you want to use dual IPs for storage server, you MUST set
|
||||||
|
# this parameter to true, and configure the dual IPs in the file
|
||||||
|
# configured by following item "storage_ids_filename", such as storage_ids.conf
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# this parameter is valid only when use_storage_id set to true
|
||||||
|
# since V4.00
|
||||||
|
storage_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.03
|
||||||
|
id_type_in_filename = id
|
||||||
|
|
||||||
|
# if store slave file use symbol link
|
||||||
|
# default value is false
|
||||||
|
# since V4.01
|
||||||
|
store_slave_file_use_link = false
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# HTTP port on this tracker server
|
||||||
|
http.server_port = 8080
|
||||||
|
|
||||||
|
# check storage HTTP server alive interval seconds
|
||||||
|
# <= 0 for never check
|
||||||
|
# default value is 30
|
||||||
|
http.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 tcp
|
||||||
|
http.check_alive_type = tcp
|
||||||
|
|
||||||
|
# check storage HTTP server alive uri/url
|
||||||
|
# NOTE: storage embed HTTP server support uri: /status.html
|
||||||
|
http.check_alive_uri = /status.html
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
worker_processes 1;
|
||||||
|
worker_rlimit_nofile 65535; #务必先修改服务器的max open files 数。
|
||||||
|
|
||||||
|
error_log /data/fastdfs_data/logs/nginx-error.log;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll; #服务器若是Linux 2.6+,你应该使用epoll。
|
||||||
|
worker_connections 65535;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /data/fastdfs_data/logs/nginx-access.log main;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 2k;
|
||||||
|
gzip_buffers 8 32k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_comp_level 2;
|
||||||
|
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
include /usr/local/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# fastdfs 配置文件,我设置的存储路径,需要提前创建
|
||||||
|
FASTDFS_BASE_PATH=/data/fastdfs_data \
|
||||||
|
FASTDFS_STORE_PATH=/data/fastdfs/upload \
|
||||||
|
|
||||||
|
# 启用参数
|
||||||
|
# - tracker : 启动tracker_server 服务
|
||||||
|
# - storage : 启动storage 服务
|
||||||
|
start_parameter=$1
|
||||||
|
|
||||||
|
if [ ! -d "$FASTDFS_BASE_PATH" ]; then
|
||||||
|
mkdir -p ${FASTDFS_BASE_PATH};
|
||||||
|
fi
|
||||||
|
|
||||||
|
function start_tracker(){
|
||||||
|
|
||||||
|
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
|
||||||
|
tail -f /data/fastdfs_data/logs/trackerd.log
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_storage(){
|
||||||
|
if [ ! -d "$FASTDFS_STORE_PATH" ]; then
|
||||||
|
mkdir -p ${FASTDFS_STORE_PATH}/{path0,path1,path2,path3};
|
||||||
|
fi
|
||||||
|
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf;
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# nginx日志存储目录为/data/fastdfs_data/logs/,手动创建一下,防止storage启动慢,还没有来得及创建logs目录
|
||||||
|
if [ ! -d "$FASTDFS_BASE_PATH/logs" ]; then
|
||||||
|
mkdir -p ${FASTDFS_BASE_PATH}/logs;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/local/nginx/sbin/nginx;
|
||||||
|
tail -f /data/fastdfs_data/logs/storaged.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run (){
|
||||||
|
|
||||||
|
case ${start_parameter} in
|
||||||
|
tracker)
|
||||||
|
echo "启动tracker"
|
||||||
|
start_tracker
|
||||||
|
;;
|
||||||
|
storage)
|
||||||
|
echo "启动storage"
|
||||||
|
start_storage
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "请指定要启动哪个服务,tracker还是storage(二选一),传参为tracker | storage"
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
run
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -0,0 +1,71 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.0.196:22122
|
||||||
|
tracker_server = 192.168.0.197:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = false
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V4.05
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker = false
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V4.05
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
|
||||||
|
#HTTP settings
|
||||||
|
http.tracker_server_port = 80
|
||||||
|
|
||||||
|
#use "#include" directive to include HTTP other settiongs
|
||||||
|
##include http.conf
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
# HTTP default content type
|
||||||
|
http.default_content_type = application/octet-stream
|
||||||
|
|
||||||
|
# MIME types mapping filename
|
||||||
|
# MIME types file format: MIME_type extensions
|
||||||
|
# such as: image/jpeg jpeg jpg jpe
|
||||||
|
# you can use apache's MIME file: mime.types
|
||||||
|
http.mime_types_filename = mime.types
|
||||||
|
|
||||||
|
# if use token to anti-steal
|
||||||
|
# default value is false (0)
|
||||||
|
http.anti_steal.check_token = false
|
||||||
|
|
||||||
|
# token TTL (time to live), seconds
|
||||||
|
# default value is 600
|
||||||
|
http.anti_steal.token_ttl = 900
|
||||||
|
|
||||||
|
# secret key to generate anti-steal token
|
||||||
|
# this parameter must be set when http.anti_steal.check_token set to true
|
||||||
|
# the length of the secret key should not exceed 128 bytes
|
||||||
|
http.anti_steal.secret_key = FastDFS1234567890
|
||||||
|
|
||||||
|
# return the content of the file when check token fail
|
||||||
|
# default value is empty (no file sepecified)
|
||||||
|
http.anti_steal.token_check_fail = /home/yuqing/fastdfs/conf/anti-steal.jpg
|
||||||
|
|
||||||
|
# if support multi regions for HTTP Range
|
||||||
|
# default value is true
|
||||||
|
http.multi_range.enabed = true
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,137 @@
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
connect_timeout=15
|
||||||
|
|
||||||
|
# network recv and send timeout in seconds
|
||||||
|
# default value is 30s
|
||||||
|
network_timeout=30
|
||||||
|
|
||||||
|
# the base path to store log files
|
||||||
|
base_path=/data/fastdfs_data
|
||||||
|
|
||||||
|
# if load FastDFS parameters from tracker server
|
||||||
|
# since V1.12
|
||||||
|
# default value is false
|
||||||
|
load_fdfs_parameters_from_tracker=true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.12
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# if use storage ID instead of IP address
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# default value is false
|
||||||
|
# since V1.13
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# same as tracker.conf
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is false
|
||||||
|
# since V1.13
|
||||||
|
storage_ids_filename = storage_ids.conf
|
||||||
|
|
||||||
|
# FastDFS tracker_server can ocur more than once, and tracker_server format is
|
||||||
|
# "host:port", host can be hostname or ip address
|
||||||
|
# valid only when load_fdfs_parameters_from_tracker is true
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
# the port of the local storage server
|
||||||
|
# the default value is 23000
|
||||||
|
storage_server_port=23000
|
||||||
|
|
||||||
|
# the group name of the local storage server
|
||||||
|
group_name=group1
|
||||||
|
|
||||||
|
# if the url / uri including the group name
|
||||||
|
# set to false when uri like /M00/00/00/xxx
|
||||||
|
# set to true when uri like ${group_name}/M00/00/00/xxx, such as group1/M00/xxx
|
||||||
|
# default value is false
|
||||||
|
url_have_group_name = true
|
||||||
|
|
||||||
|
# path(disk or mount point) count, default value is 1
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path_count=1
|
||||||
|
|
||||||
|
# store_path#, based 0, if store_path0 not exists, it's value is base_path
|
||||||
|
# the paths must be exist
|
||||||
|
# must same as storage.conf
|
||||||
|
store_path0=/data/fastdfs/upload/path0
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level=info
|
||||||
|
|
||||||
|
# set the log filename, such as /usr/local/apache2/logs/mod_fastdfs.log
|
||||||
|
# empty for output to stderr (apache and nginx error_log file)
|
||||||
|
log_filename=
|
||||||
|
|
||||||
|
# response mode when the file not exist in the local file system
|
||||||
|
## proxy: get the content from other storage server, then send to client
|
||||||
|
## redirect: redirect to the original storage server (HTTP Header is Location)
|
||||||
|
response_mode=proxy
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# this paramter used to get all ip address of the local host
|
||||||
|
# default values is empty
|
||||||
|
if_alias_prefix=
|
||||||
|
|
||||||
|
# use "#include" directive to include HTTP config file
|
||||||
|
# NOTE: #include is an include directive, do NOT remove the # before include
|
||||||
|
#include http.conf
|
||||||
|
|
||||||
|
|
||||||
|
# if support flv
|
||||||
|
# default value is false
|
||||||
|
# since v1.15
|
||||||
|
flv_support = true
|
||||||
|
|
||||||
|
# flv file extension name
|
||||||
|
# default value is flv
|
||||||
|
# since v1.15
|
||||||
|
flv_extension = flv
|
||||||
|
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组。单组为0.
|
||||||
|
## 一台服务器没有必要运行多个group的storage,因为stroage本身支持多存储目录的
|
||||||
|
# set the group count
|
||||||
|
# set to none zero to support multi-group on this storage server
|
||||||
|
# set to 0 for single group only
|
||||||
|
# groups settings section as [group1], [group2], ..., [groupN]
|
||||||
|
# default value is 0
|
||||||
|
# since v1.14
|
||||||
|
group_count = 0
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组
|
||||||
|
# group settings for group #1
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group on this storage server, uncomment following section
|
||||||
|
#[group1]
|
||||||
|
#group_name=group1
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=2
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
#store_path1=/home/yuqing/fastdfs1
|
||||||
|
|
||||||
|
# group settings for group #2
|
||||||
|
# since v1.14
|
||||||
|
# when support multi-group, uncomment following section as neccessary
|
||||||
|
#[group2]
|
||||||
|
#group_name=group2
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=1
|
||||||
|
#store_path0=/home/yuqing/fastdfs
|
||||||
|
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = 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 configured correctly.
|
||||||
|
group_name = group1
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# if bind an address of this host when connect to other servers
|
||||||
|
# (this storage server as a client)
|
||||||
|
# true for binding the address configured by the above parameter: "bind_addr"
|
||||||
|
# false for binding any address of this host
|
||||||
|
client_bind = true
|
||||||
|
|
||||||
|
# the storage server port
|
||||||
|
port = 23000
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the heart beat interval in seconds
|
||||||
|
# the storage server send heartbeat to tracker server periodically
|
||||||
|
# default value is 30
|
||||||
|
heart_beat_interval = 30
|
||||||
|
|
||||||
|
# disk usage report interval in seconds
|
||||||
|
# the storage server send disk usage report to tracker server periodically
|
||||||
|
# default value is 300
|
||||||
|
stat_report_interval = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
# NOTE: the binlog files maybe are large, make sure
|
||||||
|
# the base path has enough disk space,
|
||||||
|
# eg. the disk free space should > 50GB
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections the server supported,
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# the buff size to recv / send data from/to network
|
||||||
|
# this parameter must more than 8KB
|
||||||
|
# 256KB or 512KB is recommended
|
||||||
|
# default value is 64KB
|
||||||
|
# since V2.00
|
||||||
|
buff_size = 256KB
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# if disk read / write separated
|
||||||
|
## false for mixed read and write
|
||||||
|
## true for separated read and write
|
||||||
|
# default value is true
|
||||||
|
# since V2.00
|
||||||
|
disk_rw_separated = true
|
||||||
|
|
||||||
|
# disk reader thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_reader_threads = 1
|
||||||
|
|
||||||
|
# disk writer thread count per store path
|
||||||
|
# for mixed read / write, this parameter can be 0
|
||||||
|
# default value is 1
|
||||||
|
# since V2.00
|
||||||
|
disk_writer_threads = 1
|
||||||
|
|
||||||
|
# when no entry to sync, try read binlog again after X milliseconds
|
||||||
|
# must > 0, default value is 200ms
|
||||||
|
sync_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 59
|
||||||
|
sync_start_time = 00:00
|
||||||
|
|
||||||
|
# storage sync end time of a day, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
sync_end_time = 23:59
|
||||||
|
|
||||||
|
# write to the mark file after sync N files
|
||||||
|
# default value is 500
|
||||||
|
write_mark_file_freq = 500
|
||||||
|
|
||||||
|
# disk recovery thread count
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
disk_recovery_threads = 3
|
||||||
|
|
||||||
|
# store path (disk or mount point) count, default value is 1
|
||||||
|
store_path_count = 1
|
||||||
|
|
||||||
|
# store_path#, based on 0, to configure the store paths to store files
|
||||||
|
# if store_path0 not exists, it's value is base_path (NOT recommended)
|
||||||
|
# the paths must be exist.
|
||||||
|
#
|
||||||
|
# IMPORTANT NOTE:
|
||||||
|
# the store paths' order is very important, don't mess up!!!
|
||||||
|
# the base_path should be independent (different) of the store paths
|
||||||
|
|
||||||
|
store_path0 = /data/fastdfs/upload/path0
|
||||||
|
#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 256
|
||||||
|
subdir_count_per_path = 256
|
||||||
|
|
||||||
|
# tracker_server can ocur more than once for multi tracker servers.
|
||||||
|
# the value format of tracker_server is "HOST:PORT",
|
||||||
|
# the HOST can be hostname or ip address,
|
||||||
|
# and the HOST can be dual IPs or hostnames seperated by comma,
|
||||||
|
# the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs.
|
||||||
|
# for example: 192.168.2.100,122.244.141.46:22122
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21:22122
|
||||||
|
|
||||||
|
tracker_server = 192.168.209.121:22122
|
||||||
|
tracker_server = 192.168.209.122:22122
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group =
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# the mode of the files distributed to the data path
|
||||||
|
# 0: round robin(default)
|
||||||
|
# 1: random, distributted by hash code
|
||||||
|
file_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.
|
||||||
|
# rotate to the first path (00/00) after the last path (such as FF/FF).
|
||||||
|
# default value is 100
|
||||||
|
file_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 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# sync binlog buff / cache to disk every interval seconds
|
||||||
|
# default value is 60 seconds
|
||||||
|
sync_binlog_buff_interval = 1
|
||||||
|
|
||||||
|
# sync storage stat info to disk every interval seconds
|
||||||
|
# default value is 300 seconds
|
||||||
|
sync_stat_file_interval = 300
|
||||||
|
|
||||||
|
# thread stack size, should >= 512KB
|
||||||
|
# default value is 512KB
|
||||||
|
thread_stack_size = 512KB
|
||||||
|
|
||||||
|
# the priority as a source server for uploading file.
|
||||||
|
# the lower this value, the higher its uploading priority.
|
||||||
|
# default value is 10
|
||||||
|
upload_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 empty
|
||||||
|
if_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 0
|
||||||
|
check_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.01
|
||||||
|
file_signature_method = hash
|
||||||
|
|
||||||
|
# namespace for storing file indexes (key-value pairs)
|
||||||
|
# this item must be set when check_file_duplicate is true / on
|
||||||
|
key_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.00
|
||||||
|
use_access_log = false
|
||||||
|
|
||||||
|
# if rotate the access log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
rotate_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.00
|
||||||
|
access_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old access log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_access_log = false
|
||||||
|
|
||||||
|
# compress the access log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_access_log_days_before = 7
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_access_log_size = 0
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if skip the invalid record when sync file
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
file_sync_skip_invalid_record = false
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# if compress the binlog files by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog = true
|
||||||
|
|
||||||
|
# try to compress binlog time, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 01:30
|
||||||
|
# since V6.01
|
||||||
|
compress_binlog_time = 01:30
|
||||||
|
|
||||||
|
# if check the mark of store path to prevent confusion
|
||||||
|
# recommend to set this parameter to true
|
||||||
|
# if two storage servers (instances) MUST use a same store path for
|
||||||
|
# some specific purposes, you should set this parameter to false
|
||||||
|
# default value is true
|
||||||
|
# since V6.03
|
||||||
|
check_store_path_mark = true
|
||||||
|
|
||||||
|
# use the ip address of this storage server if domain_name is empty,
|
||||||
|
# else this domain name will ocur in the url redirected by the tracker server
|
||||||
|
http.domain_name =
|
||||||
|
|
||||||
|
# the port of the web server on this storage server
|
||||||
|
http.server_port = 8888
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# <id> <group_name> <ip_or_hostname[:port]>
|
||||||
|
#
|
||||||
|
# id is a natural number (1, 2, 3 etc.),
|
||||||
|
# 6 bits of the id length is enough, such as 100001
|
||||||
|
#
|
||||||
|
# storage ip or hostname can be dual IPs seperated by comma,
|
||||||
|
# one is an inner (intranet) IP and another is an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs
|
||||||
|
# for example: 192.168.2.100,122.244.141.46
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21
|
||||||
|
#
|
||||||
|
# the port is optional. if you run more than one storaged instances
|
||||||
|
# in a server, you must specified the port to distinguish different instances.
|
||||||
|
|
||||||
|
#100001 group1 192.168.0.196
|
||||||
|
#100002 group1 192.168.0.197
|
||||||
|
|
@ -0,0 +1,329 @@
|
||||||
|
# is this config file disabled
|
||||||
|
# false for enabled
|
||||||
|
# true for disabled
|
||||||
|
disabled = false
|
||||||
|
|
||||||
|
# bind an address of this host
|
||||||
|
# empty for bind all addresses of this host
|
||||||
|
bind_addr =
|
||||||
|
|
||||||
|
# the tracker server port
|
||||||
|
port = 22122
|
||||||
|
|
||||||
|
# connect timeout in seconds
|
||||||
|
# default value is 30
|
||||||
|
# Note: in the intranet network (LAN), 2 seconds is enough.
|
||||||
|
connect_timeout = 5
|
||||||
|
|
||||||
|
# network timeout in seconds for send and recv
|
||||||
|
# default value is 30
|
||||||
|
network_timeout = 60
|
||||||
|
|
||||||
|
# the base path to store data and log files
|
||||||
|
base_path = /data/fastdfs_data
|
||||||
|
|
||||||
|
# max concurrent connections this server support
|
||||||
|
# you should set this parameter larger, eg. 10240
|
||||||
|
# default value is 256
|
||||||
|
max_connections = 1024
|
||||||
|
|
||||||
|
# accept thread count
|
||||||
|
# default value is 1 which is recommended
|
||||||
|
# since V4.07
|
||||||
|
accept_threads = 1
|
||||||
|
|
||||||
|
# work thread count
|
||||||
|
# work threads to deal network io
|
||||||
|
# default value is 4
|
||||||
|
# since V2.00
|
||||||
|
work_threads = 4
|
||||||
|
|
||||||
|
# the min network buff size
|
||||||
|
# default value 8KB
|
||||||
|
min_buff_size = 8KB
|
||||||
|
|
||||||
|
# the max network buff size
|
||||||
|
# default value 128KB
|
||||||
|
max_buff_size = 128KB
|
||||||
|
|
||||||
|
# the method for selecting group to upload files
|
||||||
|
# 0: round robin
|
||||||
|
# 1: specify group
|
||||||
|
# 2: load balance, select the max free space group to upload file
|
||||||
|
store_lookup = 2
|
||||||
|
|
||||||
|
# which group to upload file
|
||||||
|
# when store_lookup set to 1, must set store_group to the group name
|
||||||
|
store_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)
|
||||||
|
# Note: if use_trunk_file set to true, must set store_server to 1 or 2
|
||||||
|
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 file
|
||||||
|
store_path = 0
|
||||||
|
|
||||||
|
# which storage server to download file
|
||||||
|
# 0: round robin (default)
|
||||||
|
# 1: the source storage server which the current file uploaded to
|
||||||
|
download_server = 0
|
||||||
|
|
||||||
|
# reserved storage space for system or other applications.
|
||||||
|
# if the free(available) space of any stoarge server in
|
||||||
|
# a group <= reserved_storage_space, no file can be uploaded to this group.
|
||||||
|
# bytes unit can be one of follows:
|
||||||
|
### G or g for gigabyte(GB)
|
||||||
|
### M or m for megabyte(MB)
|
||||||
|
### K or k for kilobyte(KB)
|
||||||
|
### no unit for byte(B)
|
||||||
|
### XX.XX% as ratio such as: reserved_storage_space = 10%
|
||||||
|
reserved_storage_space = 10%
|
||||||
|
|
||||||
|
#standard log level as syslog, case insensitive, value list:
|
||||||
|
### emerg for emergency
|
||||||
|
### alert
|
||||||
|
### crit for critical
|
||||||
|
### error
|
||||||
|
### warn for warning
|
||||||
|
### notice
|
||||||
|
### info
|
||||||
|
### debug
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
#unix group name to run this program,
|
||||||
|
#not set (empty) means run by the group of current user
|
||||||
|
run_by_group=
|
||||||
|
|
||||||
|
#unix username to run this program,
|
||||||
|
#not set (empty) means run by current user
|
||||||
|
run_by_user =
|
||||||
|
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" (only one asterisk) means match all ip addresses
|
||||||
|
# we can use CIDR ips like 192.168.5.64/26
|
||||||
|
# and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
|
||||||
|
# for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
# allow_hosts=192.168.5.64/26
|
||||||
|
allow_hosts = *
|
||||||
|
|
||||||
|
# sync log buff to disk every interval seconds
|
||||||
|
# default value is 10 seconds
|
||||||
|
sync_log_buff_interval = 1
|
||||||
|
|
||||||
|
# check storage server alive interval seconds
|
||||||
|
check_active_interval = 120
|
||||||
|
|
||||||
|
# thread stack size, should >= 64KB
|
||||||
|
# default value is 256KB
|
||||||
|
thread_stack_size = 256KB
|
||||||
|
|
||||||
|
# auto adjust when the ip address of the storage server changed
|
||||||
|
# default value is true
|
||||||
|
storage_ip_changed_auto_adjust = true
|
||||||
|
|
||||||
|
# storage sync file max delay seconds
|
||||||
|
# default value is 86400 seconds (one day)
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_delay = 86400
|
||||||
|
|
||||||
|
# the max time of storage sync a file
|
||||||
|
# default value is 300 seconds
|
||||||
|
# since V2.00
|
||||||
|
storage_sync_file_max_time = 300
|
||||||
|
|
||||||
|
# if use a trunk file to store several small files
|
||||||
|
# default value is false
|
||||||
|
# since V3.00
|
||||||
|
use_trunk_file = false
|
||||||
|
|
||||||
|
# the min slot size, should <= 4KB
|
||||||
|
# default value is 256 bytes
|
||||||
|
# since V3.00
|
||||||
|
slot_min_size = 256
|
||||||
|
|
||||||
|
# the max slot size, should > slot_min_size
|
||||||
|
# store the upload file to trunk file when it's size <= this value
|
||||||
|
# default value is 16MB
|
||||||
|
# since V3.00
|
||||||
|
slot_max_size = 1MB
|
||||||
|
|
||||||
|
# the alignment size to allocate the trunk space
|
||||||
|
# default value is 0 (never align)
|
||||||
|
# since V6.05
|
||||||
|
# NOTE: the larger the alignment size, the less likely of disk
|
||||||
|
# fragmentation, but the more space is wasted.
|
||||||
|
trunk_alloc_alignment_size = 256
|
||||||
|
|
||||||
|
# if merge contiguous free spaces of trunk file
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
trunk_free_space_merge = true
|
||||||
|
|
||||||
|
# if delete / reclaim the unused trunk files
|
||||||
|
# default value is false
|
||||||
|
# since V6.05
|
||||||
|
delete_unused_trunk_files = false
|
||||||
|
|
||||||
|
# the trunk file size, should >= 4MB
|
||||||
|
# default value is 64MB
|
||||||
|
# since V3.00
|
||||||
|
trunk_file_size = 64MB
|
||||||
|
|
||||||
|
# if create trunk file advancely
|
||||||
|
# default value is false
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_advance = false
|
||||||
|
|
||||||
|
# the time base to create trunk file
|
||||||
|
# the time format: HH:MM
|
||||||
|
# default value is 02:00
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_time_base = 02:00
|
||||||
|
|
||||||
|
# the interval of create trunk file, unit: second
|
||||||
|
# default value is 38400 (one day)
|
||||||
|
# since V3.06
|
||||||
|
trunk_create_file_interval = 86400
|
||||||
|
|
||||||
|
# the threshold to create trunk file
|
||||||
|
# when the free trunk file size less than the threshold,
|
||||||
|
# will create he trunk files
|
||||||
|
# default value is 0
|
||||||
|
# since V3.06
|
||||||
|
trunk_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.10
|
||||||
|
trunk_init_reload_from_binlog = false
|
||||||
|
|
||||||
|
# the min interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# FastDFS compress the trunk binlog when trunk init and trunk destroy
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V5.01
|
||||||
|
trunk_compress_binlog_min_interval = 86400
|
||||||
|
|
||||||
|
# the interval for compressing the trunk binlog file
|
||||||
|
# unit: second, 0 means never compress
|
||||||
|
# recommand to set this parameter to 86400 (one day)
|
||||||
|
# default value is 0
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_interval = 86400
|
||||||
|
|
||||||
|
# compress the trunk binlog time base, time format: Hour:Minute
|
||||||
|
# Hour from 0 to 23, Minute from 0 to 59
|
||||||
|
# default value is 03:00
|
||||||
|
# since V6.05
|
||||||
|
trunk_compress_binlog_time_base = 03:00
|
||||||
|
|
||||||
|
# max backups for the trunk binlog file
|
||||||
|
# default value is 0 (never backup)
|
||||||
|
# since V6.05
|
||||||
|
trunk_binlog_max_backups = 7
|
||||||
|
|
||||||
|
# if use storage server ID instead of IP address
|
||||||
|
# if you want to use dual IPs for storage server, you MUST set
|
||||||
|
# this parameter to true, and configure the dual IPs in the file
|
||||||
|
# configured by following item "storage_ids_filename", such as storage_ids.conf
|
||||||
|
# default value is false
|
||||||
|
# since V4.00
|
||||||
|
use_storage_id = false
|
||||||
|
|
||||||
|
# specify storage ids filename, can use relative or absolute path
|
||||||
|
# this parameter is valid only when use_storage_id set to true
|
||||||
|
# since V4.00
|
||||||
|
storage_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.03
|
||||||
|
id_type_in_filename = id
|
||||||
|
|
||||||
|
# if store slave file use symbol link
|
||||||
|
# default value is false
|
||||||
|
# since V4.01
|
||||||
|
store_slave_file_use_link = false
|
||||||
|
|
||||||
|
# if rotate the error log every day
|
||||||
|
# default value is false
|
||||||
|
# since V4.02
|
||||||
|
rotate_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.02
|
||||||
|
error_log_rotate_time = 00:00
|
||||||
|
|
||||||
|
# if compress the old error log by gzip
|
||||||
|
# default value is false
|
||||||
|
# since V6.04
|
||||||
|
compress_old_error_log = false
|
||||||
|
|
||||||
|
# compress the error log days before
|
||||||
|
# default value is 1
|
||||||
|
# since V6.04
|
||||||
|
compress_error_log_days_before = 7
|
||||||
|
|
||||||
|
# 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.02
|
||||||
|
rotate_error_log_size = 0
|
||||||
|
|
||||||
|
# keep days of the log files
|
||||||
|
# 0 means do not delete old log files
|
||||||
|
# default value is 0
|
||||||
|
log_file_keep_days = 0
|
||||||
|
|
||||||
|
# if use connection pool
|
||||||
|
# default value is false
|
||||||
|
# since V4.05
|
||||||
|
use_connection_pool = true
|
||||||
|
|
||||||
|
# connections whose the idle time exceeds this time will be closed
|
||||||
|
# unit: second
|
||||||
|
# default value is 3600
|
||||||
|
# since V4.05
|
||||||
|
connection_pool_max_idle_time = 3600
|
||||||
|
|
||||||
|
# HTTP port on this tracker server
|
||||||
|
http.server_port = 8080
|
||||||
|
|
||||||
|
# check storage HTTP server alive interval seconds
|
||||||
|
# <= 0 for never check
|
||||||
|
# default value is 30
|
||||||
|
http.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 tcp
|
||||||
|
http.check_alive_type = tcp
|
||||||
|
|
||||||
|
# check storage HTTP server alive uri/url
|
||||||
|
# NOTE: storage embed HTTP server support uri: /status.html
|
||||||
|
http.check_alive_uri = /status.html
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
worker_processes 1;
|
||||||
|
worker_rlimit_nofile 65535; #务必先修改服务器的max open files 数。
|
||||||
|
|
||||||
|
error_log /data/fastdfs_data/logs/nginx-error.log;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll; #服务器若是Linux 2.6+,你应该使用epoll。
|
||||||
|
worker_connections 65535;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /data/fastdfs_data/logs/nginx-access.log main;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 2k;
|
||||||
|
gzip_buffers 8 32k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_comp_level 2;
|
||||||
|
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
include /usr/local/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 用途:配置tracker \ storage的配置文件参数,liyanjing 2022.08.10
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# 1. tracker 主要参数,生产环境中建议更改一下端口
|
||||||
|
tracker_port=22122
|
||||||
|
# 实现互备,两台tracker就够了
|
||||||
|
tracker_server="tracker_server = 172.16.100.90:$tracker_port\ntracker_server = 172.16.100.91:$tracker_port"
|
||||||
|
|
||||||
|
# 格式:<id> <group_name> <ip_or_hostname
|
||||||
|
storage_ids="
|
||||||
|
100001 group1 172.16.100.90
|
||||||
|
100002 group2 172.16.100.91
|
||||||
|
"
|
||||||
|
|
||||||
|
# 设置tracker访问IP限制,避免谁都能上传文件,默认是allow_hosts = *
|
||||||
|
allow_hosts="allow_hosts = 172.16.100.[85-91,83]\n"
|
||||||
|
|
||||||
|
# 2. local storage 主要参数,生产环境中建议更改一下端口
|
||||||
|
storage_group_name="group1"
|
||||||
|
storage_server_port=23000
|
||||||
|
store_path_count=1 #文件存储目录的个数,存储目录约定为/data/fastdfs/upload/path0~n
|
||||||
|
|
||||||
|
#==================以下是方法体================================
|
||||||
|
function tracker_confset() {
|
||||||
|
|
||||||
|
sed -i "s|^port =.*$|port = $tracker_port|g" ./conf/tracker.conf
|
||||||
|
# use storage ID instead of IP address
|
||||||
|
sed -i "s|^use_storage_id =.*$|use_storage_id = true|g" ./conf/tracker.conf
|
||||||
|
|
||||||
|
cat > ./conf/storage_ids.conf << EOF
|
||||||
|
# <id> <group_name> <ip_or_hostname[:port]>
|
||||||
|
#
|
||||||
|
# id is a natural number (1, 2, 3 etc.),
|
||||||
|
# 6 bits of the id length is enough, such as 100001
|
||||||
|
#
|
||||||
|
# storage ip or hostname can be dual IPs seperated by comma,
|
||||||
|
# one is an inner (intranet) IP and another is an outer (extranet) IP,
|
||||||
|
# or two different types of inner (intranet) IPs
|
||||||
|
# for example: 192.168.2.100,122.244.141.46
|
||||||
|
# another eg.: 192.168.1.10,172.17.4.21
|
||||||
|
#
|
||||||
|
# the port is optional. if you run more than one storaged instances
|
||||||
|
# in a server, you must specified the port to distinguish different instances.
|
||||||
|
|
||||||
|
#100001 group1 192.168.0.196
|
||||||
|
#100002 group1 192.168.0.197
|
||||||
|
$storage_ids
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 设置tracker访问IP限制,避免谁都能上传文件,默认是allow_hosts = *
|
||||||
|
#sed -i '/^allow_hosts/{N;/^allow_hosts/s/.*/'"${allow_hosts}"'/}' ./conf/tracker.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
function storage_confset() {
|
||||||
|
|
||||||
|
#storage.conf 替换参数
|
||||||
|
sed -i "s|^port =.*$|port = $storage_server_port|g" ./conf/storage.conf
|
||||||
|
sed -i "s|^group_name =.*$|group_name = $storage_group_name|g" ./conf/storage.conf
|
||||||
|
|
||||||
|
sed -i "s|^store_path_count =.*$|store_path_count = $store_path_count|g" ./conf/storage.conf
|
||||||
|
arr_store_path="store_path0 = /data/fastdfs/upload/path0"
|
||||||
|
for((i=1;i<$store_path_count;i++));
|
||||||
|
do
|
||||||
|
arr_store_path="$arr_store_path \nstore_path$i = /data/fastdfs/upload/path$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
sed -i '/^store_path[1-9] =.*$/d' ./conf/storage.conf
|
||||||
|
sed -i '/^#store_path[0-9] =.*$/d' ./conf/storage.conf
|
||||||
|
sed -i "s|^store_path0 =.*$|$arr_store_path|g" ./conf/storage.conf
|
||||||
|
|
||||||
|
sed -i "/^tracker_server =/{N;/^tracker_server =/s/.*/$tracker_server/}" ./conf/storage.conf
|
||||||
|
|
||||||
|
#mod_fastdfs.conf 替换参数
|
||||||
|
sed -i "/^tracker_server/{N;/^tracker_server/s/.*/$tracker_server/}" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^storage_server_port=.*$|storage_server_port=$storage_server_port|g" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^group_name=.*$|group_name=$storage_group_name|g" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^url_have_group_name =.*$|url_have_group_name = true|g" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^store_path_count=.*$|store_path_count=$store_path_count|g" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i '/^store_path[1-9].*/d' ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^store_path0.*|$arr_store_path|g" ./conf/mod_fastdfs.conf
|
||||||
|
sed -i "s|^use_storage_id =.*$|use_storage_id = true|g" ./conf/mod_fastdfs.conf
|
||||||
|
|
||||||
|
#client.conf 当需要使用fastdfs自带的客户端时,更改此文件
|
||||||
|
sed -i "/^tracker_server/{N;/^tracker_server/s/.*/$tracker_server/}" ./conf/client.conf
|
||||||
|
sed -i "s|^use_storage_id =.*$|use_storage_id = true|g" ./conf/client.conf
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_number=1
|
||||||
|
function chose_info_print() {
|
||||||
|
echo -e "\033[32m 请先设置好本脚本的tracker \ storage 的参数变量,然后再选择:
|
||||||
|
[1] 配置 tracker
|
||||||
|
|
||||||
|
[2] 配置 storage\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
#执行
|
||||||
|
function run() {
|
||||||
|
|
||||||
|
#1.屏幕打印出选择项
|
||||||
|
chose_info_print
|
||||||
|
|
||||||
|
read -p "please input number 1 to 2: " mode_number
|
||||||
|
if [[ ! $mode_number =~ [0-2]+ ]]; then
|
||||||
|
echo -e "\033[31merror! the number you input isn't 1 to 2\n\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#2. 执行
|
||||||
|
case ${mode_number} in
|
||||||
|
1)
|
||||||
|
#echo "设置tracker"
|
||||||
|
tracker_confset
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
#echo "设置storage"
|
||||||
|
storage_confset
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "\033[31merror! the number you input isn't 1 to 2\n\033[0m"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo -e "\033[36m ${input_parameter} 配置文件设置完毕,建议人工复核一下\033[0m"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
run
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
### 创建镜像
|
||||||
|
|
||||||
|
参考:
|
||||||
|
https://github.com/qbanxiaoli/fastdfs/blob/master/Dockerfile
|
||||||
|
https://github.com/ygqygq2/fastdfs-nginx/blob/master/Dockerfile
|
||||||
|
|
||||||
|
# docker build -t lyj/fastdfs:6.09-alpine .
|
||||||
|
# docker save a3f007114480 -o /data/docker_images/lyj-fastdfs-6.09-alpine.tar
|
||||||
|
# docker load -i /data/docker_images/lyj-fastdfs-6.09-alpine.tar && docker tag a3f007114480 lyj/fastdfs:6.09-alpine
|
||||||
|
|
||||||
|
# docker build -t lyj/fastdfs:6.08-alpine .
|
||||||
|
# docker save 646a2c0265ca -o /data/docker_images/lyj-fastdfs-6.08-alpine.tar
|
||||||
|
# docker load -i /data/docker_images/lyj-fastdfs-6.08-alpine.tar && docker tag 646a2c0265ca lyj/fastdfs:6.08-alpine
|
||||||
|
|
||||||
|
备注:可以使用centos基础镜像。
|
||||||
|
|
||||||
|
### 一、tracker 部署
|
||||||
|
|
||||||
|
实现互备,两台tracker就够了,生产环境中注意更换端口
|
||||||
|
|
||||||
|
>[danger]推荐使用 setting_conf.sh.sh 来设置配置文件的参数,打开改脚本,修改tracker\storage的主要参数
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1、创建宿主机挂载目录
|
||||||
|
# mkdir -p /data/docker/fastdfs/tracker/{conf,data} #conf为tracker配置文件目录,data为tracker基础数据存储目录
|
||||||
|
|
||||||
|
2、tracker 配置文件
|
||||||
|
+ 我挂载的配置文件目录,将部署操作说明书\fastdfs-conf\conf中的所有配置文件上传到服务器,tracker只用到tracker.conf和storage_ids.conf,其他文件不用管。
|
||||||
|
|
||||||
|
+ 使用 ID 取代 ip,作为storage server的标识,强烈建议使用此方式,例如方便今后的迁移。use_storage_id = false 改为true, 并在storage_ids.conf填写所有storage的id、所属组名,ip
|
||||||
|
|
||||||
|
+ 为了安全,可限定连接到此tracker的ip 范围,默认是allow_hosts = *
|
||||||
|
|
||||||
|
+ reserved_storage_space storage为系统其他应用留的空间,可以用绝对值(10 G或10240 M)或者百分比(V4开始支持百分比方式),网友说“最小阀值不要设置2%(有坑),设置5%可以”。
|
||||||
|
## 同组中只要有一台服务器达到这个标准了,就不能上传文件了
|
||||||
|
## no unit for byte(B) 不加单位默认是byte,例如2G=2147483648byte,reserved_storage_space = 2147483648byte
|
||||||
|
## 经实践6.08版本配置百分比可以;绝对值不加单位默认byte可以;绝对值加单位报错(v6.0.9中修复了) ERROR - file: shared_func.c, line: 2449, unkown byte unit: MB, input string: 10240 MB
|
||||||
|
## 预留空间配置为绝对值,数值和单位之间不能有空格。
|
||||||
|
|
||||||
|
...请阅读参数说明,调优其他参数
|
||||||
|
|
||||||
|
3、启动tracker容器
|
||||||
|
# docker run -d --net=host --restart=always --name=tracker \
|
||||||
|
-v /etc/localtime:/etc/localtime \
|
||||||
|
-v /data/docker/fastdfs/tracker/data:/data/fastdfs_data \
|
||||||
|
-v /data/docker/fastdfs/tracker/conf:/etc/fdfs \
|
||||||
|
-d lyj/fastdfs:6.09-alpine tracker
|
||||||
|
|
||||||
|
|
||||||
|
docker run -d --net=host --restart=always --name=ttmp \
|
||||||
|
-d lyj/fastdfs:6.09-alpine tracker
|
||||||
|
|
||||||
|
4、防火墙中打开tracker端口(默认的22122),生产环境中注意更换端口
|
||||||
|
# firewall-cmd --zone=public --add-port=22122/tcp --permanent
|
||||||
|
# firewall-cmd --reload
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
>去除注释和空行:egrep -v "#|^$" /data/docker/fastdfs/tracker/conf/fdfs/tracker.conf >/data/docker/fastdfs/tracker/conf/fdfs/tracker.conf.bak
|
||||||
|
|
||||||
|
### 二、storage 部署
|
||||||
|
|
||||||
|
+ fastdfs 约定:`同组内的storage server端口必须一致,建议挂载存储目录个数、路径要相同`
|
||||||
|
|
||||||
|
+ 为了互相备份,一个group内有两台storage即可
|
||||||
|
|
||||||
|
+ fastdfs 镜像 已封装了 nginx\fastdfs扩展模块 作为web服务,向外提供http文件访问
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1、创建宿主机挂载目录
|
||||||
|
# mkdir -p /data/docker/fastdfs/storage/{conf,metadata,nginx_conf,nginx_conf.d} #conf存放storge配置文件,metadata为storage基础数据
|
||||||
|
# mkdir -p /data/docker/fastdfs/upload/{path0,path1,path2,path3} #存储上传的文件,当有多块硬盘时,挂载到相应目录上即可 /data/fastdfs/upload/path0~n
|
||||||
|
```
|
||||||
|
|
||||||
|
>[danger]推荐使用 conf_setting.sh 来设置配置文件的参数
|
||||||
|
|
||||||
|
```bash
|
||||||
|
2、配置文件我挂载的是目录,因此将fastdfs-conf\的所有配置文件上传到服务器
|
||||||
|
用到的配置文件:storage.conf(storage配置文件),mod_fastdfs.conf(http文件访问的扩展模块的配置文件),nginx_conf/nginx.conf 与 nginx_conf.d/default.conf(nginx的配置文件)
|
||||||
|
|
||||||
|
配置文件需要调整的主要参数:
|
||||||
|
1. storage.conf
|
||||||
|
group_name = group1 # 指定storage所属组
|
||||||
|
base_path = /data/fastdfs_data # Storage 基础数据和日志的存储目录
|
||||||
|
store_path_count = 1 # 上传文件存放目录的个数
|
||||||
|
store_path0 = /data/fastdfs/upload/path0 # 逐一配置 store_path_count 个路径,索引号基于 0。
|
||||||
|
tracker_server = 172.16.100.90:22122 # tracker_server 的列表 ,有多个时,每个 tracker server 写一行
|
||||||
|
allow_hosts = * ## 允许连接本storage server的IP地址列表,为了安全期间,可以设置。
|
||||||
|
2. mod_fastdfs.conf
|
||||||
|
tracker_server = 172.16.100.90:22122 # tracker服务器的IP地址以及端口号,多个时,每个tracker server写一行
|
||||||
|
storage_server_port = 23000 # 本地storage的端口号,fastdfs约定"同组下的storage端口必须一致"
|
||||||
|
group_name = group1 # 本地storage的组名
|
||||||
|
url_have_group_name = true # url中是否有group名,默认是false,这个参数必须正确设置,否则文件不能被下载到
|
||||||
|
store_path_count = 1 # 本地storage的存储路径个数,必须和storage.conf中的配置一样
|
||||||
|
store_path0 = /data/fastdfs/upload/path0 #本地storage的存储路径,必须和storage.conf中的配置一样
|
||||||
|
|
||||||
|
## 如果在此存储服务器上支持多组时,有几组就设置几组。单组为0.
|
||||||
|
## 通常一台机器运行一个storage就行,没有必要运行多个group的storage,因为stroage本身支持多存储目录的
|
||||||
|
## 使用docker 一个容器运行一个storage,此处就不用管了
|
||||||
|
group_count = 0
|
||||||
|
#[group1]
|
||||||
|
#group_name=group1
|
||||||
|
#storage_server_port=23000
|
||||||
|
#store_path_count=1
|
||||||
|
#store_path0=/data/fastdfs/upload/path0
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
3. http.conf 当需要开启token时,更改此文件
|
||||||
|
4. mime.types 资源的媒体类型,当文件的后缀在此文件中找不到时,需要添加。
|
||||||
|
5. client.conf 当需要使用fastdfs自带的客户端时,更改此文件
|
||||||
|
tracker_server = 172.16.100.90:22122
|
||||||
|
6. nginx_conf.d/default.conf
|
||||||
|
# 将http文件访问请求反向代理给扩展模块
|
||||||
|
location ~/group[0-9]/ {
|
||||||
|
ngx_fastdfs_module;
|
||||||
|
}
|
||||||
|
|
||||||
|
# location ~ /group1/M00 {
|
||||||
|
# alias /data/fastdfs/upload/path0;
|
||||||
|
# ngx_fastdfs_module;
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
3、启动 storage 容器
|
||||||
|
# docker run -d --net=host --restart always --name=storage1_1 \
|
||||||
|
--privileged=true \
|
||||||
|
-v /etc/localtime:/etc/localtime \
|
||||||
|
-v /data/docker/fastdfs/storage/metadata:/data/fastdfs_data \
|
||||||
|
-v /data/docker/fastdfs/storage/conf:/etc/fdfs \
|
||||||
|
-v /data/docker/fastdfs/upload:/data/fastdfs/upload \
|
||||||
|
-v /data/docker/fastdfs/storage/nginx_conf/nginx.conf:/usr/local/nginx/conf/nginx.conf \
|
||||||
|
-v /data/docker/fastdfs/storage/nginx_conf.d:/usr/local/nginx/conf.d \
|
||||||
|
-d lyj/fastdfs:6.09-alpine storage
|
||||||
|
|
||||||
|
防火墙中打开storage服务端口(默认的23000,生产环境中注意更换端口),nginx的端口9088
|
||||||
|
# firewall-cmd --zone=public --add-port=23000/tcp --permanent
|
||||||
|
# firewall-cmd --zone=public --add-port=9088/tcp --permanent
|
||||||
|
# firewall-cmd --reload
|
||||||
|
|
||||||
|
4、 查看下集群运行状态
|
||||||
|
# docker exec -it storage1_1 sh
|
||||||
|
# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
|
||||||
|
|
||||||
|
文件访问:http://172.16.100.90:9088/group1/M00/00/00/oYYBAGMi4zGAYNoxABY-esN9nNw502.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
文件上传demo《E:\gitplace\springboot-fastdfs》
|
||||||
|
|
||||||
|
5、nginx 日期定期切分和过期清理
|
||||||
|
生产环境中一般会在storage nginx前再加一层代理,我这里设置access_log off; 不记录日志了,调试时可以打开。
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
6、http 文件访问 负载入口高可用
|
||||||
|
nginx + keepalived
|
||||||
|
nginx反向代理storage文件的配置:《E:\工具箱\08. docker\3.docker_container_install\nginx\(lvs-webpage-api-oss)default.conf》
|
||||||
|
|
||||||
|
7、扩展,增加storage
|
||||||
|
1. 若使用了storage_ids.conf,则需要修改所有的tracker的storage_ids.conf,填写一行 storage id,注意奥"要重启tracker才能生效"。
|
||||||
|
2. storage 部署,见上面。
|
||||||
|
|
||||||
|
8、使用shell脚本调client 删除历史文件
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
fastdfs源自bbs论坛的问题整理:http://bbs.chinaunix.net/forum-240-1.html
|
||||||
|
|
||||||
|
##### Q0、上传文件,如何选择存储地址的?
|
||||||
|
|
||||||
|
tracker是各协调器, 是如何查询存储地址返回给客户端的?请阅读《fastdfs\1、fastdf配置文件参数解释\tracker.conf参数说明.txt》
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1. client上传文件 <--指定\不指定group--> tracker{选择group ---> 选择 group 中的哪台storage --->选择storage server 中的哪个目录}
|
||||||
|
|
||||||
|
2. Client拿着地址直接和对应的Storage通讯,将文件上传到该Storage。
|
||||||
|
```
|
||||||
|
>[danger]备注:tracker.conf中的 reserved_storage_space 参数是storage为系统、其他应用保留的空间,若空间不足,则上传失败。
|
||||||
|
|
||||||
|
|
||||||
|
##### Q1、fastdfs的版本号如何查看
|
||||||
|
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf 或打开tracker的基础数据存储文件storage_servers_new.dat
|
||||||
|
|
||||||
|
##### Q2、同一个集群内,相互关系
|
||||||
|
- cluster里每个tracker之间是完全对等的,所有的tracker都接受stroage的心跳信息,生成元数据信息来提供读写服务。
|
||||||
|
> 2.03以后,tracker server之间会有通信。比如解决: 新增加一台tracker server时,新的tracker server会自动向老的tracker server获取系统数据文件。。
|
||||||
|
- 同组内的storage server之间,都是对等关系,不存在主从关系。
|
||||||
|
- 组与组之间的storage都是独立的,不同组的storage server之间不会相互通信。
|
||||||
|
|
||||||
|
---
|
||||||
|
##### Q3、备份机制
|
||||||
|
FastDFS采用了分组存储,一个组可以由一台或多台storage存储服务器组成,同组内的storage文件都是相同的,组中的多台storage服务器起到相互备份和负载均衡的作用。
|
||||||
|
|
||||||
|
---
|
||||||
|
##### Q4、storage和组的对应关系
|
||||||
|
一个storage只能属于一个group,组名在storage server上配置,由storage server主动向tracker server报告其组名和存储空间等信息。
|
||||||
|
|
||||||
|
---
|
||||||
|
##### Q5、storage 能连接几个tracker
|
||||||
|
在storage server上配置它要连接的tracker server,可以配置1个或多个。 当storage配置连接2个以上tracker时,tracker群起到负载均衡作用。
|
||||||
|
|
||||||
|
>备注:storage server的信息在tracker上全部缓存到内存中的,支持的分组数,理论上取决于tracker server的内存大小。所以支持上千上万个组没有一点问题。
|
||||||
|
|
||||||
|
>[danger]提醒:在一个集群中,正确的做法是“storage应连接所有的tracker” 万一有个别storage server没有绑定所有tracker server,也不会出现问题。
|
||||||
|
|
||||||
|
---
|
||||||
|
##### Q6、一台机器上运行几个storage
|
||||||
|
通常一台机器只启动一个storage节点(即跑一个group);根据服务器情况(比如多磁盘挂载)、或文件要隔离存储时,可以运行多个storage,但是没必要,因为storage支持多目录挂载.
|
||||||
|
|
||||||
|
>[danger]注意: 同集群内,同组下的storage 端口好必须相同,因此单台上只能运行属于不同组的storage.
|
||||||
|
---
|
||||||
|
##### Q7、一台机器上多个磁盘时,如何使用
|
||||||
|
如果我一台机器多个硬盘挂到不同的目录,不要做RAID,每个硬盘作为一个mount point,直接挂载单盘使用即可
|
||||||
|
- 可以按一个组,运行一个storage,设置多个store_path(索引从0开始)对应不同的磁盘目录。--->推荐
|
||||||
|
- 也按多个组使用,即运行多个storage,每个组管理一个硬盘(mount point)。--->没必要这样做,因为storage已经可以管理多块硬盘了
|
||||||
|
|
||||||
|
> 备注:storage server支持多个路径(例如磁盘)存放文件,为了提高IO性能,不同的磁盘可能挂不同的目录
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
##### Q8、同组内的storage服务器的空间大小不一样时,会出现什么问题
|
||||||
|
同一个卷的存储空间以group内容量最小的storage为准,所以建议同一个GROUP中的多个storage尽量配置相同,即**store_path_count个数、存放文件的目录磁盘大小要相同,目录名称可以不相同**。
|
||||||
|
> 论坛帖子:若同一个卷下的各storage配置不同,某个服务器有空间,但是不能再上传文件的现象。http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1941456&extra=page%3D1%26filter%3Ddigest%26digest%3D1
|
||||||
|
|
||||||
|
---
|
||||||
|
##### Q9、每个目录下存放的文件数有限制吗。
|
||||||
|
没有限制,能不能上传取决于剩余空间。
|
||||||
|
> 备注:storage的缺省情况下,**每个目录下存放100个文件,然后就轮转到下一个目录, 到最后一个目录data/FF/FF后,会跳会第一个目录**。
|
||||||
|
- subdir_count_per_path =256,storage server在初次运行时,会在store_path0~n\data\目录下,自动创建 N * N 个存放文件的子目录。
|
||||||
|
- file_distribute_path_mode配置为0(轮流存放方式),file_distribute_rotate_count = 100,当一个目录下的文件存放的文件数达到本参数值时,后续上传的文件存储到下一个目录中。
|
||||||
|
|
||||||
|
##### Q10、tracker、storage和client配置文件中的http.server_port还要配置吗
|
||||||
|
不用理会这个配置项,HTTP访问文件请使用外部的web server.
|
||||||
|
>[danger] 备注:
|
||||||
|
- fastdfs内置的web server从4.0.5版本就移除了(因为之前自带的HTTP服务较为简单,无法提供负载均衡等高性能服务),而是使用外部web server(apache和nginx)提供http文件访问服务。
|
||||||
|
- 为了解决文件同步延迟的问题,apache或nginx上需要使用FastDFS提供的扩展模块,如nginx的fastdfs-nginx-module
|
||||||
|
- 在每台storage server上部署web server,直接对外提供HTTP服务
|
||||||
|
- tracker server上不需要部署web server
|
||||||
|
|
||||||
|
##### Q11、如何防盗链
|
||||||
|
通过token的方式来实现的防盗链。原贴地址:http://bbs.chinaunix.net/thread-1916999-1-1.html
|
||||||
|
看一下配置文件 mod_fastdfs.conf,里面包含了http.conf,在http.conf中进行防盗链相关设置。
|
||||||
|
|
||||||
|
##### Q12、“海量”小文件会导致文件系统性能急剧下降,请问这里的“海量”大致在什么级别
|
||||||
|
出于性能考虑,我觉得单台机器存储的文件数不要超过1千万吧。
|
||||||
|
> [点击查看原贴地址](点击查看原贴地址:http://bbs.chinaunix.net/thread-2328826-1-48.html "点击查看原贴地址"), 3.0的计划中,提到“海量”小文件会导致文件系统性能急剧下降,乃至崩溃。请问这里的“海量”大致在什么级别,通过扩展主机(不仅仅是磁盘)是否可以解决“海量”小文件带来的性能瓶颈?
|
||||||
|
|
||||||
|
##### Q13、FastDFS扩展模块(fastdfs-nginx-module)支持断点续传吗
|
||||||
|
|
||||||
|
版本V1.08,增加了支持断点续传
|
||||||
|
|
||||||
|
##### Q14、配置了Nginx的FDFS扩展模块,可以通过nginx访问文件,mod_fastdfs.conf中的tracker_server配置项有什么作用?
|
||||||
|
|
||||||
|
扩展模块在web server启动时,连接tracker server,以获得2个配置参数,
|
||||||
|
如果连不上时或者获取失败,会使用缺省值:
|
||||||
|
+ storage_sync_file_max_delay:文件同步的最大延迟,缺省为1天
|
||||||
|
+ storage_sync_file_max_time:同步单个文件需要的最大时间,缺省为5分钟。
|
||||||
|
|
||||||
|
##### Q15、扩展模块有哪些注意事项
|
||||||
|
配置文件/etc/fdfs/mod_fastdfs.conf,参数url_have_group_name:URL中是否包含了group name。这个参数必须正确设置,否则文件不能被下载到
|
||||||
|
|
||||||
|
##### Q16、FastDFS是否支持文件修改呢?
|
||||||
|
V3.08开始支持文件修改了。
|
||||||
|
|
||||||
|
##### Q17、如果你需要相同文件内容的文件只保存一份时,怎么办?
|
||||||
|
|
||||||
|
结合FastDHT使用,http://localhost:8181/docs/fastdfs/fastdfs-1dtfs5fe93h60
|
||||||
|
|
||||||
|
##### Q18、只要知道tracker的服务器IP和端口,任何都可以使用api上传文件,这样是否会有恶意上传的问题
|
||||||
|
|
||||||
|
可以指定访问限制,tracker.conf,storage.conf,添加访问IP限制:(例)
|
||||||
|
```bash
|
||||||
|
# allow_hosts can ocur more than once, host can be hostname or ip address,
|
||||||
|
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
|
||||||
|
# host[01-08,20-25].domain.com, for example:
|
||||||
|
# allow_hosts=10.0.1.[1-15,20]
|
||||||
|
# allow_hosts=host[01-08,20-25].domain.com
|
||||||
|
#allow_hosts=*
|
||||||
|
allow_hosts=222.222.222.[152-154]
|
||||||
|
allow_hosts=111.111.111.111
|
||||||
|
|
||||||
|
```
|
||||||
|
Q19、部署哪些事项要注意?
|
||||||
|
|
||||||
|
0. tracker 只管理集群拓扑数据,不存储任何文件索引,对硬件配置要求较低,为了实现互备,**两台tracker就够了。若集群规模较小,可复用storage机器**
|
||||||
|
|
||||||
|
1. 在tracker的配置文件tracker.conf中设置好预留合适的空间.
|
||||||
|
|
||||||
|
2. fastdfs存储文件是直接基于操作系统的文件系统的,**storage的性能瓶颈通常表现在磁盘IO**。为了充分利用文件系统的cache已加快文件访问,**推荐storage配置较大内存**,尤其在众多热点文件的场合下,大量IO吞吐也会消耗cpu
|
||||||
|
|
||||||
|
3. storage,为了互相备份,**一个group内有两台storage即可**
|
||||||
|
|
||||||
|
4. storage 为了充分利用磁盘,推荐不做RAID,直接挂载单块硬盘,每块硬盘mount为一个路径,作为storage的一个store_path。
|
||||||
|
|
||||||
|
5. **同组内的storage 端口号必须相同**,建议挂载存储个数相同、空间大小相同;同一主机上可以运行多个不同组的storage.
|
||||||
|
|
||||||
|
6. 同组内的storage 若有多个tracker,应当配置上所有的tracker地址
|
||||||
|
|
||||||
|
7. fastdfs从4.0.5开始去除了http文件下载功能,需要外部的web server,为了解决文件同步延迟的问题,apache或nginx上需要使用FastDFS提供的扩展模块,如nginx的fastdfs-nginx-module
|
||||||
|
- 在每台storage server上部署web server,直接对外提供HTTP服务
|
||||||
|
- tracker server上不需要部署web server
|
||||||
|
- 每个组必须有一个nginx,提供http文件访问服务.
|
||||||
|
|
||||||
|
8. 海量小文件场景,建议使用文件合并存储特性,在tracker.conf 设置 use_trunck_file=true,**如果一个group存储的文件数不超过一千万,就没有必要使用这个特性**。
|
||||||
|
|
||||||
|
9. 为了避免不必要的干扰集群安全考虑,**建议使用storage server id 方式。** tracker.conf 设置 use_storage_id=true 并在storage_ids.conf填写所有storage的id、所属组名,ip。这样做迁移很容易。
|
||||||
|
|
||||||
Loading…
Reference in New Issue