启动MariaDB服务器报错:参数过多(多余参数为'”–wsrep-new-cluster”')
Too many arguments (first extra is '”–wsrep-new-cluster”') 问题背景
我在RHEL服务器上搭建了正常运行的2节点MariaDB Galera集群。Node2故障后,我修改Node1的server.cnf移除了Node2的IP,随后Node1也出现故障。禁用所有wsrep*集群配置后,启动时出现错误:Too many arguments (first extra is '”–wsrep-new-cluster”')。尝试执行mysqld_safe --wsrep-recover未解决问题,于是卸载并重装MariaDB。重装后Node2恢复正常,但Node1未修改任何配置仍报相同错误,详细日志如下:
2023-09-27 16:45:34 0 [Note] Starting MariaDB 11.0.3-MariaDB source revision 70905bcb9059dcc40db3b73bc46a36c7d40f1e10 as process 14566 2023-09-27 16:45:34 0 [Note] InnoDB: Compressed tables use zlib 1.2.7 2023-09-27 16:45:34 0 [Note] InnoDB: Number of transaction pools: 1 2023-09-27 16:45:34 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions 2023-09-27 16:45:34 0 [Note] InnoDB: Using Linux native AIO 2023-09-27 16:45:34 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB 2023-09-27 16:45:34 0 [Note] InnoDB: Completed initialization of buffer pool 2023-09-27 16:45:34 0 [Note] InnoDB: Resetting space id's in the doublewrite buffer 2023-09-27 16:45:34 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes) 2023-09-27 16:45:34 0 [Note] InnoDB: End of log at LSN=2640760968 2023-09-27 16:45:34 0 [Note] InnoDB: Opened 3 undo tablespaces 2023-09-27 16:45:34 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active. 2023-09-27 16:45:34 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2023-09-27 16:45:34 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2023-09-27 16:45:34 0 [Note] InnoDB: log sequence number 2640760968; transaction id 355136 2023-09-27 16:45:34 0 [Note] Plugin 'FEEDBACK' is disabled. 2023-09-27 16:45:34 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2023-09-27 16:45:34 0 [Note] Plugin 'wsrep-provider' is disabled. 2023-09-27 16:45:34 0 [Note] InnoDB: Buffer pool(s) load completed at 230927 16:45:34 /usr/sbin/mariadbd: Too many arguments (first extra is '”–wsrep-new-cluster”'). 2023-09-27 16:45:34 0 [ERROR] Aborting
排查与解决步骤
检查systemd服务配置
执行systemctl cat mariadb查看完整服务启动配置,确认ExecStart行中是否残留了带全角引号的”–wsrep-new-cluster”参数,找到后删除该行的无效参数,然后执行systemctl daemon-reload重新加载配置,再启动服务:systemctl start mariadb。扫描所有配置文件
执行grep -r "wsrep-new-cluster" /etc/my.cnf* /etc/mysql/,查找所有配置文件中是否存在该参数(包括被主配置文件引入的子文件),发现后注释或删除相关行。清理自定义启动脚本
检查是否存在手动编写的启动脚本、crontab任务或其他自动化启动逻辑,确保没有传递无效的”–wsrep-new-cluster”参数(注意正确的参数格式是半角短横线和引号:--wsrep-new-cluster)。验证文件权限
确保MariaDB配置文件权限正确(通常是root:root,权限644),避免因权限问题导致配置加载异常。
内容的提问来源于stack exchange,提问作者abhijeet pathak

