(轉)部署fastdfs時報 ERROR - file: tracker_proto.c, line: 48, server: 192.168.124.5:22122, response status 2 != 0
參考文章:https://markix.blog.csdn.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.csdn.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去上傳。
暫時還有別的事情干,這個問題等后面有時間再琢磨琢磨。