问题描述:启动mysql数据库时报错unknown variable 'rpl_semi_sync_slave_enabled=1'.
数据库:mysql 5.7.21
系统:rhel 7.3
1、异常重现
--启动数据库
[mysql@mysql-leo-slave data]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/home/mysql/etc/my.cnf &
--告警信息
2023-08-26T05:18:40.824255Z 0 [Note] InnoDB: Loading buffer pool(s) from /mysql/data/ib_buffer_pool
2023-08-26T05:18:40.826048Z 0 [ERROR] unknown variable 'rpl_semi_sync_slave_enabled=1'
2023-08-26T05:18:40.826071Z 0 [ERROR] Aborting
说明:如上所示,数据库自动关闭.
2、异常分析
2.1、查配置文件
[mysql@mysql-leo-master etc]$ cat my.cnf
[mysql]
prompt="\u@mysql-leo-master[\\d]> "
#CLIENT#
port = 3306
socket = /mysql/data/mysql.sock
[mysqld]
basedir = /usr/local/mysql
datadir = /mysql/data/
server_id = 1
port = 3306
sql_mode = ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
character_set_server = utf8mb4
socket = /mysql/data/mysql.sock
secure-file-priv = /mysql/bak/file
log-bin = /mysql/binlog/mysql-bin
log-bin-index = /mysql/data/mysql-bin.index
relay-log = /mysql/data/relay-bin
relay-log-index = /mysql/data/relay-bin.index
#GTID
gtid_mode = on
enforce_gtid_consistency = on
innodb_buffer_pool_size = 2G
#开启半同步复制
plugin-load=rpl_semi_sync_master=semisync_master.so
rpl_semi_sync_master_wait_no_slave = 0
rpl_semi_sync_master_enabled = 1
rpl_semi_sync_master_timeout = 10000
rpl_semi_sync_slave_enabled = 0
rpl_semi_sync_master_wait_for_slave_count = 1
rpl_semi_sync_master_wait_point = AFTER_SYNC
[mysqld_safe]
pid_file = /mysql/data/mysql.pid
log_error = /mysql/data/mysql_error.log
说明:搭建mysql半同步在my.cnf文件中添加半同步参数时,global variable必须在相应的so文件安装后才有效.
3、解决方案
3.1、注释半同步参数
--将my.cnf相关半同步参数注释掉.
[mysql@mysql-leo-master etc]$ vi my.cnf
......
#plugin-load=rpl_semi_sync_master=semisync_master.so
#rpl_semi_sync_master_wait_no_slave = 0
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_master_timeout = 10000
#rpl_semi_sync_slave_enabled = 0
#rpl_semi_sync_master_wait_for_slave_count = 1
#rpl_semi_sync_master_wait_point = AFTER_SYNC
......
3.2、安装so文件
--查看so文件
[root@mysql-leo-master ~]# find / -name semisync_master.so
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/local/Percona-Server-5.7.21-20-Linux.x86_64.ssl101/lib/mysql/plugin/semisync_master.so
[root@mysql-leo-master ~]# find / -name semisync_slave.so
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/local/Percona-Server-5.7.21-20-Linux.x86_64.ssl101/lib/mysql/plugin/semisync_slave.so
--开启数据库
[mysql@mysql-leo-master etc]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/home/mysql/etc/my.cnf &
--安装插件
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%semi%';
Empty set (0.01 sec)
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
Query OK, 0 rows affected (0.00 sec)
mysql> install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%semi%';
+----------------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+----------------------+---------------+
| rpl_semi_sync_master | ACTIVE |
| rpl_semi_sync_slave | ACTIVE |
+----------------------+---------------+
2 rows in set (0.00 sec)
3.3、重启数据库
[mysql@mysql-leo-master etc]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.21-20-log Percona Server (GPL), Release 20, Revision ed217b06ca3
Copyright (c) 2009-2018 Percona LLC and/or its affiliates
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[mysql@mysql-leo-master etc]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/home/mysql/etc/my.cnf &
说明:如上所示,数据库成功开启.
参考文档:https://blog.csdn.net/weixin_36035750/article/details/113908654
启动mysql数据库时报错unknown variable 'rpl_semi_sync_slave_enabled=1'
原创Liujun_Deng 博主文章分类:Mysql ©著作权
文章标签 mysql unknown variable 文章分类 MySQL 数据库
-
还原mysql数据库时报错
mysql数据库还原时报错
mysql 还原 -
连接mysql数据库时报错ERROR 1130
连接mysql数据库时报错ERROR 1130
MySQL ERROR 1130 连接异常 -
数据库在启动时报错ORA-32004
数据库在启动时报错ORA-32004
数据库 oracle sql