1.下载依赖libfastcommon
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
2.解压安装
tar -zxvf V1.0.7.tar.gz
cd libfastcommon-1.0.7/
./make.sh
./make.sh install
3.设置软连接
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
4.下载FastDFS
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
5.解压安装
tar -zxvf V5.05.tar.gz
cd fastdfs-5.05
./make.sh
./make.sh install
6.设置软连接
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/fdfs_storaged /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin
7.启动服务
/etc/init.d/fdfs_storaged
/etc/init.d/fdfs_tracker
8.配置文件
/etc/fdfs/client.conf.sample
/etc/fdfs/storage.conf.sample
/etc/fdfs/tracker.conf.sample
##配置tracker.conf
# cd /etc/fdfs
# cp tracker.conf.sample tracker.conf
# vim tracker.conf
##配置storage.conf
# cd /etc/fdfs
# cp storage.conf.sample storage.conf
# vim storage.conf
mkdir -p /opt/workspace/fastdfs/tracker
mkdir -p /opt/workspace/fastdfs/storage
mkdir -p /opt/workspace/fastdfs/client
mkdir -p /opt/workspace/fastdfs/file
##启动关闭及查看
service fdfs_storaged start
service fdfs_storaged stop
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
##参考网站
https://www.cnblogs.com/chiangchou/p/fastdfs.html
https://me.csdn.net/u010758410
###节点数据不同步处理方法:
#从集群中删除
fdfs_monitor /etc/fdfs/client.conf delete group1 10.120.151.114
#在114服务器中,删除数据文件夹
rm -rf /home/storage1/fastdfs/data
##重启节点
service fdfs_storaged restart
STORAGE SERVER的状态通常有七种:
# FDFS_STORAGE_STATUS:INIT :初始化,尚未得到同步已有数据的源服务器
# FDFS_STORAGE_STATUS:WAIT_SYNC :等待同步,已得到同步已有数据的源服务器
# FDFS_STORAGE_STATUS:SYNCING :同步中
# FDFS_STORAGE_STATUS:DELETED :已删除,该服务器从本组中摘除
# FDFS_STORAGE_STATUS:OFFLINE :离线
# FDFS_STORAGE_STATUS:ONLINE :在线,尚不能提供服务
# FDFS_STORAGE_STATUS:ACTIVE :在线,可以提供服务
正常状态必须是ACTIVE,如果运行以下命令:
fdfs_monitor /etc/fdfs/client.conf
发现有以下状态的服务器:
Storage 4:
ip_addr = 10.120.151.114 WAIT_SYNC
经过各种重启都不解决问题,只好先删除,再加入
# 在tracker中操作,从集群中删除
fdfs_monitor /etc/fdfs/client.conf delete group1 10.120.151.114
# 在storage宕机服务器中,删除数据文件夹
rm -rf /home/storage1/fastdfs/data
# 在tracker中重启storage节点
fdfs_storaged /etc/fdfs/storage.conf
重新查状态
/usr/bin/fdfs_monitor /etc/fdfs/client.conf