修改mod_fastdfs.conf配置
vim /usr/local/fastdfs/conf/mod_fastdfs.conf
# the base path to store log files
base_path=/tmp
# if load FastDFS parameters from tracker server
# since V1.12
# default value is false
load_fdfs_parameters_from_tracker=true
# 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.25.11: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=/home/fastdfs/storage
# 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=/home/www/logs/mod_fastdfs.log
nginx配置简洁版本
#vim /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes 2;
error_log /home/www/logs/error.log notice;
pid /home/www/logs/nginx.pid;
worker_rlimit_nofile 5120;
events {
use epoll;
worker_connections 5120;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
server {
listen 80;
server_name localhost;
location /group1/M00 {
alias /home/fastdfs/storage/data;
ngx_fastdfs_module;
}
}
}
#启动nginx
#脚本在《详细nginx安装步骤》
sernginx start
安装Storage Server -192.168.127.13
配置及启动存储服务(Storage Server)
- 引用上例中安装libevent 和 fastdfs步骤
- 修改storage.conf配置
vim /usr/local/fastdfs/conf/storage.conf
# the name of the group this storage server belongs to
group_name=group2
# the name of the group this storage server belongs to
# the storage server port #the storage server port
port=23000
# the base path to store data and log files #日志目录
base_path=/home/yuqing/fastdfs -> /home/fastdfs/storage
# store_path#, based 0, if store_path0 not exists, it's value is base_path #data数据存储目录
# the paths must be exist
store_path0=/home/fastdfs/storage
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group= -> fastdfs #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
#unix username to run this program,
#not set (empty) means run by current user
run_by_user= -> fastdfs #这儿一定填写执行的用户名,不然会启动报错,测试环境填写的 root
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=192.168.209.121:22122 -> tracker_server=192.168.127.11:22122
引用上例中’编辑启动脚本’步骤
启动storage
service fdfs_storaged restart
#接下来会出现很多mkdir data path,这是系统在创建数据目录
data path: /home/fastdfs/storage/data, mkdir sub dir...
mkdir data path: 00 ...
mkdir data path: 01 ...
mkdir data path: 02 ...
mkdir data path: 03 ...
.......................
data path: /home/fastdfs/storage/data, mkdir sub dir done.
