冗余扩容
首先,初始化配置FastDFS基础环境,然后开始配置
1. 安装 libfastcommon 和 fasdfs
2. 安装 nginx 并配置
3. 配置 strorage和client、nginx模块
4. 启动 fdfs_storaged 和 nginx 服务
5. 观察日志和集群中新机的状态(ACTIVE 表示可以正常提供服务)
配置Storage
关键配置项: /etc/fdfs/storage.conf
* group_name=G1
* store_path_count=1
* store_path0=/data/fastdfs/storage/f_data
* tracker_server=192.168.2.30:22122
* tracker_server=192.168.2.20:22122
* http.server_port=8888
配置Client
关键配置项: /etc/fdfs/client.conf
* base_path=/data/fastdfs/tracker
* tracker_server=192.168.2.20:22122
* tracker_server=192.168.2.30:22122
配置Nginx模块
关键配置项: /etc/fdfs/mod_fastdfs.conf
* tracker_server=192.168.2.30:22122
* tracker_server=192.168.2.20:22122
* storage_server_port=23000
* group_name=G1
* url_have_group_name = true
* store_path_count=1
* store_path0=/data/fastdfs/storage/f_data
配置Nginx模块
虚拟主机配置
server {
listen 8888;
server_name localhost;
location /G1/M00 {
root /data/fastdfs/storage/f_data;
ngx_fastdfs_module;
}
}
启动服务
启动Storage
# /etc/init.d/fdfs_storaged start
启动Nginx
# /usr/local/nginx/sbin/nginx
检查状态
# fdfs_monitor /etc/fdfs/client.conf