• 部署高可用FastDFS集群时遇到的错误


    “http.mime_types_filename” not exist or is empty

    • 问题现象

    本地访问storage资源是没有问题,可以上传可以下载

    [root@localhost ~]# fdfs_file_info group1/M00/00/00/wKiVg2L8Uq6AO3LzAADZ-GROavg913.jpg
    GET FROM SERVER: false
    
    file type: normal
    source storage id: 0
    source ip address: 192.168.149.131
    file create timestamp: 2022-08-17 10:30:06
    file size: 55800
    file crc32: 1682860792 (0x644e6af8)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    启动nginx后,外部访问不了storage的资源

    查看nginx错误日志,发现如下报错:

    [root@localhost ~]# cat /usr/local/nginx/logs/error.log
    param "http.mime_types_filename" not exist or is empty
    #参数“http.mime_types_filename”不存在或为空
    
    • 1
    • 2
    • 3
    • 问题排查

    我们首先看看/etc/fdfs/下有没有http.conf和mime.type这两个文件
    在这里插入图片描述
    可以发现是有的,奇怪,既然有怎么还报错

    我们看下/etc/fdfs/mod_fastdfs.conf这个配置文件,mod_fastdfs.conf为FastDFS扩展模块的配置文件

    #鉴于我已经将mod_fastdfs.conf修改过了,修改前我有进行备份,所以看备份文件
    [root@localhost ~]# cat /etc/fdfs/mod_fastdfs.conf.bak
    # use "#include" directive to include HTTP config file
    # NOTE: #include is an include directive, do NOT remove the # before include
    #include http.conf
    
    • 1
    • 2
    • 3
    • 4
    • 5

    到这里就逐渐清晰起来了,原配置文件里关于http.conf的字段有这样一段说明

    # NOTE: #include is an include directive, do NOT remove the # before include
    
    • 1

    意思就是说不要去掉#include http.conf的#键

    而我在修改配置文件时是把以#开头的行还有空行都删除掉了,所以才会报错

    • 处理

    使用备份文件恢复一下,再修改配置(直接修改就行了,不需要去掉#开头的行还有空行)
    在这里插入图片描述

    removing protocol iptable drop rule

    • 问题现象

    在搭建高可用分布式FastDFS集群时,发现访问keepalived的VIP没有响应

    查看一下keepalived的状态

    [root@localhost ~]# systemctl status keepalived.service
    
    • 1

    发现有这么一条记录

    VRRP_Instance(VI_1) removing protocol iptable drop rule
    
    • 1
    • 问题排查

    既然访问不通,首先想到的是网络问题

    我们先看下vip有没有分配

    [root@localhost ~]#ip a
    inet 192.168.149.100/32 scope global ens33
    
    • 1
    • 2

    可以发现vip是有的

    一般在测试环境我都是把防火墙和selinux给关了的,我们分别看下

    [root@localhost ~]# getenforce
    Disabled
    
    • 1
    • 2

    可以看到selinux是关闭了的

    我们看下iptables有没有设置规则

    发现有一条防火墙规则:DROP掉所有目的为keepalived dst的访问

    [root@localhost ~]# iptables -L -n
    Chain INPUT (policy ACCEPT)
    target     prot opt source          destination         
    DROP       all  --  0.0.0.0/0       0.0.0.0/0            match-set keepalived dst
    
    • 1
    • 2
    • 3
    • 4

    问题已经逐渐明朗了,我们发现keepalived自动添加了一条防火墙规则,导致了我们去访问vip时系统没有响应

    我们看下keepalived的配置文件

    [root@localhost ~]# cat /etc/keepalived/keepalived.conf 
    vrrp_strict 
    
    • 1
    • 2

    发现了有这个字段,如果开启了vrrp_strict ,则

    严格遵守VRRP协议,启用此项后以下状况将无法启动服务:
    1.无VIP地址 
    2.配置了单播邻居
    
    而且在VRRP版本2中有IPv6地址,开启配置了此项并且没有配置vrrp_iptables时会自动开启iptables防火墙规则,默认导致VIP无法访问,建议不加此项配置
    
    vrrp_iptables 
    此项和vrrp_strict同时开启时,则不会添加防火墙规则,如果无配置vrrp_strict项,则无需启用此项配置
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 处理

    我们去掉vrrp_strict 字段,重启keepalived,成功访问!

  • 相关阅读:
    setTimeout与setInterval区别
    400Gbps 网络面临的挑战
    【GPGPU编程模型与架构原理】第一章 1.3 现代 GPGPU 产品
    C++ Cookbook by Eric
    golang Io模型,socket,select
    阿里云视频点播服务视频地址浏览器打开失效问题记录
    企微SCRM营销平台MarketGo-ChatGPT助力私域运营
    网络基础-ICMP协议
    buuctf-[GXYCTF2019]禁止套娃 git泄露,无参数rce
    [ vulhub漏洞复现篇 ] Jetty WEB-INF 文件读取复现CVE-2021-34429
  • 原文地址:https://blog.csdn.net/s_alted/article/details/126677669