MariaDB 和 Amazon Linux 2:错误:ld.so:无法预加载 LD_PRELOAD 中的对象“/usr/lib64/libjemalloc.so.1”

MariaDB 和 Amazon Linux 2:错误:ld.so:无法预加载 LD_PRELOAD 中的对象“/usr/lib64/libjemalloc.so.1”

下列的AWS 文档,我正在尝试启动并运行基本的 LAMP 服务器。一切似乎都运行良好。通过终端或 phpMyAdmin (GUI) 登录 MySQL 即可。

但是,当我检查 MariaDB 的状态时,出现错误并且不确定如何解决它。

[ec2-user@ip-172-31-30-51 ~]$ sudo systemctl status mariadb● mariadb.service - 

MariaDB 10.2 database server   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)  Drop-In: /etc/systemd/system/mariadb.service.d           └─override.conf        /usr/lib/systemd/system/mariadb.service.d           └─tokudb.conf   Active: active (running) since Sat 2021-11-13 16:52:39 UTC; 37s ago  Process: 3087 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 2837 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 2801 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 2943 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─2943 /usr/libexec/mysqld --basedir=/usr

Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Nov 13 16:52:39 ip-172-31-30-51.ec2.internal systemd[1]: Started MariaDB 10.2 database server.

这还不是问题,但我刚刚完成了所有的安装。那么我想未来会出现这样的问题吗?

编辑:我正在具有 30GB 存储空间的 t2.micro EC2 实例上对此进行测试。

答案1

我也有同样的情况。

为了解决这个问题,我安装了 jemalloc 包: sudo yum install jemalloc

症状:

sudo find / -name "libjemalloc*"什么也没返回,告诉我系统上没有 jemalloc 包(也许是 AWS LAMP 指令中的疏忽?),并且在使用 systemctl 重新启动 mariadb 时发现了相同的日志消息。

我本想忽略它,但我发现这些笔记这让我相信安装 jemalloc 将使我的系统运行更顺畅(希望能够阻止困扰我的 WordPress 网站的 mariadb 崩溃)。

核实:

sudo find / -name "libjemalloc*"现在返回,这与变量中引用的/usr/lib64/libjemalloc.so.1 路径相同。现在不会产生上述问题中的错误消息。cat /etc/my.cnf.d/tokudb.cnfmalloc-libsudo systemctl restart mariadb

答案2

某处有一个环境变量设置

LD_PRELOAD=/usr/lib64/libjemalloc.so.1

libjemalloc.so.1实际上并不存在。

如果您没有任何特殊原因将标准malloc(3)实现替换为jemalloc,请运行grep -r jemalloc /etc以查找设置 LD_PRELOAD 的位置,并将其注释掉或删除它,因为如果没有安装实际的库,该设置将不会有效,并且只会导致日志中出现噪音。

相关内容