一、下载并安装libfastcommon
cd /opt/tools git clone https://github.com/happyfish100/libfastcommon.git cd libfastcommon/ ./make.sh ./make.sh install
二、下载并安装fastdfs
cd ../ wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz tar -zxf V5.05.tar.gz cd fastdfs-5.05/ ./make.sh ./make.sh install
三、配置fastdfs
1、配置fastdfs启动脚本
fastdfs安装完成后,会在/etc/init.d/下生成fdfs的启动脚本,但是脚本中fastdfs的安装路径不对(脚本中默认是/usr/local/bin,但实际安装路径是/usr/bin),所以需要对脚本进行如下处理:
sed -i 's#/usr/local/bin/#/usr/bin/#g' /etc/init.d/fdfs_storaged sed -i 's#/usr/local/bin/#/usr/bin/#g' /etc/init.d/fdfs_trackerd
2、编辑fastdfs的tracker配置文件
cd /etc/fdfs/ cp tracker.conf.sample tracker.conf vim tracker.conf [root@mylinux3 fdfs]# diff tracker.conf.sample tracker.conf 22c22 < base_path=/home/yuqing/fastdfs --- > base_path=/data/fdfs_tracker [root@mylinux3 fdfs]# scp tracker.conf 192.168.100.182:/etc/fdfs/ root@192.168.100.182's password: tracker.conf 100% 7100 6.9KB/s 00:00 [root@mylinux3 fdfs]# mkdir -p /data/fdfs_tracker [root@mylinux3 fdfs]# mkdir -p /data/fdfs_storage
3、编辑fastdfs的storage配置文件
cp storage.conf.sample storage.conf vi storage.conf [root@mylinux3 fdfs]# diff storage.conf.sample storage.conf 41c41 < base_path=/home/yuqing/fastdfs --- > base_path=/data/fdfs_storage/base 109c109 < store_path0=/home/yuqing/fastdfs --- > store_path0=/data/fdfs_storage/store 118c118,119 < tracker_server=192.168.209.121:22122 --- > tracker_server=192.168.100.181:22122 > tracker_server=192.168.100.182:22122 [root@mylinux3 fdfs]# scp storage.conf 192.168.100.182:/etc/fdfs/ root@192.168.100.182's password: storage.conf 100% 7873 7.7KB/s 00:00 [root@mylinux3 fdfs]# mkdir -p /data/fdfs_storage/{base,store}
4、启动fastdfs_tracker
[root@mylinux3 fdfs]# /etc/init.d/fdfs_trackerd start Starting FastDFS tracker server: [root@mylinux3 fdfs]# lsof -i :22122 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME fdfs_trac 2590 root 5u IPv4 38392 0t0 TCP *:22122 (LISTEN) [root@mylinux3 fdfs]# netstat -lnt|grep 22122 tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN [root@mylinux3 fdfs]# ps -ef|grep fdfs_trackerd root 2590 1 0 01:29 ? 00:00:03 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf root 2646 1804 0 01:42 pts/0 00:00:00 grep fdfs_trackerd
5、启动fastdfs_storage
[root@mylinux3 fdfs]# /etc/init.d/fdfs_storaged start Starting FastDFS storage server: [root@mylinux3 fdfs]# lsof -i :23000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME fdfs_stor 2607 root 5u IPv4 104300 0t0 TCP *:inovaport1 (LISTEN) fdfs_stor 2607 root 19u IPv4 105824 0t0 TCP 192.168.100.181:inovaport1->192.168.100.182:36456 (ESTABLISHED) fdfs_stor 2607 root 23u IPv4 105842 0t0 TCP 192.168.100.181:47300->192.168.100.182:inovaport1 (ESTABLISHED) [root@mylinux3 fdfs]# netstat -lnt|grep 23000 tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN [root@mylinux3 fdfs]# ps -ef|grep fdfs_storage root 2607 1 0 01:30 ? 00:00:01 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf root 2653 1804 0 01:43 pts/0 00:00:00 grep fdfs_storage
6、注意事项
1)group2同组的Storage2和Storage3 FastDFS服务端口必须一致: port=23000。
2)一台服务器可以装多个组(group)但不能装同组的多个Storage,日志会报错误,日志报错原因是"注意1"
3)Version 4.05之前fastdfs内部绑定了libevent作为http服务器.Version 4.05之后的版本删除了内置的web http服务,内置的web http服务是个累赘,不用也罢!
4)启动storage server时,一直处于僵死状态.启动storage server,storage将连接tracker server,如果连不上,将一直重试。直到连接成功,启动才算真正完成!如果集群中有2台tracker server,而其中一台tracker没有启动,可能会导致storage server一直处于僵死状态
四、配置fastdfs客户端
cd /etc/fdfs/ cp client.conf.sample client.conf vim client.conf [root@mylinux3 fdfs]# diff client.conf.sample client.conf 10c10 < base_path=/home/yuqing/fastdfs --- > base_path=/tmp 14c14,15 < tracker_server=192.168.0.197:22122 --- > tracker_server=192.168.100.181:22122 > tracker_server=192.168.100.182:22122
五、fdfs常用命令
1、文件上传命令fdfs_upload_file
用法:
[root@mylinux3 fdfs]# fdfs_upload_file --help
Usage: fdfs_upload_file <config_file> <local_filename> [storage_ip:port] [store_path_index]
下面上传一个文件测试:
[root@mylinux3 fdfs]# echo 'Hello,world.' >>/root/a.txt
[root@mylinux3 fdfs]# fdfs_upload_file /etc/fdfs/client.conf /root/a.txt
group1/M00/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
上传成功后,返回一串带有组和路径标识的字符串,这是文件的id,我们通过这个id在服务器上查找文件:
[root@mylinux3 store]# cd /data/fdfs_storage/store/data/
[root@mylinux3 data]# ls
00 0D 1A 27 34 41 4E 5B 68 75 82 8F 9C A9 B6 C3 D0 DD EA F7
01 0E 1B 28 35 42 4F 5C 69 76 83 90 9D AA B7 C4 D1 DE EB F8
02 0F 1C 29 36 43 50 5D 6A 77 84 91 9E AB B8 C5 D2 DF EC F9
03 10 1D 2A 37 44 51 5E 6B 78 85 92 9F AC B9 C6 D3 E0 ED FA
04 11 1E 2B 38 45 52 5F 6C 79 86 93 A0 AD BA C7 D4 E1 EE FB
05 12 1F 2C 39 46 53 60 6D 7A 87 94 A1 AE BB C8 D5 E2 EF FC
06 13 20 2D 3A 47 54 61 6E 7B 88 95 A2 AF BC C9 D6 E3 F0 FD
07 14 21 2E 3B 48 55 62 6F 7C 89 96 A3 B0 BD CA D7 E4 F1 FE
08 15 22 2F 3C 49 56 63 70 7D 8A 97 A4 B1 BE CB D8 E5 F2 FF
09 16 23 30 3D 4A 57 64 71 7E 8B 98 A5 B2 BF CC D9 E6 F3
0A 17 24 31 3E 4B 58 65 72 7F 8C 99 A6 B3 C0 CD DA E7 F4
0B 18 25 32 3F 4C 59 66 73 80 8D 9A A7 B4 C1 CE DB E8 F5
0C 19 26 33 40 4D 5A 67 74 81 8E 9B A8 B5 C2 CF DC E9 F6
[root@mylinux3 data]# cd 00/
[root@mylinux3 00]# ls
00 0D 1A 27 34 41 4E 5B 68 75 82 8F 9C A9 B6 C3 D0 DD EA F7
01 0E 1B 28 35 42 4F 5C 69 76 83 90 9D AA B7 C4 D1 DE EB F8
02 0F 1C 29 36 43 50 5D 6A 77 84 91 9E AB B8 C5 D2 DF EC F9
03 10 1D 2A 37 44 51 5E 6B 78 85 92 9F AC B9 C6 D3 E0 ED FA
04 11 1E 2B 38 45 52 5F 6C 79 86 93 A0 AD BA C7 D4 E1 EE FB
05 12 1F 2C 39 46 53 60 6D 7A 87 94 A1 AE BB C8 D5 E2 EF FC
06 13 20 2D 3A 47 54 61 6E 7B 88 95 A2 AF BC C9 D6 E3 F0 FD
07 14 21 2E 3B 48 55 62 6F 7C 89 96 A3 B0 BD CA D7 E4 F1 FE
08 15 22 2F 3C 49 56 63 70 7D 8A 97 A4 B1 BE CB D8 E5 F2 FF
09 16 23 30 3D 4A 57 64 71 7E 8B 98 A5 B2 BF CC D9 E6 F3
0A 17 24 31 3E 4B 58 65 72 7F 8C 99 A6 B3 C0 CD DA E7 F4
0B 18 25 32 3F 4C 59 66 73 80 8D 9A A7 B4 C1 CE DB E8 F5
0C 19 26 33 40 4D 5A 67 74 81 8E 9B A8 B5 C2 CF DC E9 F6
[root@mylinux3 00]# cd 00/
[root@mylinux3 00]# ll
total 4
-rw-r--r-- 1 root root 13 Oct 5 13:50 wKhktVf0lLOAMikbAAAADUwC04E360.txt
[root@mylinux3 00]# pwd
/data/fdfs_storage/store/data/00/00
[root@mylinux3 00]# cat wKhktVf0lLOAMikbAAAADUwC04E360.txt
Hello,world.
再来看一下文件在存储服务器上的位置:
[root@mylinux4 ~]# ll /data/fdfs_storage/store/data/00/00/
total 4
-rw-r--r-- 1 root root 13 Oct 5 13:50 wKhktVf0lLOAMikbAAAADUwC04E360.txt
[root@mylinux4 ~]# cat /data/fdfs_storage/store/data/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
Hello,world.
# 对文件进行校验,以便于后面进行比对
[root@mylinux3 00]# md5sum wKhktVf0lLOAMikbAAAADUwC04E360.txt
55517e093aa73dee11e6c57a5e980ace wKhktVf0lLOAMikbAAAADUwC04E360.txt
2、下载文件fdfs_download_file
用法:
[root@mylinux3 fdfs]# fdfs_download_file --help
Usage: fdfs_download_file <config_file> <file_id> [local_filename] [<download_offset> <download_bytes>]
这里下载一下刚刚上传的文件:
[root@mylinux3 fdfs]# fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt /tmp/a.txt
对下载后的文件进行校验:
[root@mylinux3 fdfs]# md5sum /tmp/a.txt
55517e093aa73dee11e6c57a5e980ace /tmp/a.txt
在mylinux4上对服务器上的文件也进行校验,可以看到所有的校验码都是一样的。
[root@mylinux4 ~]# md5sum /data/fdfs_storage/store/data/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
55517e093aa73dee11e6c57a5e980ace /data/fdfs_storage/store/data/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
3、查看文件信息fdfs_file_info
用法:
[root@mylinux3 fdfs]# fdfs_file_info --help
^[[6~Usage: fdfs_file_info <config_file> <file_id>
使用示例:
[root@mylinux3 fdfs]# fdfs_file_info /etc/fdfs/client.conf group1/M00/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
source storage id: 0
source ip address: 192.168.100.181
file create timestamp: 2016-10-05 13:50:43
file size: 13
file crc32: 1275253633 (0x4C02D381)
4、删除文件fdfs_delete_file
用法:
[root@mylinux3 fdfs]# fdfs_delete_file --help
Usage: fdfs_delete_file <config_file> <file_id>
使用示例:
[root@mylinux3 fdfs]# fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
删除之后没有信息提示,我们再进行下载和查找,结果如下:
[root@mylinux3 fdfs]# fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKhktVf0lLOAMikbAAAADUwC04E360.txt
[2016-10-05 14:08:17] ERROR - file: tracker_proto.c, line: 48, server: 192.168.100.182:23000, response status 2 != 0
download file fail, error no: 2, error info: No such file or directory
[root@mylinux3 fdfs]# ll /data/fdfs_storage/store/data/00/00
total 0
[root@mylinux4 ~]# ll /data/fdfs_storage/store/data/00/00
total 0
5、追加文件内容fdfs_upload_appender和fdfs_upload_appender
用法:
[root@mylinux3 fdfs]# fdfs_upload_appender --help
Usage: fdfs_upload_appender <config_file> <local_filename>
使用示例:
[root@mylinux3 fdfs]# echo "Hello" >/tmp/test1.txt
[root@mylinux3 fdfs]# fdfs_upload_appender /etc/fdfs/client.conf /tmp/test1.txt group1/M00/00/00/wKhktlf0mimEdYdtAAAAAI-wJ-k984.txt
[root@mylinux3 fdfs]# echo "World" >>/tmp/test2.txt
用法:
[root@mylinux3 fdfs]# fdfs_append_file --help
Usage: fdfs_append_file <config_file> <appender_file_id> <local_filename>
使用示例:
[root@mylinux3 fdfs]# fdfs_append_file /etc/fdfs/client.conf group1/M00/00/00/wKhktlf0mimEdYdtAAAAAI-wJ-k984.txt /tmp/test2.txt
下载文件并查看文件内容:
[root@mylinux3 fdfs]# fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKhktlf0mimEdYdtAAAAAI-wJ-k984.txt /tmp/test3.txt
[root@mylinux3 fdfs]# cat /tmp/test3.txt
Hello
World
6、监控服务器状态fdfs_monitor
用法:
[root@mylinux3 fdfs]# fdfs_monitor
Usage: fdfs_monitor <config_file> [-h <tracker_server>] [list|delete|set_trunk_server <group_name> [storage_id]]
使用示例:
[root@mylinux3 fdfs]# fdfs_monitor /etc/fdfs/client.conf
[2016-10-05 14:19:10] DEBUG - base_path=/tmp, connect_timeout=30, network_timeout=60, tracker_server_count=2, 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=2, server_index=1
tracker server is 192.168.100.182:22122
group count: 1
Group 1:
group name = group1
disk total space = 17944 MB
disk free space = 12998 MB
trunk free space = 0 MB
storage server count = 2
active server count = 2
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 192.168.100.181
ip_addr = 192.168.100.181 ACTIVE
http domain =
version = 5.05
join time = 2016-10-05 01:29:55
up time = 2016-10-05 13:43:44
total storage = 17944 MB
free storage = 12998 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 2
total_upload_count = 1
success_upload_count = 1
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 1
success_delete_count = 1
total_download_count = 2
success_download_count = 2
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 13
success_upload_bytes = 13
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 26
success_download_bytes = 26
total_sync_in_bytes = 12
success_sync_in_bytes = 12
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 5
success_file_open_count = 5
total_file_read_count = 2
success_file_read_count = 2
total_file_write_count = 3
success_file_write_count = 3
last_heart_beat_time = 2016-10-05 14:18:45
last_source_update = 2016-10-05 14:07:56
last_sync_update = 2016-10-05 14:15:17
last_synced_timestamp = 2016-10-05 14:15:14 (0s delay)
Storage 2:
id = 192.168.100.182
ip_addr = 192.168.100.182 ACTIVE
http domain =
version = 5.05
join time = 2016-10-05 01:31:26
up time = 2016-10-05 13:43:46
total storage = 18717 MB
free storage = 15808 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id = 192.168.100.181
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 2
total_upload_count = 1
success_upload_count = 1
total_append_count = 1
success_append_count = 1
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 2
success_download_count = 2
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 6
success_upload_bytes = 6
total_append_bytes = 6
success_append_bytes = 6
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 25
success_download_bytes = 25
total_sync_in_bytes = 13
success_sync_in_bytes = 13
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 5
success_file_open_count = 5
total_file_read_count = 2
success_file_read_count = 2
total_file_write_count = 3
success_file_write_count = 3
last_heart_beat_time = 2016-10-05 14:18:48
last_source_update = 2016-10-05 14:15:14
last_sync_update = 2016-10-05 14:08:05
last_synced_timestamp = 2016-10-05 14:07:56 (0s delay)
7、移除故障节点示例
假如节点2(mylinux4)上的fastdfs出了问题,我们需要将它从组中移除,可根据下面的命令操作:
1)停掉fastdfs上的storage服务
[root@mylinux4 ~]# /etc/init.d/fdfs_storaged stop
stopping fdfs_storaged ...
.
[root@mylinux4 ~]# lsof -i :23000
2)将问题节点(mylinux4)从组中移除
[root@mylinux3 fdfs]# fdfs_monitor /etc/fdfs/client.conf delete group1 192.168.100.182
[2016-10-05 14:23:59] DEBUG - base_path=/tmp, connect_timeout=30, network_timeout=60, tracker_server_count=2, 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=2, server_index=0
tracker server is 192.168.100.181:22122
delete storage server group1::192.168.100.182 success
3)移除成功,使用fdfs_monitor命令进行监控
[root@mylinux3 fdfs]# fdfs_monitor /etc/fdfs/client.conf
[2016-10-05 14:24:17] DEBUG - base_path=/tmp, connect_timeout=30, network_timeout=60, tracker_server_count=2, 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=2, server_index=1
tracker server is 192.168.100.182:22122
group count: 1
Group 1:
group name = group1
disk total space = 17944 MB
disk free space = 12998 MB
trunk free space = 0 MB
storage server count = 2
active server count = 1
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 192.168.100.181
ip_addr = 192.168.100.181 ACTIVE
http domain =
version = 5.05
join time = 2016-10-05 01:29:55
up time = 2016-10-05 13:43:44
total storage = 17944 MB
free storage = 12998 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 0
connection.max_count = 2
total_upload_count = 1
success_upload_count = 1
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 1
success_delete_count = 1
total_download_count = 2
success_download_count = 2
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 13
success_upload_bytes = 13
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 26
success_download_bytes = 26
total_sync_in_bytes = 12
success_sync_in_bytes = 12
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 5
success_file_open_count = 5
total_file_read_count = 2
success_file_read_count = 2
total_file_write_count = 3
success_file_write_count = 3
last_heart_beat_time = 2016-10-05 14:24:16
last_source_update = 2016-10-05 14:07:56
last_sync_update = 2016-10-05 14:15:17
last_synced_timestamp = 2016-10-05 14:15:14
Storage 2:
id = 192.168.100.182
ip_addr = 192.168.100.182 DELETED
http domain =
version = 5.05
join time = 2016-10-05 01:31:26
up time =
total storage = 0 MB
free storage = 0 MB
upload priority = 0
store_path_count = 0
subdir_count_per_path = 0
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 0
connection.current_count = 0
connection.max_count = 0
total_upload_count = 0
success_upload_count = 0
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 0
success_upload_bytes = 0
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 0
success_file_open_count = 0
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 0
success_file_write_count = 0
last_heart_beat_time = 1970-01-01 07:00:00
last_source_update = 1970-01-01 07:00:00
last_sync_update = 1970-01-01 07:00:00
last_synced_timestamp = 1970-01-01 07:00:00 (never synced)
移除之后,mylinux4的状态为DELETED。
当mylinux4上的fastdfs修复后,可以再把它加入到fastdfs组中,加入的操作只需要把mylinux4上的fastdfs服务正常启动就好,因为配置文件已经做了配置,如果服务正常的话,修复后的节点可以自动加入到fastdfs组中。
启动fastdfs_storaged服务
[root@mylinux4 ~]# /etc/init.d/fdfs_storaged start
Starting FastDFS storage server:
检查监听端口状态:
[root@mylinux4 ~]# lsof -i :23000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
fdfs_stor 1222 root 5u IPv4 10873 0t0 TCP *:inovaport1 (LISTEN)
fdfs_stor 1222 root 22u IPv4 10885 0t0 TCP www.mylinux4.com:41728->192.168.100.181:inovaport1 (ESTABLISHED)
再次使用监控命令查看服务器状态:
[root@mylinux3 fdfs]# fdfs_monitor /etc/fdfs/client.conf
[2016-10-05 14:25:23] DEBUG - base_path=/tmp, connect_timeout=30, network_timeout=60, tracker_server_count=2, 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=2, server_index=0
tracker server is 192.168.100.181:22122
group count: 1
Group 1:
group name = group1
disk total space = 17944 MB
disk free space = 12998 MB
trunk free space = 0 MB
storage server count = 2
active server count = 2
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 192.168.100.181
ip_addr = 192.168.100.181 ACTIVE
http domain =
version = 5.05
join time = 2016-10-05 01:29:55
up time = 2016-10-05 13:43:44
total storage = 17944 MB
free storage = 12998 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 2
total_upload_count = 1
success_upload_count = 1
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 1
success_delete_count = 1
total_download_count = 2
success_download_count = 2
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 13
success_upload_bytes = 13
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 26
success_download_bytes = 26
total_sync_in_bytes = 12
success_sync_in_bytes = 12
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 5
success_file_open_count = 5
total_file_read_count = 2
success_file_read_count = 2
total_file_write_count = 3
success_file_write_count = 3
last_heart_beat_time = 2016-10-05 14:25:14
last_source_update = 2016-10-05 14:07:56
last_sync_update = 2016-10-05 14:15:17
last_synced_timestamp = 2016-10-05 14:15:14 (0s delay)
Storage 2:
id = 192.168.100.182
ip_addr = 192.168.100.182 ACTIVE
http domain =
version = 5.05
join time = 2016-10-05 01:31:26
up time = 2016-10-05 14:24:52
total storage = 18717 MB
free storage = 15808 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id = 192.168.100.181
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 0
connection.max_count = 0
total_upload_count = 1
success_upload_count = 1
total_append_count = 1
success_append_count = 1
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 2
success_download_count = 2
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 6
success_upload_bytes = 6
total_append_bytes = 6
success_append_bytes = 6
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 25
success_download_bytes = 25
total_sync_in_bytes = 13
success_sync_in_bytes = 13
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 5
success_file_open_count = 5
total_file_read_count = 2
success_file_read_count = 2
total_file_write_count = 3
success_file_write_count = 3
last_heart_beat_time = 2016-10-05 14:25:22
last_source_update = 2016-10-05 14:15:14
last_sync_update = 2016-10-05 14:08:05
last_synced_timestamp = 1970-01-01 07:00:00 (never synced)
可以看到,此时mylinux4已经变为ACTIVE状态了。