免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6172 | 回复: 0
打印 上一主题 下一主题

[FastDFS] 开启fastdfs的双机备份时,storage如何能有主从区别 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2017-12-29 16:21 |只看该作者 |倒序浏览
本帖最后由 wangping1213 于 2017-12-29 16:35 编辑

我的fastdfs中配置了双机备份,分别部署在172.16.0.112,172.16.0.114,其中tracker和storage分别为两台,各自配置如下:
两个tracker.conf配置:
  1. disabled=false
  2. bind_addr=
  3. port=22122

  4. base_path=/root/fdfs/tracker
  5. store_group=group2

  6. store_server=0

  7. store_path=2
复制代码

两个storage.conf配置:
  1. disabled=false

  2. group_name=group1

  3. base_path=/root/fdfs/storage
  4. store_path_count=2

  5. store_path0=/root/fdfs/file0
  6. store_path1=/root/fdfs/file1

  7. tracker_server=172.16.0.112:22122
  8. tracker_server=172.16.0.114:22122

  9. file_distribute_path_mode=1
复制代码

两个mod_fastdfs.conf配置:
  1. base_path=/tmp
  2. storage_server_port=23000

  3. group_name=group1

  4. url_have_group_name = false

  5. store_path_count=2

  6. store_path0=/root/fdfs/file0
  7. store_path1=/root/fdfs/file1
  8. tracker_server=172.16.0.112:22122
  9. tracker_server=172.16.0.114:22122
复制代码

