(转)部署fastdfs时报 ERROR - file: tracker_proto.c, line: 48, server: 192.168.124.5:22122, response status 2 != 0
参考文章:https://markix.blog.****.net/article/details/82562205
写这篇文章主要是为了记录这个问题,同时写下我发现这个问题后的想法。
以下正文:
今天我用docker部署了下fastdfs分布式文件服务器,tracker和storage都正常安装了,但是还是报错。
root@hongcheng:/# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf 123.jpg 使用命令上传一个图片
[2018-09-09 20:33:12] ERROR - file: tracker_proto.c, line: 48, server: 192.168.124.5:22122, response status 2 != 0
tracker_query_storage fail, error no: 2, error info: No such file or directory
发现错误肯定就是思考原因嘛,我大致想到以下几点:
- 我是在docker里面部署的,所以我就怀疑是不是tracker和storage两个容器网络不通、或者发错地方了
- 看到“ No such file or directory”,我怀疑是不是fdfs_upload_file找不到、配置文件的文件存放目录配错了、文件存放目录不存在、或者权限问题,或者压根就是我配置文件找不到、又或者是我“123.jpg”根本就没有。
- 后来发现不行,我又猜想是不是启动storage时指定错了配置文件。
- 或者我服务器的ip指定错了。https://markix.blog.****.net/article/details/82562205 这篇文章出现的问题其实就只ip指定了127.0.0.1,不过不是我这个问题。
这个问题百度了一段时间,也是在发现不了为啥。后面就发现了上面那篇文章,有可能是以前注册到tracker的一个storage访问不上。
root@hongcheng:/# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2021-08-03 09:19:24] DEBUG - base_path=/data/fast_data, connect_timeout=30, network_timeout=60,
tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0,
g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=1, server_index=0
tracker server is 192.168.124.5:22122
group count: 1
Group 1:
group name = group1
disk total space = 17394 MB
disk free space = 4885 MB
trunk free space = 0 MB
storage server count = 2
active server count = 1
storage server port = 23000
storage HTTP port = 8080
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 10.1.6.133
ip_addr = 10.1.6.133 OFFLINE
http domain =
version = 5.08
join time = 2020-08-31 09:54:48
...............
last_synced_timestamp = 1970-01-01 00:00:00 (never synced)
Storage 2:
id = 192.168.124.5
ip_addr = 192.168.124.5 ACTIVE
http domain =
version = 5.08
join time = 2021-08-03 07:05:00
...............
last_synced_timestamp = 1970-01-01 00:00:00
巧了吧唧,我还真有两个,其中一个还是离线的。直接干掉,然后就ok了
root@hongcheng:/# /usr/bin/fdfs_monitor /etc/fdfs/client.conf delete group1 10.1.6.133
[2021-08-03 09:20:04] DEBUG - base_path=/data/fast_data, connect_timeout=30, network_timeout=60,
tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0,
g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=1, server_index=0
tracker server is 192.168.124.5:22122
delete storage server group1::10.1.6.133 success
root@hongcheng:/# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /data/fast_data/123.jpg
group1/M00/00/00/wKh8BWEJCmqASsU0AAAAJ3dE_IY563.txt
此时再查一遍,原来那个已经被删除了(10.1.6.133 DELETED)
root@hongcheng:/# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2021-08-03 08:19:03] DEBUG - base_path=/data/fast_data, connect_timeout=30, network_timeout=60,
tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0,
g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=1, server_index=0
tracker server is 192.168.174.128:22122
group count: 1
Group 1:
group name = group1
disk total space = 17394 MB
disk free space = 4872 MB
trunk free space = 0 MB
storage server count = 2
active server count = 1
storage server port = 23000
storage HTTP port = 8080
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 10.1.6.133
ip_addr = 10.1.6.133 DELETED
http domain =
version = 5.08
...................
Storage 2:
id = 192.168.174.128
ip_addr = 192.168.174.128 ACTIVE
http domain =
version = 5.08
....................
我拿到的这个tracker和storage镜像是公司的人做好的,10.1.6.133服务器应该是以前配的,后来我改了配置文件重启,增加了192.168.174.128服务器,重启后,tracker上面就有两个storage了,但是按理说tracker是对storage有心跳检查的,那我上传文件就应该调用192.168.174.128这个好的storage去上传。
暂时还有别的事情干,这个问题等后面有时间再琢磨琢磨。