“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)
启动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”不存在或为空
- 问题排查
我们首先看看/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
到这里就逐渐清晰起来了,原配置文件里关于http.conf的字段有这样一段说明
# NOTE: #include is an include directive, do NOT remove the # before include
意思就是说不要去掉#include http.conf的#键
而我在修改配置文件时是把以#开头的行还有空行都删除掉了,所以才会报错
- 处理
使用备份文件恢复一下,再修改配置(直接修改就行了,不需要去掉#开头的行还有空行)
removing protocol iptable drop rule
- 问题现象
在搭建高可用分布式FastDFS集群时,发现访问keepalived的VIP没有响应
查看一下keepalived的状态
[root@localhost ~]# systemctl status keepalived.service
发现有这么一条记录
VRRP_Instance(VI_1) removing protocol iptable drop rule
- 问题排查
既然访问不通,首先想到的是网络问题
我们先看下vip有没有分配
[root@localhost ~]#ip a
inet 192.168.149.100/32 scope global ens33
可以发现vip是有的
一般在测试环境我都是把防火墙和selinux给关了的,我们分别看下
[root@localhost ~]# getenforce
Disabled
可以看到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
问题已经逐渐明朗了,我们发现keepalived自动添加了一条防火墙规则,导致了我们去访问vip时系统没有响应
我们看下keepalived的配置文件
[root@localhost ~]# cat /etc/keepalived/keepalived.conf
vrrp_strict
发现了有这个字段,如果开启了vrrp_strict ,则
严格遵守VRRP协议,启用此项后以下状况将无法启动服务:
1.无VIP地址
2.配置了单播邻居
而且在VRRP版本2中有IPv6地址,开启配置了此项并且没有配置vrrp_iptables时会自动开启iptables防火墙规则,默认导致VIP无法访问,建议不加此项配置
vrrp_iptables
此项和vrrp_strict同时开启时,则不会添加防火墙规则,如果无配置vrrp_strict项,则无需启用此项配置
- 处理
我们去掉vrrp_strict 字段,重启keepalived,成功访问!