@@ -112,6 +112,9 @@ if [ -z "$whitelist" ]; then
112112 fi
113113fi
114114
115+ innodb_buffer_pool_size=" $INNODB_BUFFER_POOL_SIZE "
116+ group_replication_message_cache_size=" $GROUP_REPLICATION_MESSAGE_CACHE_SIZE "
117+
115118# the mysqld configurations have take by following
116119# 01. official doc: https://dev.mysql.com/doc/refman/5.7/en/group-replication-configuring-instances.html
117120# 02. digitalocean doc: https://www.digitalocean.com/community/tutorials/how-to-configure-mysql-group-replication-on-ubuntu-16-04
@@ -139,6 +142,10 @@ loose-group_replication_start_on_boot = OFF
139142loose-group_replication_ssl_mode = REQUIRED
140143loose-group_replication_recovery_use_ssl = 1
141144
145+ # recommended config
146+ innodb_buffer_pool_size = "${innodb_buffer_pool_size} "
147+ loose-group-replication-message-cache-size = "${group_replication_message_cache_size} "
148+
142149# Shared replication group configuration
143150loose-group_replication_group_name = "${GROUP_NAME} "
144151#loose-group_replication_ip_whitelist = "${hosts} "
@@ -181,6 +188,10 @@ loose-group_replication_start_on_boot = OFF
181188loose-group_replication_ssl_mode = REQUIRED
182189loose-group_replication_recovery_use_ssl = 1
183190
191+ # recommended config
192+ innodb_buffer_pool_size = "${innodb_buffer_pool_size} "
193+ loose-group-replication-message-cache-size = "${group_replication_message_cache_size} "
194+
184195# Shared replication group configuration
185196loose-group_replication_group_name = "${GROUP_NAME} "
186197#loose-group_replication_ip_whitelist = "${hosts} "
@@ -206,6 +217,13 @@ socket="/var/run/mysqld/mysqld.sock"
206217EOL
207218fi
208219
220+ # recommended config
221+ if [ -v BINLOG_EXPIRE_LOGS_SECONDS ]; then
222+ cat >> /etc/mysql/group-replication.conf.d/group.cnf << EOL
223+ binlog_expire_logs_seconds = "$BINLOG_EXPIRE_LOGS_SECONDS "
224+ EOL
225+ fi
226+
209227# wait for mysql daemon be running (alive)
210228function wait_for_mysqld_running() {
211229 local mysql=" $mysql_header --host=$localhost "
0 commit comments