StorageServer优先级的问题
安装的是2.08版。
group1里有两台storage server,我想设定server1为默认源server,采用的是优先级的方法。
tracker server中设定优先级方式,然后storage server1的优先级为5,storage server2的优先级为10,这样设定有问题吗?
测试中发现,有时候group1的源server还是会轮询,连续读取的时候会取不到文件。
server的配置:
tracker1:
[2011-03-08 18:22:58] INFO - FastDFS v2.08, base_path=/home/fastdfs/tracker, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, work_threads=4, store_lookup=2, store_group=, store_server=2, store_path=0, reserved_storage_space=5120MB, download_server=1, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s
tracker2:
[2011-03-08 10:24:57] INFO - FastDFS v2.08, base_path=/home/fastdfs/tracker, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, work_threads=4, store_lookup=2, store_group=, store_server=2, store_path=0, reserved_storage_space=5120MB, download_server=1, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s
group1,storage1:
[2011-03-08 10:24:07] INFO - FastDFS v2.08, base_path=/home/fastdfs/storage, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=2, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=5, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
group1,storage2:
[2011-03-05 10:25:55] INFO - FastDFS v2.08, base_path=/home/fastdfs/storage, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=2, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
回复 9# happy_fish100
啊...
很有可能,我都没注意这个,谢谢,我check一下
回复 8# pealdoy
会不会是几台服务器的系统时间相差比较大造成的?
你确认一下系统时间是否基本一致?
本帖最后由 pealdoy 于 2011-03-10 09:37 编辑
回复 7# happy_fish100
2.08的呀,分了两个group,group1里有两个storage server,1和2。
部署的时候是用1当源的,但是我在测试的时候,文件有时候会存到2上去。
几率还是蛮大的,5次测试里总会碰到1次。
出错时候打出来的log:
storage server1:10.1.9.193
storage server2:10.1.9.194
上传:
upload, storage server:/10.1.9.194:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:71 - upload success. file id is: group1/M00/00/01/CgEJwk10NkuxAshVAACI-zp2apw349.txt. costs 30ms
下面4次用的是这个方法:public byte[] download_file1(String file_id)
download, storage server:/10.1.9.194:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:78 - 1, download result is: [B@1b8e059, costs 5ms
download, storage server:/10.1.9.193:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:78 - 2, download result is: null, costs 0ms
download, storage server:/10.1.9.194:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:78 - 3, download result is: [B@910040, costs 5ms
download, storage server:/10.1.9.193:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:78 - 4, download result is: null, costs 195ms
下面4次用的是这个方法:public int download_file1(String file_id, String local_filename)
download, storage server:/10.1.9.194:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:85 - 1, download result is: 0, costs 5ms
download, storage server:/10.1.9.193:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:85 - 2, download result is: 2, costs 5ms
download, storage server:/10.1.9.194:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:85 - 3, download result is: 0, costs 5ms
download, storage server:/10.1.9.193:23000, tracker server:/10.1.9.192:22122
09:35:18 INFO [fastdfs] Test:85 - 4, download result is: 2, costs 0ms
那我再检查一下服务器的配置吧
回复 6# happy_fish100
FastDFS server端是什么版本?
为啥我用你给出的代码做了测试,完全正常的呢?
回复 5# pealdoy
谢谢!
我抽空用这段代码测试一下。
回复 4# happy_fish100
只是一个文件上传下载的测试:
复制代码当文件被上传到server2的时候,while里面就会轮询server2和server1,因为是刚刚上传,server1里面应该还没有文件。
还说是我每次调用之前都要从tracker server开始重新连接?
回复 3# pealdoy
方便贴一下相应的代码么?
回复 2# happy_fish100
谢谢
直接指定了storage server是什么意思?
我是直接调用的Java api中的
public byte[] download_file1(String file_id)
剩下的应该都是Java api中的代码吧?
里面会自动去找storage server的不是么?用这个newReadableStorageConnection
出现的读取错误是:
当把storage server2作为源sever的时候,
第一次取文件会从server2上下载,正常,
但是连续的第二次取会变成server1,没有文件,
第三次又会变成server2,以此轮询...
回复 1# pealdoy
>>测试中发现,有时候group1的源server还是会轮询
这个是程序bug,最新版本已经修复了。
>>连续读取的时候会取不到文件。
需要通过标准下载文件流程来获取文件,即先询问tracker server。
下载文件时,怀疑你直接指定了storage server。