首先必须确保在server s1上组复制插件已安装成功。如果你在配置文件中使用plugin_load_add='group_replication.so'
,那么组复制插件就已经安装,那么你就可以继续执行下一步。否则,你必须手动安装插件;可以使用如下语句进行安装:
mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
加载组复制之前必须确保mysql.session用户已经存在。mysql.session是在MySQL8.0.2中被加入的。如果你的数据字典使用了比较早的版本进行初始化,那么必须执行MySQL upgrade程序,如果没有运行upgrade,组复制会启动失败并且会报错:There was an error when trying to access the server with user: mysql.session@localhost. Make sure the user is present in the server and that mysql_upgrade was ran after a server update。
检查插件是否安装成功,可以执行show plugins;然后检查输出应该如下所示: