I am attempting to enable the MySQL group replication plugin on MySQL 5.7.21, which should be available in 5.7 as per the documentation (https://dev.mysql.com/doc/refman/5.7/en/group-replication.html)
$ mysql --version
mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper
When I attempt to enable the plugin through MySQL:
$ mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib/mysql/plugin/group_replication.so' (errno: 2 /usr/lib/mysql/plugin/group_replication.so: cannot open shared object file: No such file or directory)
The output of my plugins in MySQL:
$ mysql> SHOW PLUGINS;
+----------------------------+----------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ngram | ACTIVE | FTPARSER | NULL | GPL |
+----------------------------+----------+--------------------+---------+---------+
44 rows in set (0.01 sec)
This is the contents of the plugin directory:
$ ls -lah /usr/lib/mysql/plugin/
total 644K
drwxr-xr-x 2 root root 4.0K Sep 26 23:24 .
drwxr-xr-x 3 root root 4.0K Sep 26 23:24 ..
-rw-r--r-- 1 root root 21K Jul 19 14:10 adt_null.so
-rw-r--r-- 1 root root 6.2K Jul 19 14:10 auth_socket.so
-rw-r--r-- 1 root root 44K Jul 19 14:10 connection_control.so
-rw-r--r-- 1 root root 107K Jul 19 14:10 innodb_engine.so
-rw-r--r-- 1 root root 79K Jul 19 14:10 keyring_file.so
-rw-r--r-- 1 root root 151K Jul 19 14:10 libmemcached.so
-rw-r--r-- 1 root root 9.7K Jul 19 14:10 locking_service.so
-rw-r--r-- 1 root root 11K Jul 19 14:10 mypluglib.so
-rw-r--r-- 1 root root 6.2K Jul 19 14:10 mysql_no_login.so
-rw-r--r-- 1 root root 55K Jul 19 14:10 rewriter.so
-rw-r--r-- 1 root root 56K Jul 19 14:10 semisync_master.so
-rw-r--r-- 1 root root 15K Jul 19 14:10 semisync_slave.so
-rw-r--r-- 1 root root 27K Jul 19 14:10 validate_password.so
-rw-r--r-- 1 root root 31K Jul 19 14:10 version_token.so
These are the contents of my config:
cat /etc/mysql/my.cnf
[mysqld_safe]
nice = 0
socket = /var/run/mysqld/mysqld.sock
[mysqld]
basedir = /usr
bind_address = 123.45.67.89
binlog_checksum = NONE
binlog_format = ROW
datadir = /var/lib/mysql
enforce_gtid_consistency = ON
expire_logs_days = 10
general_log = 1
general_log_file = /var/log/mysql/mysql.log
gtid_mode = ON
key_buffer_size = 8388608
lc_messages_dir = /usr/share/mysql
log_bin = binlog
log_error = /var/log/mysql/mysql_error.log
log_slave_updates = ON
long_query_time = 60
loose-group_replication_bootstrap_group = OFF
loose-group_replication_enforce_update_everywhere_checks= ON
loose-group_replication_group_name = 34dee7cd-d20d-4f59-9500-f56ada9a1abz
loose-group_replication_group_seeds = 123.45.67.88:33061,123.45.67.89:33061
loose-group_replication_ip_whitelist = 123.45.67.88,123.45.67.89
loose-group_replication_local_address = 123.45.67.89:33061
loose-group_replication_recovery_use_ssl= 1
loose-group_replication_single_primary_mode= OFF
loose-group_replication_ssl_mode = REQUIRED
loose-group_replication_start_on_boot = OFF
master_info_repository = TABLE
max_allowed_packet = 16M
max_binlog_size = 100M
max_connect_errors = 100000000
pid-file = /var/run/mysqld/mysqld.pid
port = 3306
query_cache_limit = 1M
query_cache_size = 16M
relay_log = my-project-prod-relay-bin
relay_log_info_repository = TABLE
report_host = 123.45.67.88
require_secure_transport = ON
server_id = 2
skip_external_locking
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow-query.log
socket = /var/run/mysqld/mysqld.sock
thread_cache_size = 8
thread_stack = 192K
tmpdir = /tmp
transaction_write_set_extraction = XXHASH64
user = mysql
[mysqldump]
max_allowed_packet = 16M
quick
quote_names
[mysql]
no-auto-rehash
[isamchk]
key_buffer_size = 16M
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
!includedir /etc/mysql/conf.d/
I'm wondering if I'm using the wrong version of MySQL or if there is some other step needed to install the group replication plugin?
FWIW I downloaded 5.7.19 Community Edition https://dev.mysql.com/doc/refman/5.7/en/group-replication.html to run it in a sandbox, and I confirm that the group replication .so file is present.
I got the plugin to load with the INSTALL PLUGIN statement, just like you tried.
First I had to add some config settings, which are documented in https://dev.mysql.com/doc/refman/5.7/en/group-replication-configuring-instances.html
server_id=1 # or any value unique among your replica set
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
And of course restart mysqld after editing the config settings.
According to discussion here, it looks like the group replication plugin may have been intentionally left out of the normal MySQL server edition.
To know if you are running the Community Edition, run mysql:
> mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20-log MySQL Community Server (GPL)
.....
To manually install the Community Edition 5.7 (or other archived versions here: https://downloads.mysql.com/archives/community/), run the following commands:
sudo apt-get install libaio1
sudo apt-get install libmecab2
curl -OL https://downloads.mysql.com/archives/get/file/mysql-common_5.7.20-1ubuntu16.04_amd64.deb
curl -OL https://downloads.mysql.com/archives/get/file/mysql-community-client_5.7.20-1ubuntu16.04_amd64.deb
curl -OL https://downloads.mysql.com/archives/get/file/mysql-client_5.7.20-1ubuntu16.04_amd64.deb
curl -OL https://downloads.mysql.com/archives/get/file/mysql-community-server_5.7.20-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-common_5.7.20-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.20-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-client_5.7.20-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-server_5.7.20-1ubuntu16.04_amd64.deb
Bumped into the same issue. Bill's answer and the link to why it's not included in the standard version pointed me in the right direction, then I found Luis' answer here. The linked guide shows that after installing mysql-apt-config, apt-get install mysql-server fetches the community version by default. This allowed me to proceed with installing the plugin, although I had an extra error:
ERROR 1123 (HY000): Can't initialize function 'group_replication'; Plugin initialization function failed.
When I checked /var/log/mysql/error.log, I saw it fails because:
2018-07-04T14:19:36.039987Z 5 [ERROR] For the creation of replication channels the master info and relay log info repositories must be set to TABLE
Providing the right Group Replication-ready configuration to MySQL solved it. In my case that was simply restarting the MySQL server since I had provisioned it with Ansible but it hadn't taken effect. Hope that helps anyone dealing with Group Replication.
EDIT: While the above works, it created problems when using the Geerlingguy Ansible role, so instead of installing Community Server, I ended up provisioning the plugin directly with the following Ansible code:
- name: Provision the MySQL group_replication plugin
copy:
src: group_replication.so
dest: /usr/lib/mysql/plugin/group_replication.so
mode: 0644
I got the plugin from the community version of MySQL though, but I can say it's another valid approach that's better suited to some situations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With