防火墙打开8080和22122端口:
# vi /etc/sysconfig/iptables
增加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22122 -j ACCEPT
重启防火墙:
# /etc/init.d/iptables restart
自定义tracker服务启动、关闭、重启脚本:
# su fastdfs
切换回fastdfs用户后
$ cd /home/fastdfs/tracker/
(1)启动脚本:
[fastdfs@FASTDFS-TRACKER-01 tracker]$ vi start_tracker.sh
/usr/local/fastdfs/bin/fdfs_trackerd /usr/local/fastdfs/conf/tracker.conf
(2)关闭脚本(使用FastDFS自带的stop.sh脚本):
[fastdfs@FASTDFS-TRACKER-01 tracker]$ vi stop_tracker.sh
/usr/local/fastdfs/bin/stop.sh /usr/local/fastdfs/bin/fdfs_trackerd /usr/local/fastdfs/conf/tracker.conf
(3)重启脚本(使用FastDFS自带的restart.sh脚本):
[fastdfs@FASTDFS-TRACKER-01 tracker]$ vi restart_tracker.sh
/usr/local/fastdfs/bin/restart.sh /usr/local/fastdfs/bin/fdfs_trackerd /usr/local/fastdfs/conf/tracker.conf
防火墙打开23000和8888端口:
# vi /etc/sysconfig/iptables
增加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8888 -j ACCEPT
重启防火墙:
# /etc/init.d/iptables restart
自定义storage服务启动、关闭、重启脚本:
# su fastdfs
切换回fastdfs用户后
$ cd /home/fastdfs/storage/
(1)启动脚本:
[fastdfs@FASTDFS-STORAGE-01 storage]$ vi start_storage.sh
/usr/local/fastdfs/bin/fdfs_storaged /usr/local/fastdfs/conf/storage.conf
(2)关闭脚本(使用FastDFS自带的stop.sh脚本):
[fastdfs@FASTDFS-STORAGE-01 storage]$ vi stop_tracker.sh
/usr/local/fastdfs/bin/stop.sh /usr/local/fastdfs/bin/fdfs_storaged /usr/local/fastdfs/conf/storage.conf
(3)重启脚本(使用FastDFS自带的restart.sh脚本):
[fastdfs@FASTDFS-STORAGE-01 storage]$ vi restart_storage.sh
/usr/local/fastdfs/bin/restart.sh /usr/local/fastdfs/bin/fdfs_storaged /usr/local/fastdfs/conf/storage.conf
如果产生如下错误提示:
checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
#--with-http_stub_status_module 用来监控nginx的当前状态
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
上面编译时使用的动态链接库:
#启动nginx报错
#./nginx: error while loading shared libraries: libfastcommon.so: cannot open shared object file: No such file or directory
#解决办法 ---> 将/usr/local/fastdfs/lib 加入系统文件/etc/ld.so.conf中
# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/fastdfs/lib
#更新库文件缓存ld.so.cache
# /sbin/ldconfig -v
编译fastdfs-nginx-module模块:
# 重新编译安装nginx
# cd /usr/local/src/nginx-1.4.4
# ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
# make && make install
修改mod_fastdfs.conf配置:
# vi /usr/local/fastdfs/conf/mod_fastdfs.conf
# connect timeout in seconds
# default value is 30s
connect_timeout=30
# 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
# 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 = 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=10.10.16.201:22122
tracker_server=10.10.16.202: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/fastdfs/nginx/logs/mod_fastdfs.log
注意, 下载时如发现老报404. 将nginx.conf第一行 usr nobody 修改为 user root 重新启动后解决.