在 Macos Catalina 上使用 Mariadb 10.4.13 打开的文件太多

Vik*_*ika 7 homebrew macos-catalina mariadb-10.4

我在 Macos 10.15.5 和 mariadb 10.4.13 上运行。由于我做了“brew upgrade”,我有这个错误: Out of resources when opening file './pluto/_connection.MYD' (Errcode: 24 "Too many open files")

我试图修改这个文件 /usr/local/etc/my.cnf 来添加这一行,open_files_limit = 60000但它不起作用,open_files_limit 变量仍然被阻止在值 256 上。

我试过这条线 : sudo ulimit -n 1024,但每次重新启动时,值都会返回到 256

你有什么帮助带我来帮助我解决我的问题吗?

小智 14

您是否尝试过寻找其他方法来修改 MacOS Catalina 上的打开文件限制?快速搜索将我带到这里,它建议在系统运行时对其进行以下修改:

sudo launchctl limit maxfiles <soft limit> <hard limit>
Run Code Online (Sandbox Code Playgroud)

这个站点这个超级用户问题 建议修改/Library/LaunchDaemons/limit.maxfiles.plist以永久增加它。

sudo launchctl limit maxfiles <soft limit> <hard limit>
Run Code Online (Sandbox Code Playgroud)

然后,通过更改权限并验证更改来完成。

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"  
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">  
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string><your soft limit here></string>
      <string><your hard limit here></string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
  </dict>
</plist> 
Run Code Online (Sandbox Code Playgroud)


小智 6

  • MacOS 卡塔琳娜 10.15.x
  • 使用自制软件安装 Mariadb

导入数据库mysql < foo.sql失败并显示:[ERROR] Error in accept: Too many open files

同意楼上的帖子。这看起来像是假阴性。这对我有用:

brew services stop mariadb
Run Code Online (Sandbox Code Playgroud)

并确保您没有运行任何 mysql 进程:ps aux | grep mysql

mkdir /usr/local/var/run/mysqld
Run Code Online (Sandbox Code Playgroud)

编辑 Mariadb 配置文件/usr/local/etc/my.cnf并告诉它使用此目录。

[client-server]
socket = /usr/local/var/run/mysqld/mysql.sock

[mysqld_safe]
pid-file = /usr/local/var/run/mysqld/mysqld.pid
Run Code Online (Sandbox Code Playgroud)

严格来说,你只需要定义 pid 文件,尽管我个人喜欢将 pid 和套接字文件存储在/usr/local/var/run- 结构中。我对从 Homebrew 安装的 PHP (/usr/local/var/run/php) 执行同样的操作。

启动数据库服务器就完成了。

brew services start mariadb
Run Code Online (Sandbox Code Playgroud)