fastdfs单主机配置多个storage 第二版

关于FastDFS蛋疼的集群和负载均衡(八)之总结FastDFS cmazxiaoma

问题1
1.是配置/root/soft/fastdfs-nginx-module/src/mod_fastdfs.conf 还是/etc/fdfs/mod_fastdfs.conf下面的?

2.多个组,必须以group1,group2命名

3.尤其storage的nginx启动一定要看启动日志,最多的配置问题会出现在这里

fdfs注意事项

附录:

在整个环境搭建过程中遇到一些问题,在此提交分享,供大家参考。

1、 在Storage服务器上启动Nginx时出现 ERROR - file: /home/hadoop/dev/fastdfs/fastdfs-nginx-module/src/common.c, line: 103, section: group1, you must set parameter: group_name!

问题原因:在配置mod_fastdfs.conf文件时要保证group_count=2的个数与下面配置的[group*]个数相一致。

2、 安装GraphicsMagick进行配置时出现错误 configure: error: libltdl is required by modules build 问题原因:没有安装libltdl,通过yum install

-ylibtoollibtool-devel安装后再重新

3、 java客户端上传文件时出现错误 recvcmd: 100 is not correct, expect cmd: 10

问题原因:版本问题,下载1.24版本的即可。

4、 通过浏览器方式缩略图是出现

gm convert: Request did not return an image.错误。

问题原因:没有安装libjpeg和libpng包,导致在GM处理图时出现错误。安装libjpeg和libpng后重新安装GraphicsMagick即可。

5、 安装FastDFS在 编译时出现

/usr/local/lib/libfastcommon.so: undefined reference

to sqrt‘ /usr/local/lib/libfastcommon.so: undefined reference

tocos‘错误

问题原因:libfastcommon版本的问题,下载旧版本,重新安装,然后在编译FastDFS即可。

6.这样先证明了这个fastdfs的group4新目录里面的图片是可以被访问的,然后再让开发人员在调用组件上传突破的时候,将调用url里面的group1变成group4即可。

7.ntpdate asia.pool.ntp.org

配置文件与软件版本

trackerd
cat mod_fastdfs.conf
#include http.conf
connect_timeout=2
network_timeout=30
storage_sync_file_max_delay = 86400
tracker_server=172.16.30.227:22122
load_fdfs_parameters_from_tracker=true
log_level=info
log_filename=/var/log/mod.log
url_have_group_name=true
response_mode=redirect
if_alias_prefix=
flv_support = true
flv_extension = flv
group_count = 3
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/opt/fastdfsdata/storage
#base_path=/opt/fastdfsdata/fastdfs_nginx
[group2]
group_name=secret
storage_server_port=23001
store_path_count=1
store_path0=/opt/fastdfsdata/secret
[group3]
group_name=public
storage_server_port=23002
store_path_count=1
store_path0=/opt/fastdfsdata/public

[[email protected] fdfs]# cat /etc/fdfs/tracker.conf
disabled=false
bind_addr=172.16.30.227
port=22122
connect_timeout=90
network_timeout=90
base_path=/opt/fastdfsdata/tracker
max_connections=256
accept_threads=4
work_threads=4
store_lookup=2
#store_group=group1
store_group=0
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
trunk_compress_binlog_min_interval = 0
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
log_file_keep_days = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=80
http.check_alive_interval=90
http.check_alive_type=tcp
http.check_alive_uri=/status.html

nginx
[[email protected] conf]# cat nginx.conf
user  root;
worker_processes  4;
error_log  logs/error.log  info;
pid        logs/nginx.pid;
events {
    worker_connections  1024;
    use epoll;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 300m;
    proxy_redirect off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout 90;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 16k;
    proxy_buffers 4 64k;
    proxy_busy_buffers_size 128k;
    proxy_temp_file_write_size 128k;
    upstream fdfs_group2 {
        server 172.16.30.228:80 weight=1 max_fails=2 fail_timeout=60s;
    }
    upstream secret {
        server 172.16.30.228:8081 weight=1 max_fails=2 fail_timeout=60s;
    }
    upstream public {
        server 172.16.30.228:8082 weight=1 max_fails=2 fail_timeout=60s;
    }

    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;
    server {
        listen       80;
        server_name  192.168.1.227;
        access_log  logs/host.access.log  main;
    location ~ /group1/ {
           if ($arg_attname ~ "^(.*).*") {
                 add_header Content-Disposition "attachment;filename=$arg_attname";
           }
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_pass http://fdfs_group2;
    }

    location ~ /secret/ {
           if ($arg_attname ~ "^(.*).*") {
                 add_header Content-Disposition "attachment;filename=$arg_attname";
           }
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_pass http://secret;
    }

    location ~ /public/ {
           if ($arg_attname ~ "^(.*).*") {
                 add_header Content-Disposition "attachment;filename=$arg_attname";
           }
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_pass http://public;
    }

   }
}

/usr/local/bin/fdfs_storaged /etc/fdfs/public.conf

cat /etc/fdfs/public.conf
disabled=false
group_name=public
bind_addr=172.16.30.228
client_bind=true
port=23002
connect_timeout=90
network_timeout=90
heart_beat_interval=90
stat_report_interval=60
base_path=/opt/fastdfsdata/public
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=/opt/fastdfsdata/public
subdir_count_per_path=256
tracker_server=172.16.30.227: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=8082

[[email protected] fdfs]# cat mod_fastdfs.conf
#include http.conf
connect_timeout=2
network_timeout=30
storage_sync_file_max_delay = 86400
tracker_server=172.16.30.227:22122
load_fdfs_parameters_from_tracker=true
log_level=info
log_filename=/var/log/mod.log
url_have_group_name=true
response_mode=redirect
if_alias_prefix=
flv_support = true
flv_extension = flv
group_count = 3
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/opt/fastdfsdata/storage
#base_path=/opt/fastdfsdata/fastdfs_nginx
[group2]
group_name=secret
storage_server_port=23001
store_path_count=1
store_path0=/opt/fastdfsdata/secret
[group3]
group_name=public
storage_server_port=23002
store_path_count=1
store_path0=/opt/fastdfsdata/public

nginx
[[email protected] conf]# cat nginx.conf
user  root;
worker_processes  1;
#error_log  logs/error.log;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;
    #access_log  logs/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    include  ./conf.d/*.conf;

}

[[email protected] conf]# cat conf.d/public.conf
server {
        listen       8082;
        server_name  172.16.30.228;

        access_log  logs/public.log;
        error_log  logs/public.err;

        location ~/public/M00 {
            root /opt/fastdfsdata/public/data;
            ngx_fastdfs_module;
         }
    }

原文地址:http://blog.51cto.com/szgb17/2287778

时间: 2024-08-30 17:31:01

fastdfs单主机配置多个storage 第二版的相关文章

fastdfs单主机配置多个storage

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_

FastDFS安装、配置、部署(三)-storage配置详解

1.基本配置 # is this config file disabled # false for enabled # true for disabled disabled=false # the name of the group this storage server belongs to group_name=group1 # bind an address of this host # empty for bind all addresses of this host bind_addr

单网卡配置第二个IP地址&&VI编辑器。Linux;CentOS 6

单网卡配置第二个IP地址&&VI编辑器.Linux:CentOS 6 原文地址:https://blog.51cto.com/8010597/2468525

IP、Apache虚拟主机配置部分学习笔记

IP地址 IP地址就是计算机的一个"编号",该编号是唯一的.相当于我们的身份证号码一样. IP地址格式:a.b.c.d  ,每一段的取值范围0-255. 本机的IP地址:127.0.0.1      只能是自己访问自己,别人无法通过这个IP访问你的电脑. 本机的域名:localhost         只能是自己访问自己,别人无法通过这个域名来访问你的电脑. 别人要想访问你的电脑,必须通过网卡的IP地址来访问. nslookup  www.baidu.com  命令窗口查看域名对应得I

Apache虚拟主机配置

在一个Apache服务器上可以配置多个虚拟主机,实现一个服务器提供多站点服务,其实就是访问同一个服务器上的不同目录.Apache虚拟主机配置有3中方法:基于IP配置.基于域名配置和基于端口配置,这里介绍基于域名配置和基于端口配置,基于IP配置方法类似. 1. Apache基于域名配置虚拟主机: 打开Apache安装目录下的配置文件conf/extra/httpd-vhosts.conf,添加如下配置信息: <VirtualHost _default_:80> DocumentRoot &quo

虚拟主机配置学习笔记

1.可以直接在httpd.conf当中进行配置,也可以使用extra中的httpd-vhosts.conf配置,建议使用第二种方式. 2.在httpd.conf中开启vhost.conf配置 3.找配置文件 4. 为了使用基于域名的虚拟主机技术,我们需要指定服务器的ip和端口来接收服务. 这个通过NameVirtualHost 指令完成. NameVirtualHost *:80 其中*表示所有的ip地址,如果是一个具体的ip,你可以写上这个ip,但建议使用*,80指的是端口. 接下来,要单独的

AIX下RAC搭建 Oracle10G(二)主机配置

AIX下RAC搭建系列 AIX下RAC搭建 Oracle10G(二)主机配置 环境 节点 节点1 节点2 小机型号 IBM P-series 630 IBM P-series 630 主机名 AIX203 AIX204 交换机 SAN光纤交换机 存储 SAN T3存储 大纲流程如下: 第一部分:主机配置 一.检测系统环境 二.网络配置 三.用户和组 四.网络参数调整 五.时间同步 六.卷组 第二部分:安装hacmp并配置 七.hacmp安装并配置 第三部分:安装CRS 八.安装CRS 第四部分:

[转载]vSphere ESXi主机配置iSCSI存储

要点: 1.ESXi主机与存储通信:ping 2.网络:vmkernel 3.存储:iscsi software adapter 4.存储映射 vSphere ESXi主机一般连接的存储类型有光纤存储.iSCSI存储两类.本次案例为iSCSI存储连接ESXi主机的配置. 案例环境:ESXi主机通过以太网络来连接iSCSID存储,并获取到存储空间,拓扑如下: 首先完成iSCSI存储与交换机的配置,由四根千兆网线连接,两边都做端口捆绑,总带宽为4*1000Mbps.存储映射出来10个5T的lun给两

ubuntu 主机配置相关命令

使用ubuntu系统这么久了,但还主要是停留在简单的使用上,好多关于系统设置方面的命令平时用的少,看书的时候一晃而过,也就忘记了,到用的时候又要去找,很麻烦,今天开始就在这记录平时遇到问题需要解决时查找的一些命令,也方便以后的回忆和查阅. ubuntu下查看电脑的配置: lshw -short H/W path       Device  Class          Description=================================================