whosyourdaday 发表于 2014-05-27 14:19

求教贴,关于 外网 访问fastDFS的问题

本帖最后由 whosyourdaday 于 2014-05-30 16:42 编辑

小弟初来咋到,向众大神请教一个问题:

前几日,小弟开始学习配置 FastDFS( fastDFS 5.01 )。 使用 内网 IP 地址 测试一切正常。

结构如下:
tracker(1台)(内网:192.168.11.24   外网:58.215.xxx.xx1)

storage1(内网:192.168.11.242    外网:58.215.xxx.xx2)
storage2 (内网:192.168.11.244    外网:58.215.xxx.xx3)
(这2台 storage 配置成 一个 group)

后来,改用外网 ip 地址测试( 即将 两台storage中的 storage.conf 中的 tracker_server 设置为 58.215.176.134:22122)出现问题。
停止程序,删除 /data/storage 以及 /data/tracker 下的数据后,重新启动程序。
使用 fdfs_monitor /etc/fdfs/storage.conf 查看状态,
发现 两台 storage 中 一台为 ACTIVE, 另一台 的状态 一直 为WAIT_SYNC。 数据无法同步。(将防火墙关闭后依然如此)


1. 查看tracker 日志如下:
$vim /data/tracker/logs/trackerd.log

INFO - FastDFS v5.01, base_path=/data/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeo
ut=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1, work_threads=4, store_lookup=2, store_group=, store_server=0,
store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interva
l=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=30
0s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_
time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init
_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_er
ror_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, store_slave_file_use_link=0, use_connection_pool=0, g_connection_po
ol_max_idle_time=3600s
INFO - local_host_ip_count: 2,127.0.0.1192.168.11.24
INFO - file: tracker_relationship.c, line: 383, selecting leader...
INFO - file: tracker_relationship.c, line: 383, selecting leader...
....
....
INFO - file: tracker_relationship.c, line: 383, selecting leader...
....
....
(此次为何 找不到 leader???????)


$netstat -unltap| grep dfs
tcp      0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      9982/fdfs_trackerd
tcp      0      0 192.168.11.24:22122         58.215.176.230:39965      ESTABLISHED 9982/fdfs_trackerd
tcp      0      0 192.168.11.24:22122         58.215.187.148:36695      ESTABLISHED 9982/fdfs_trackerd

2. 查看storage 1 的 日志信息如下:
INFO - FastDFS v5.01, base_path=/data/storage, store_path_count=1, subdir_count_per_pa
th=256, group_name=group1, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=23000
, bind_addr=, client_bind=1, max_connections=256, accept_threads=1, work_threads=4, disk_rw_separated=1, dis
k_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60
s, tracker_server_count=1, sync_wait_msec=50ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:5
9, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=10
0, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=10s, sync_stat_file_in
terval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, file_si
gnature_method=hash, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP s
erver port=8888, domain name=, use_access_log=0, rotate_access_log=0, access_log_rotate_time=00:00, rotate_e
rror_log=0, error_log_rotate_time=00:00, rotate_access_log_size=0, rotate_error_log_size=0, file_sync_skip_i
nvalid_record=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
INFO - file: storage_param_getter.c, line: 191, use_storage_id=0, id_type_in_filename=
ip, storage_ip_changed_auto_adjust=1, store_path=0, reserved_storage_space=10.00%, use_trunk_file=0, slot_mi
n_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_
base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occu
pying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, store_slave_file_use_link=0
INFO - file: storage_func.c, line: 175, tracker_client_ip: 192.168.11.242, my_server_i
d_str: 192.168.11.242, g_server_id_in_filename: -234116928
INFO - local_host_ip_count: 2,127.0.0.1192.168.11.242
INFO - file: tracker_client_thread.c, line: 308, successfully connect to tracker serve
r 58.215.176.134:22122, as a tracker client, my ip is 192.168.11.242
INFO - file: storage_sync.c, line: 2698, successfully connect to storage server 58.215
.176.230:23000


$netstat -unltap|grep dfs
tcp      0      0 0.0.0.0:23000               0.0.0.0:*                   LISTEN      16738/fdfs_storaged
tcp      0      0 192.168.11.242:23000      58.215.187.148:58204      ESTABLISHED 16738/fdfs_storaged
tcp      0      0 192.168.11.242:39965      58.215.176.134:22122      ESTABLISHED 16738/fdfs_storaged
tcp      0      0 192.168.11.242:23000      58.215.176.230:37424      ESTABLISHED 16738/fdfs_storaged
tcp      0      0 192.168.11.242:37424      58.215.176.230:23000      ESTABLISHED 16738/fdfs_storaged
tcp      1      0 192.168.11.242:39020      58.215.187.148:23000      CLOSE_WAIT16738/fdfs_storaged( 此处为何为CLOSE_WAIT ????? )


