nginx反向代理失败,又是 fastdfs 的锅
fdfs问题记录
[root@hostcad logs]# systemctl status fdfs_trackerd.service
● fdfs_trackerd.service - LSB: FastDFS tracker server
Loaded: loaded (/etc/rc.d/init.d/fdfs_trackerd; bad; vendor preset: disabled)
Active: active (running) since Fri 2020-07-31 14:53:06 CST; 5min ago
Docs: man:systemd-sysv-generator(8)
Process: 17024 ExecStop=/etc/rc.d/init.d/fdfs_trackerd stop (code=exited, status=3)
Process: 17032 ExecStart=/etc/rc.d/init.d/fdfs_trackerd start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/fdfs_trackerd.service
└─17038 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
Jul 31 14:53:06 hostcad systemd[1]: Starting LSB: FastDFS tracker server...
Jul 31 14:53:06 hostcad fdfs_trackerd[17032]: Starting FastDFS tracker server:
Jul 31 14:53:06 hostcad systemd[1]: Started LSB: FastDFS tracker server.
这里可以看出,对应的启动文件在:
/etc/rc.d/init.d/fdfs_trackerd
从该文件,可以看到:
#!/bin/bash
#
# fdfs_trackerd Starts fdfs_trackerd
#
#
# chkconfig: 2345 99 01
# description: FastDFS tracker server
### BEGIN INIT INFO
# Provides: $fdfs_trackerd
### END INIT INFO
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
PRG=/usr/bin/fdfs_trackerd
CONF=/etc/fdfs/tracker.conf
配置文件为/etc/fdfs/tracker.conf
。
# is this config file disabled
# false for enabled
# true for disabled
disabled=false
# bind an address of this host
# empty for bind all addresses of this host
bind_addr=
# the tracker server port
port=22122
# connect timeout in seconds
# default value is 30s
connect_timeout=10
# network timeout in seconds
# default value is 30s
network_timeout=60
#1 the base path to store data and log files
base_path=/home/fastdfs/tracker
从上面1处,得知其数据和日志的路径。
[root@hostcad logs]# cd /home/fastdfs/tracker
[root@hostcad tracker]# ll
total 0
drwxr-xr-x. 2 root root 178 Jul 31 14:53 data
drwxr-xr-x. 2 root root 26 Jul 31 14:58 logs
[root@hostcad tracker]# tree .
.
├── data
│?? ├── fdfs_trackerd.pid
│?? ├── storage_changelog.dat
│?? ├── storage_groups_new.dat
│?? ├── storage_servers_new.dat
│?? └── storage_sync_timestamp.dat
└── logs
└── trackerd.log
2 directories, 6 files
[root@hostcad tracker]#
拿到日志路径后,我们看看日志中有没有报错:
[2020-07-30 11:49:08] ERROR - file: tracker_mem.c, line: 1493, the format of the file "/home/fastdfs/tracker/data/storage_sync_timestamp.dat" is invalid, group_name: group1, colums: 5 > 4
我们拿着这个错误去搜索一下,发现了以下链接:
https://www.cnblogs.com/jaredzhuo/articles/7365153.html
https://blog.csdn.net/sinat_23678421/article/details/43955721?utm_source=blogxgwz0
根据文章中的方法:
Q: 在tracker的日志里报出此类错误
ERROR - file: tracker_mem.c, line: 1406, the format of the file "/home/bstar/dfs_data/data/storage_sync_timestamp.dat" is invalid, group: group3, row count:1 > server count:0
A:修改data里面的 storage_sync_timestamp.dat,把group3的信息删掉,然后重启tracker
删掉文件里的内容,然后重启tracker,就ok了。