背景:文件服务器已经上线三个月,使用fastdfs做文件服务器的中间件,一台tracker服务器,两台storage互相备份(小公司你懂得,白手起家,资源有限,想怎么搞怎么搞),
从阿里云40G的存储快用的差不多了,是时候挂载一个数据盘进行扩容了。内心OS:扩容还不简单,挂载个硬盘,修改个storage配置文件不就行了,然而我就这样入坑了。
首先修改storage配置文件,vim /etc/fdfs/storage.conf
修改如下两点
# path(disk or mount point) count, default value is 1
store_path_count=2
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/home/ubuntu/fastdfs/storage/storage0
store_path1=/mnt/data1
(1)store_path_count 文件路径数数:存储文件的硬盘数或挂载点数
(2)文件路径分别是什么
OK,重启storage
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
这个时候查看fdfs的运行情况
/usr/bin/fdfs_monitor /etc/fdfs/clint.conf
问题来了,
重启的这台storage,处于offline状态,另外一台正常active。。。
奔溃,分析日志找原因,
vim /home/ubuntu/fastdfs/tracker/logs/trackerd.log
[2017-12-11 15:20:15] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:16] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:17] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:18] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:19] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:20] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:21] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:22] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:23] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:24] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:25] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:26] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:27] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:28] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:29] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
[2017-12-11 15:20:30] ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
报了一堆错:ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
tracker报错了。。。
网上各种搜索,看源码,意思大概是数据包大小超了,但是如何解决,没有下文
各种尝试,最终试出来来了
两台storage的store_path_count 必须一致,吐血,想想也应该这样呀,不然存在M01的数据同步不到另外一台storage上
所以两台一起修改配置文件重启后,就OK了,
监控运行结果,两台storage均为active状态了
配合nginx使用需要修改mod_fastdfs.conf,修改和storage.conf一致,即可,OK,大功告成!