3. 查看 storage 2 的日子信息如下:
INFO - FastDFS v5.01, base_path=/data/storage, store_path_count=1, subdir_count_per_path=256, group_name=group
1, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256
, accept_threads=1, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_i
nterval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=50ms, sync_interval=0ms, sync_start_time=00:00, sync_e
nd_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_aft
er_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=10s, sync_stat_file_interval=300s, thread_stack_size=512 K
B, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, file_signature_method=hash, FDHT group count=0, FDHT server count=0
, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=, use_access_log=0, rotate_access_log=0, access_log_rot
ate_time=00:00, rotate_error_log=0, error_log_rotate_time=00:00, rotate_access_log_size=0, rotate_error_log_size=0, file_sync_skip_i
nvalid_record=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
INFO - file: storage_param_getter.c, line: 191, use_storage_id=0, id_type_in_filename=ip, storage_ip_changed_a
uto_adjust=1, store_path=0, reserved_storage_space=10.00%, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size
=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_th
reshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, store_slave_file
_use_link=0
INFO - file: storage_func.c, line: 175, tracker_client_ip: 192.168.11.244, my_server_id_str: 192.168.11.244, g
_server_id_in_filename: -200562496
DEBUG - file: storage_ip_changed_dealer.c, line: 235, last my ip is , current my ip is 192.168.11.244
INFO - local_host_ip_count: 2,127.0.0.1192.168.11.244
DEBUG - file: ../common/fast_task_queue.c, line: 198, max_connections: 256, min_buff_size: 262144, max_buff_si
ze: 262144, block_size: 263280, arg_size: 1008, max_data_size: 268435456, total_size: 67399680
DEBUG - file: ../common/fast_task_queue.c, line: 264, malloc task info as whole: 1, malloc loop count: 1
DEBUG - file: tracker_client_thread.c, line: 223, report thread to tracker server 58.215.176.134:22122 started
INFO - file: tracker_client_thread.c, line: 308, successfully connect to tracker server 58.215.176.134:22122,
as a tracker client, my ip is 192.168.11.244
DEBUG - file: storage_sync.c, line: 2605, sync thread to storage server 58.215.187.148:23000 started
DEBUG - file: storage_sync.c, line: 2605, sync thread to storage server 58.215.176.230:23000 started
INFO - file: storage_sync.c, line: 2698, successfully connect to storage server 58.215.187.148:23000
INFO - file: storage_sync.c, line: 2698, successfully connect to storage server 58.215.176.230:23000


$netstat -unltap| grep dfs
tcp      0      0 0.0.0.0:23000               0.0.0.0:*                   LISTEN      25482/fdfs_storaged
tcp      0      0 192.168.11.244:36695      58.215.176.134:22122      ESTABLISHED 25482/fdfs_storaged
tcp      1      0 192.168.11.244:36126      58.215.187.148:23000      CLOSE_WAIT25482/fdfs_storaged
tcp      0      0 192.168.11.244:58204      58.215.176.230:23000      ESTABLISHED 25482/fdfs_storaged


4. 使用 fdfs_monitor /etc/fdfs/storage.conf查看的完整信息如下
$fdfs_monitor /etc/fdfs/storage.conf
DEBUG - base_path=/data/storage, 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 58.215.176.134:22122

group count: 1

Group 1:
group name = group1
disk total space = 11087 MB
disk free space = 10111 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 = 58.215.176.230
                ip_addr = 58.215.176.230ACTIVE
                http domain =
                version = 5.01
                join time = 2014-05-27 13:59:33
                up time = 2014-05-27 13:59:33
                total storage = 11087 MB
                free storage = 10111 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
                total_upload_count = 33
                success_upload_count = 33
                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 = 429
                success_upload_bytes = 429
                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 = 2983
                success_sync_in_bytes = 0
                total_sync_out_bytes = 13
                success_sync_out_bytes = 0
                total_file_open_count = 33
                success_file_open_count = 33
                total_file_read_count = 0
                success_file_read_count = 0
                total_file_write_count = 33
                success_file_write_count = 33
                last_heart_beat_time = 2014-05-27 14:05:48
                last_source_update = 2014-05-27 14:05:34
                last_sync_update = 2014-05-27 14:05:42
                last_synced_timestamp = 1970-01-01 08:00:00
      Storage 2:
                id = 58.215.187.148
                ip_addr = 58.215.187.148WAIT_SYNC
                http domain =
                version = 5.01
                join time = 2014-05-27 14:00:57
                up time = 2014-05-27 14:00:57
                total storage = 11087 MB
                free storage = 10111 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= 58.215.176.230
                if_trunk_server= 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 = 2014-05-27 14:05:36
                last_source_update = 1970-01-01 08:00:00
                last_sync_update = 1970-01-01 08:00:00
                last_synced_timestamp = 1970-01-01 08:00:00 (never synced)

jarlean 发表于 2014-06-16 14:20

请教下,你怎么把storage的IP配置成外网IP的。

xucong0701 发表于 2015-01-15 10:46

LZ后来问题解决了吗?外网部署的实践论坛上感觉比较少
页: [1]
查看完整版本: 求教贴,关于 外网 访问fastDFS的问题