///
开始
service fdfs_trackerd start
service fdfs_storaged start
/usr/local/nginx/sbin/nginx
/usr/local/nginx2/sbin/nginx
查看运行状态
netstat -unltp|grep fdfs
netstat -unltp|grep nginx
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
/usr/bin/fdfs_monitor /etc/fdfs/client.conf
上传文件
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /opt/02.jpg
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/grgbanking/image001.jpg
http://10.3.34.34/group1//M00/44/3D/CgMiIluiEI2AJydLAAA5g_B8w4c627.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-z-ALFCyAAAKl8u7czA059.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-2iAdiclAAA5g9Egq5g071.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-4WATryEAAAeIgXR7KE661.jpg
---集群---
group1//M00/00/00/CgIFD1vF-z-ALFCyAAAKl8u7czA059.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-z-ALFCyAAAKl8u7czA059.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-2iAdiclAAA5g9Egq5g071.jpg
10.2.5.6/group1//M00/00/00/CgIFD1vF-4WATryEAAAeIgXR7KE661.jpg
10.2.5.15/group1//M00/00/0B/CgIFD1v1QUSAW5RQAAJd4JZ6H3E187.jpg
清除卷
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf delete group1 10.3.34.34
文件存储路径
/opt/fastdfs_storage_data/
/home/md/fastdfsdata/storage
停止
/usr/local/nginx/sbin/nginx -s stop
/usr/local/bin/stop.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/stop.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
killall fdfs_storaged
killall fdfs_trackerd
重启
/usr/bin/restart.sh /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/bin/restart.sh /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
/usr/local/nginx/sbin/nginx -s reload
//临时关闭防火墙
systemctl stop firewalld
//禁止开机启动防火墙
systemctl disable firewalld
/
upstream storage_server_group1{
server 10.2.5.6:8888 weight=10;
server 10.2.5.15:8888 weight=10;
}
/
nginx + fastDFS 设置开机自动启动
由于在服务器上有太多的软件
不可能每次启动都要重新启动服务吧(每晚断电。。。必须重启电脑)
vim /etc/rc.d/rc.local
添加下列脚本
1 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
2 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
3 /usr/local/nginx/sbin/nginx
注:如果tracker和storage安装在不同的位置,则需要在不同位置的文件中添加脚本
///
设置Tracker开机启动
# chkconfig fdfs_trackerd on
或者:
# vim /etc/rc.d/rc.local
加入配置:
/etc/init.d/fdfs_trackerd start
设置 Storage 开机启动
# chkconfig fdfs_storaged on
或者:
# vim /etc/rc.d/rc.local
加入配置:
/etc/init.d/fdfs_storaged start
设置nginx开机启动
复制代码
# vim /etc/rc.local
添加一行:
/usr/local/nginx/sbin/nginx
# 设置执行权限
# chmod 755 rc.local
复制代码
//
定时删除旧文件
vim delete.sh
#!/bin/bash
#删除文件
#解释 找到/FastDFDS/FastDFS 目录下 10天前修改的 名字任意 并删除
find /opt/fastdfs_storage_data/data -mtime +34 -name "*.*" -exec rm -rf {} \;
find /home/md/fastdfsdata/storage/data -mtime +34 -name "*.*" -exec rm -rf {} \;
#删除文件夹
#find /FastDFS/FastDFS -mtime +1 -name "*" -type d -exec rm -rf {} \ ;
#chmod +x delete
设置定时
sudo crontab -e
#每天0点执行该脚本
0 0 * * * sh /etc/fdfs/delete.sh
查看
sudo crontab -l
运行
sudo service crond restart
///
ln -s /data2/fastdfs/fastdfs_storage_data/data /data2/fastdfs/fastdfs_storage_data/data/M00