fastdfs 搭建
此下载 https://gitee.com/fastdfs100/fastdfs ,最新安装包有问题,暂未解决。
安装包如下:
链接:https://pan.baidu.com/s/1uihcXbpp4PvcF4mZ8kFhTw?pwd=1234
提取码:1234
#本配置为centos7下部署
# 1.加载yum依赖包
yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget
# 2.解压编译libfastcommon-master
./make.sh && ./make.sh install
# 3.建立软连接libfastcommon-master
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
# 4.解压编译FastDFS
./make.sh && ./make.sh install
cp FastDFS/conf/http.conf /etc/fdfs/
cp conf/mime.types /etc/fdfs/
# 5.配置FastDFS中tracker、storage、client的conf文件
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf
# 6.修改tracker.conf base_path为自定义数据存储目录
base_path=/opt/data/fdfs/tracker
# 7.修改storage.conf
base_path=/opt/data/fdfs/storage/base
store_path0=/opt/data/fdfs/storage/store
tracker_server=IP:22122
# 8.修改client.conf, 如果不需要在shell中测试,可以不修改
base_path=/opt/data/fdfs/client
tracker_server=IP:22122
# 9.启动tracker、storage服务
cd /usr/bin/ && ls fdfs_* #查看所有的fdfs服务名称
# 启动tracker
service fdfs_trackerd start
service fdfs_trackerd status
# 启动storage
service fdfs_storaged start
service fdfs_storaged status
# 测试上传文件 fdfs_upload_file 客户端连接配置 上传文件地址
fdfs_upload_file /etc/fdfs/client.conf 上传文件地址
# 删除fdfs文件
fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/CgRXAmKwFMuABks6AAAFtqyaAGI76.conf
# 10. 解压fastdfs-nginx-module
cp mod_fastdfs.conf /etc/fdfs/
# 修改mod_fastdfs.conf
base_path=/opt/data/fdfs/storage/base
tracker_server=IP:22122
store_path0=/opt/data/fdfs/storage/store
# 11. 解压安装nginx
./configure --prefix=/usr/local/nginx --add-module=/opt/fastdfs/fastdfs-nginx-module/src
make && make install
# 修改nginx.conf文件
location ~ /group[0-9]/M00 {
ngx_fastdfs_module;
}
# 建立软连接,便于nginx访问
ln -s /opt/data/fdfs/storage/store/data /opt/data/fdfs/storage/store/data/M00
/etc/init.d/nginx 配置nginx开机自启
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
chmod a+x /etc/init.d/nginx
# 添加开机自启
chkconfig --add nginx
chkconfig nginx --list
service nginx start
分类:
devops
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了