首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MongoDB -无法运行,因为SELinux正在阻止mongod打开对文件/proc/sys/net/ipv4/tcp_fastopen的访问

MongoDB -无法运行,因为SELinux正在阻止mongod打开对文件/proc/sys/net/ipv4/tcp_fastopen的访问
EN

Stack Overflow用户
提问于 2021-01-24 20:36:17
回答 4查看 465关注 0票数 0

安装完成后,我的mongod服务器运行得很好。我已经创建了用户并重新启动服务器,没有问题。

但是现在,当通过向bindip添加0.0.0.0来修改gonfi文件时,服务器不会重新启动。错误消息是

代码语言:javascript
复制
Jan 24 11:59:53 localhost.localdomain setroubleshoot[4656]: failed to retrieve rpm info for /proc/sys/net/ipv4/tcp_fastopen
Jan 24 11:59:54 localhost.localdomain setroubleshoot[4656]: SELinux is preventing mongod from open access on the file /proc/sys/net/ipv4/tcp_fastopen. For complete SELinux messag>
Jan 24 11:59:54 localhost.localdomain setroubleshoot[4656]: SELinux is preventing mongod from open access on the file /proc/sys/net/ipv4/tcp_fastopen.
                                                            
                                                            *****  Plugin catchall (100. confidence) suggests   **************************
                                                            
                                                            If you believe that mongod should be allowed open access on the tcp_fastopen file by default.
                                                            Then you should report this as a bug.
                                                            You can generate a local policy module to allow this access.
                                                            Do
                                                            allow this access for now by executing:
                                                            # ausearch -c 'mongod' --raw | audit2allow -M my-mongod
                                                            # semodule -X 300 -i my-mongod.pp

原生搜索‘-c’--raw | audit2allow -M my-mongod.

semodule -X 300 -i my-mongod.pp

没有解决问题。

Mongodb文档说版本4默认使用tcp_fastopen激活,我不知道如何应用语义许可来使用tcp_fastopen。

提前感谢

EN

回答 4

Stack Overflow用户

发布于 2021-01-25 11:01:13

验证您的操作系统是否受MongoDB支持。

安装操作系统的普通版本,不要更改任何设置,使用已发布的MongoDB文档安装MongoDB并使其正常工作。

确定当前安装和普通安装之间的差异。

使用调查结果更新您的问题。

票数 0
EN

Stack Overflow用户

发布于 2021-05-14 11:58:39

我找不到这个确切错误的答案。我都快把头发拔出来了。我最终查看了mongod.log文件。它在那里有一个权限被拒绝的错误。journalctl _ the显示了tcp_fastopen,所以我正在排除SELinux的故障,而这实际上是一个权限被拒绝的错误。希望这能帮助其他遇到这个错误的人。

票数 0
EN

Stack Overflow用户

发布于 2021-07-08 16:18:51

在升级到4.4.6之后,我也遇到了同样的问题。我最终应用了建议的here,手动编译模块。现在它起作用了!我尝试了很多次,所以我不能百分之百地确定我所做的一切是不是必要的。audit2allow命令不包括该规则

允许mongod_t sysctl_net_t:file { getattr read open };

代码语言:javascript
复制
# cat > mongodb_sysctl_net.te << EOF
module mongodb_sysctl_net 1.0;

require {
    type mongod_t;
    type sysctl_net_t;
    class dir search;
    class file { getattr read open };
}

#============= mongod_t ==============
allow mongod_t sysctl_net_t:dir search;
allow mongod_t sysctl_net_t:file { getattr read open };
EOF

# checkmodule -M -m -o  mongodb_sysctl_net.mod mongodb_sysctl_net.te
# semodule_package -o mongodb_sysctl_net.pp -m mongodb_sysctl_net.mod
# semodule -i mongodb_sysctl_net.pp
# systemctl start mongod.service

注意:根据mongodb documentation编写的上一次安装中,我已经安装了策略模块

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65870600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档