执行命令fdfs_monitor /etc/fdfs/storage.conf如下(两个storage都是Active):
  1. DEBUG - base_path=/root/fdfs/storage, 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

  2. server_count=2, server_index=1

  3. tracker server is 172.16.0.114:22122

  4. group count: 1

  5. Group 1:
  6. group name = group1
  7. disk total space = 1019600 MB
  8. disk free space = 549952 MB
  9. trunk free space = 0 MB
  10. storage server count = 2
  11. active server count = 2
  12. storage server port = 23000
  13. storage HTTP port = 8888
  14. store path count = 2
  15. subdir count per path = 256
  16. current write server index = 0
  17. current trunk file id = 0

  18.         Storage 1:
  19.                 id = 172.16.0.112
  20.                 ip_addr = 172.16.0.112 (hsn112)  ACTIVE
  21.                 http domain =
  22.                 version = 5.04
  23.                 join time = 2017-07-08 22:24:27
  24.                 up time = 2017-12-29 15:59:51
  25.                 total storage = 1019600 MB
  26.                 free storage = 549952 MB
  27.                 upload priority = 10
  28.                 store_path_count = 2
  29.                 subdir_count_per_path = 256
  30.                 storage_port = 23000
  31.                 storage_http_port = 8888
  32.                 current_write_path = 1
  33.                 source storage id =
  34.                 if_trunk_server = 0
  35.                 connection.alloc_count = 256
  36.                 connection.current_count = 0
  37.                 connection.max_count = 0
  38.                 total_upload_count = 161789
  39.                 success_upload_count = 161789
  40.                 total_append_count = 136
  41.                 success_append_count = 136
  42.                 total_modify_count = 4
  43.                 success_modify_count = 4
  44.                 total_truncate_count = 2
  45.                 success_truncate_count = 2
  46.                 total_set_meta_count = 18
  47.                 success_set_meta_count = 18
  48.                 total_delete_count = 709
  49.                 success_delete_count = 709
  50.                 total_download_count = 6
  51.                 success_download_count = 6
  52.                 total_get_meta_count = 0
  53.                 success_get_meta_count = 0
  54.                 total_create_link_count = 0
  55.                 success_create_link_count = 0
  56.                 total_delete_link_count = 0
  57.                 success_delete_link_count = 0
  58.                 total_upload_bytes = 41283553852
  59.                 success_upload_bytes = 41283553852
  60.                 total_append_bytes = 11122718
  61.                 success_append_bytes = 11122718
  62.                 total_modify_bytes = 122
  63.                 success_modify_bytes = 122
  64.                 stotal_download_bytes = 411383
  65.                 success_download_bytes = 411383
  66.                 total_sync_in_bytes = 1836170525
  67.                 success_sync_in_bytes = 1836170525
  68.                 total_sync_out_bytes = 0
  69.                 success_sync_out_bytes = 0
  70.                 total_file_open_count = 163597
  71.                 success_file_open_count = 163597
  72.                 total_file_read_count = 6
  73.                 success_file_read_count = 6
  74.                 total_file_write_count = 292975
  75.                 success_file_write_count = 292975
  76.                 last_heart_beat_time = 2017-12-29 16:00:29
  77.                 last_source_update = 2017-12-29 15:52:44
  78.                 last_sync_update = 2017-12-29 15:58:54
  79.                 last_synced_timestamp = 2017-12-29 15:59:25 (0s delay)
  80.         Storage 2:
  81.                 id = 172.16.0.114
  82.                 ip_addr = 172.16.0.114 (localhost)  ACTIVE
  83.                 http domain =
  84.                 version = 5.04
  85.                 join time = 2017-06-13 17:18:54
  86.                 up time = 2017-12-29 16:00:03
  87.                 total storage = 1019344 MB
  88.                 free storage = 837218 MB
  89.                 upload priority = 10
  90.                 store_path_count = 2
  91.                 subdir_count_per_path = 256
  92.                 storage_port = 23000
  93.                 storage_http_port = 8888
  94.                 current_write_path = 1
  95.                 source storage id =
  96.                 if_trunk_server = 0
  97.                 connection.alloc_count = 256
  98.                 connection.current_count = 1
  99.                 connection.max_count = 1
  100.                 total_upload_count = 1661
  101.                 success_upload_count = 1661
  102.                 total_append_count = 0
  103.                 success_append_count = 0
  104.                 total_modify_count = 0
  105.                 success_modify_count = 0
  106.                 total_truncate_count = 0
  107.                 success_truncate_count = 0
  108.                 total_set_meta_count = 8
  109.                 success_set_meta_count = 8
  110.                 total_delete_count = 48
  111.                 success_delete_count = 48
  112.                 total_download_count = 0
  113.                 success_download_count = 0
  114.                 total_get_meta_count = 0
  115.                 success_get_meta_count = 0
  116.                 total_create_link_count = 0
  117.                 success_create_link_count = 0
  118.                 total_delete_link_count = 0
  119.                 success_delete_link_count = 0
  120.                 total_upload_bytes = 1837672341
  121.                 success_upload_bytes = 1837672341
  122.                 total_append_bytes = 0
  123.                 success_append_bytes = 0
  124.                 total_modify_bytes = 0
  125.                 success_modify_bytes = 0
  126.                 stotal_download_bytes = 0
  127.                 success_download_bytes = 0
  128.                 total_sync_in_bytes = 39558938462
  129.                 success_sync_in_bytes = 39549332780
  130.                 total_sync_out_bytes = 0
  131.                 success_sync_out_bytes = 0
  132.                 total_file_open_count = 162810
  133.                 success_file_open_count = 162810
  134.                 total_file_read_count = 0
  135.                 success_file_read_count = 0
  136.                 total_file_write_count = 285795
  137.                 success_file_write_count = 285795
  138.                 last_heart_beat_time = 2017-12-29 16:00:34
  139.                 last_source_update = 2017-12-29 15:59:25
  140.                 last_sync_update = 2017-12-29 15:53:28
  141.                 last_synced_timestamp = 2017-12-29 15:52:44 (0s delay)
复制代码
但是在java客户端中加入主从文件时(格式如下):
  1. http://172.16.0.112/M00/00/10/rBAAclpFt5mAV7mpAAcWEvcU_U4615.png
  2. http://172.16.0.112/M00/00/10/rBAAclpFt5mAV7mpAAcWEvcU_U4615_thumb.png
  3. http://172.16.0.112/M00/00/10/rBAAclpFt5mAV7mpAAcWEvcU_U4615_preview.png
复制代码

在172.16.0.114上storage的错误日志为(有时候实在172.16.0.112上storage的错误日志文件出现的):
  1. ERROR - file: storage_service.c, line: 5271, client ip: 192.168.3.10, stat logic file M00/00/10/rBAAclpFt5mAV7mpAAcWEvcU.png fail, errno: 2, error info: No such file or directory.
复制代码
我猜测是因为两台storage服务器没有主从区别是随机的缘故,但是我在storage.conf文件加入了file_distribute_path_mode=1,但是貌似还是没用呢,各位大大能帮忙看看不


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP