fastdfs单主机配置多个storage

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
disabled = false
group_name = group1
bind_addr = 172.1 . 1.1
client_bind = true
port = 23000
connect_timeout = 30
network_timeout = 60
heart_beat_interval = 30
stat_report_interval = 60
base_path = / data / fastdfs
max_connections = 256
buff_size  =  256KB
accept_threads = 1
work_threads = 4
disk_rw_separated  =  true
disk_reader_threads  =  1
disk_writer_threads  =  1
sync_wait_msec = 50
sync_interval = 0
sync_start_time = 00 : 00
sync_end_time = 23 : 59
write_mark_file_freq = 500
store_path_count = 1
store_path0 = / data / fastdfs
subdir_count_per_path = 256
tracker_server = 172.1 . 1.2 : 22122
log_level = info
run_by_group =
run_by_user =
allow_hosts = *
file_distribute_path_mode = 0
file_distribute_rotate_count = 100
fsync_after_written_bytes = 0
sync_log_buff_interval = 10
sync_binlog_buff_interval = 10
sync_stat_file_interval = 300
thread_stack_size = 512KB
upload_priority = 10
if_alias_prefix =
check_file_duplicate = 0
file_signature_method = hash
key_namespace = FastDFS
keep_alive = 0
use_access_log  =  false
rotate_access_log  =  false
access_log_rotate_time = 00 : 00
rotate_error_log  =  false
error_log_rotate_time = 00 : 00
rotate_access_log_size  =  0
rotate_error_log_size  =  0
log_file_keep_days  =  0
file_sync_skip_invalid_record = false
use_connection_pool  =  false
connection_pool_max_idle_time  =  3600
http.domain_name =
http.server_port = 8888






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
disabled = false
group_name = groupuser2
bind_addr = 172.1 . 1.1
client_bind = true
port = 23001
connect_timeout = 30
network_timeout = 60
heart_beat_interval = 30
stat_report_interval = 60
base_path = / data / groupuser2
max_connections = 256
buff_size  =  256KB
accept_threads = 1
work_threads = 4
disk_rw_separated  =  true
disk_reader_threads  =  1
disk_writer_threads  =  1
sync_wait_msec = 50
sync_interval = 0
sync_start_time = 00 : 00
sync_end_time = 23 : 59
write_mark_file_freq = 500
store_path_count = 1
store_path0 = / data / groupuser2
subdir_count_per_path = 256
tracker_server = 172.1 . 1.2 : 22122
log_level = info
run_by_group =
run_by_user =
allow_hosts = *
file_distribute_path_mode = 0
file_distribute_rotate_count = 100
fsync_after_written_bytes = 0
sync_log_buff_interval = 10
sync_binlog_buff_interval = 10
sync_stat_file_interval = 300
thread_stack_size = 512KB
upload_priority = 10
if_alias_prefix =
check_file_duplicate = 0
file_signature_method = hash
key_namespace = FastDFS
keep_alive = 0
use_access_log  =  false
rotate_access_log  =  false
access_log_rotate_time = 00 : 00
rotate_error_log  =  false
error_log_rotate_time = 00 : 00
rotate_access_log_size  =  0
rotate_error_log_size  =  0
log_file_keep_days  =  0
file_sync_skip_invalid_record = false
use_connection_pool  =  false
connection_pool_max_idle_time  =  3600
http.domain_name =
http.server_port = 8889


1
2
3
4
5
6
7
cat config
ngx_addon_name = ngx_http_fastdfs_module
HTTP_MODULES = "$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS = "$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS = "$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS = "$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"
CFLAGS = "$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cat mod_fastdfs.conf
#include http.conf
connect_timeout = 2
network_timeout = 30
storage_sync_file_max_delay  =  86400
tracker_server = 172.1 . 1.2 : 22122
load_fdfs_parameters_from_tracker = true
log_level = info
log_filename = / var / log / tengine / mod.log
url_have_group_name = true
response_mode = redirect
if_alias_prefix =
flv_support  =  true
flv_extension  =  flv
group_count  =  5
[group1]
group_name = group1
storage_server_port = 172.1 . 1.1 : 23000
store_path_count = 1
store_path0 = / data / fastdfs
base_path = / data / fastdfs
[group2]
group_name = groupuser2
storage_server_port = 172.1 . 1.1 : 23001
store_path_count = 1
store_path0 = / data / groupuser2
base_path = / data / groupuser2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
nginx
server {
   listen  8080 ;
   server_name  172.1 . 1.1 ;
   access_log       / var / log / tengine / test_access.log;
   error_log        / var / log / tengine / test_error.log;
   location  / lua {
      default_type  'text/plain' ;
      content_by_lua  'ngx.say("hello,lua")' ;
      }
   location ~ *  / group1 / M00 /   {
       ngx_fastdfs_module;
       set  $needCreateImg  0 ;
       if  ( ! - f $request_filename) {
          set  $needCreateImg  "${needCreateImg}1" ;
       }
 
      if  ($uri ~ *  "/group1/M00/(\d+)/(\d+)/([A-Za-z0-9_-]+).(gif|jpg|jpeg|png).(\d+x\d+).(gif|jpg|jpeg|png)" ) {
          set  $needCreateImg  "${needCreateImg}2" ;
          set  $conUri      "/$1/$2/$3.$4.$5.$6" ;
       }
 
       if  ($needCreateImg  =  "012" ) {
          set  $image_root  "/data/fastdfs/data" ;
          set  $ file  "$image_root$conUri" ;
             rewrite_by_lua '
                local index  =  string.find(ngx.var.conUri,  "([0-9]+)x([0-9]+)" );
                local originalUri  =  string.sub(ngx.var.conUri,  0 , index - 2 );
                local area  =  string.sub(ngx.var.conUri, index);
                index  =  string.find(area,  "([.])" );
                area  =  string.sub(area,  0 , index - 1 );
 
                function table.contains(table, element)
                  for  _, value  in  pairs(table) do                 
                    if  value  = =  element then
                      return  true
                    end
                   end
                   return  false
                 end
 
                 local c  =  "/usr/local/graphicsmagick/bin/gm convert "  .. ngx.var.image_root ..  originalUri  ..  " -thumbnail "  .. area ..  " - " ;
                 local f  =  assert (io.popen(c,  "r" ))
                 local s  =  assert (f:read( "*a" ))
                 f:close()
                 ngx.say(s) ';
               }
            alias  / data / fastdfs / data / ;
         }
}

再搞个8081就行了。


访问400的错误

http://bbs.chinaunix.net/thread-4120027-1-1.html

wKiom1mj6XKA2uabAACOzxaAqeI992.png


java实现FastDFS实现文件上传下载实战


http://blog.csdn.net/liweizhong193516/article/details/53244134


原理http://bbs.chinaunix.net/thread-4068654-2-1.html


wKioL1mk3viitZAyAAFrZebCuVQ746.png


经过测试,发现redirect模式有问题,header already sent,所以正确还是Proxy模式。


缩略图

"/usr/local/graphicsmagick/bin/gm convert "

or

"/usr/local/ImageMagick/bin/convert "




本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1960255,如需转载请自行联系原作者
相关文章
|
存储 负载均衡 监控
keepalived实现双vip部署
keepalived实现双vip部署
1260 1
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
4058 1
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
存储 人工智能 运维
2025开年AI王炸组合:Deepseek + Zabbix = 监控界“钢铁侠”
2025年,AI技术迎来爆发,中国黑马Deepseek以“硬核战斗力”登顶热搜,预判智能家居、降低自动驾驶事故率、挑战医疗诊断新高度,被誉为“人类外挂”。与此同时,Zabbix结合AI,推出智能运维助手,极大提升运维效率。Zabbix与Deepseek联手发起“脑洞大赛”,万元奖励等你来拿。未来,不懂AI的运维或将被淘汰,立即行动,成为监控界的“天选打工人”! 简介:2025年,AI技术全面革新,Deepseek和Zabbix引领智能运维新潮流,提供高效解决方案并发起创意大赛,助力运维人员掌握未来技能。
885 0
2025开年AI王炸组合:Deepseek + Zabbix = 监控界“钢铁侠”
|
SQL 关系型数据库 MySQL
【MySQL数据库】SQL查询语句总结
【MySQL数据库】SQL查询语句总结
1092 0
|
存储 JSON Kubernetes
kubernetes为何需要默认的serviceaccount?
在 Kubernetes 中,ServiceAccount 是一种用于身份验证和授权的对象。它为 Pod 提供了一种身份,以便它们可以与 Kubernetes API 交互,并且可以通过 Role 和 RoleBinding 为它们分配特定的权限。
1092 0
|
Java Apache
Java 使用word模板创建word文档报告教程
Java 使用word模板创建word文档报告教程
1332 0
Java 使用word模板创建word文档报告教程
|
机器学习/深度学习 人工智能 运维
智能化运维:AI驱动下的IT运维革命###
本文探讨了人工智能(AI)技术在IT运维领域的创新应用,强调其在提升效率、预防故障及优化资源配置中的关键作用,揭示了智能运维的新趋势。 ###
|
Java 应用服务中间件 Apache
认识Tomcat的日志:catalina.out、localhost、manager、localhost_access_log
认识Tomcat的日志:catalina.out、localhost、manager、localhost_access_log
|
Java API Spring
Springfox Swagger2从入门到精通
本文详细介绍了如何使用Springfox Swagger2在Spring Boot项目中生成API文档,包括引入依赖、配置Swagger2、启用Swagger2、编写API文档注释、访问Swagger UI以及常用注解分析和高级配置。
1834 0
Springfox Swagger2从入门到精通

热门文章

最新文章