{"id":289520,"date":"2018-09-17T20:00:02","date_gmt":"2018-09-17T16:00:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289520"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289520","title":{"rendered":"\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c InnoDB cluster \u0438\u0437 mysql 5.7 \u043d\u0430 centos 7"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  \u041a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0435\u0441\u0442\u044c \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 innoDB cluster \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0430\u0445 \u0441 centos 7.5, \u043d\u0430\u0434\u043e \u0435\u0433\u043e \u043f\u043e\u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u043d\u043e\u0434. \u041c\u043e\u0436\u043d\u043e \u043b\u043e\u043c\u0430\u0442\u044c \u0438 \u0438\u0437\u0434\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e. \u0417\u0432\u0443\u0447\u0438\u0442 \u0437\u0430\u043c\u0430\u043d\u0447\u0438\u0432\u043e.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u0443 \u043c\u0435\u043d\u044f \u043e\u043f\u044b\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u044d\u0442\u0438\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u0443 \u0434\u0430 \u0433\u0443\u0433\u043b \u0432 \u043f\u043e\u043c\u043e\u0449\u044c.<br \/>  \u0417\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0447\u0442\u043e \u0432 \u043d\u0435\u043c, \u0447\u0442\u043e \u0432 \u044f\u043d\u0434\u0435\u043a\u0441\u0435 \u0432\u0435\u043b\u0438 \u043b\u0438\u0431\u043e \u043d\u0430 dev.mysql.com, \u043b\u0438\u0431\u043e \u043d\u0430 \u044d\u0442\u0443 <a href=\"https:\/\/habr.com\/post\/332518\/\">\u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435<\/a>. \u0412\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043f\u043e \u043d\u0435\u0439 \u0438 \u0431\u044b\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043d\u043e\u0434.<\/p>\n<p>  \u0427\u0442\u043e\u0436, \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0434 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e. \u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0441 \u0433\u0440\u0435\u0445\u043e\u043c \u043f\u043e\u043f\u043e\u043b\u0430\u043c \u043d\u043e\u0432\u0443\u044e \u043d\u043e\u0434\u0443 (\u0447\u0430\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0430\u0441\u044c, \u0447\u0430\u0441\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435 \u043b\u043e\u043c\u0430\u043b\u0430), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u043e\u0434 \u0438 \u0442.\u0434.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438 \u0431\u0435\u0441\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043c\u0435\u0440\u0442\u0435\u0439 \u043d\u0435\u0440\u0432\u043d\u044b\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u0430\u043b. \u041e\u0434\u043d\u0430 \u043d\u043e\u0434\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0438 \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u0434\u0440\u0443\u0433\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0430\u043b\u0430 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0431\u0430\u0437\u0435, \u0442\u0440\u0435\u0442\u044c\u044f \u0434\u0435\u043b\u0430\u043b\u0430 \u0432\u0438\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0430\u044f \u043a\u0443\u0447\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u043d\u0435\u0441\u0442\u044b\u043a\u043e\u0432\u043e\u043a. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u043e \u0432 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u044f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b mysql 5.7. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043b \u0431\u0435\u0437\u0434\u0443\u043c\u043d\u044b\u0435 \u043f\u043e\u0442\u0443\u0433\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e \u0431\u0443\u043c\u0430\u0436\u043a\u0435 \u0438 \u0441\u0442\u0430\u043b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0442\u044b\u043a\u0430. \u0418 \u0433\u0443\u0433\u043b\u0430.<\/p>\n<p>  \u041f\u0430\u0440\u0430 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0432\u0435\u0447\u0435\u0440\u043e\u0432 \u0438 \u043d\u043e\u0447\u0435\u0439 \u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441\u043e\u0431\u0440\u0430\u043b\u0441\u044f \u0438 \u0434\u0430\u0436\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0440\u0443\u0448\u0438\u0442\u044c\u0441\u044f.<br \/>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u043b\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u0442.\u043a. \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 inndoDB cluster \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0438\u043c\u0435\u0435\u043c \u0442\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0438 \u0441\u043e \u0441\u0432\u0435\u0436\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c Centos 7.5 minimal 1804 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 selinux \u0438 firewalld:<\/p>\n<p>  1.1.1.1<br \/>  1.1.1.2<br \/>  1.1.1.3<\/p>\n<p>  \u041f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b mysql 5.7, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 1.1.1.1:<\/p>\n<p>  1. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 mysql-community:<\/p>\n<pre><code>rpm -i https:\/\/dev.mysql.com\/get\/mysql80-community-release-el7-1.noarch.rpm<\/code><\/pre>\n<p>  \u0412\u044b\u043a\u043b\u044e\u0447\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f 8, \u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0434\u043b\u044f 5.7 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u2014 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043e\u043a, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c mysql:<\/p>\n<pre><code>yum install yum-utils yum-config-manager --disable mysql80-community yum-config-manager --enable mysql57-community yum repolist yum install mysql-community-server mysql-shell<\/code><\/pre>\n<p>  2. \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \/etc\/my.cnf \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<pre><code>[mysqld]  datadir=\/var\/lib\/mysql socket=\/var\/lib\/mysql\/mysql.sock  symbolic-links=0  log-error=\/var\/log\/mysqld.log pid-file=\/var\/run\/mysqld\/mysqld.pid  bind-address=0.0.0.0 port=3301 # Replication part server_id=1 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 plugin-load = group_replication.so # Group replication part transaction_write_set_extraction=XXHASH64 loose-group_replication_start_on_boot = OFF loose-group_replication_local_address = 1.1.1.1:33011 loose-group_replication_bootstrap_group = OFF report_port = 3301 report_host = 1.1.1.1 <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c 3301 \u044d\u0442\u043e \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c mysql, \u0430 33011 \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u043e\u0434\u044b \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<p>  3. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c mysql \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443:<\/p>\n<pre><code>systemctl start mysqld grep 'password' \/var\/log\/mysqld.log mysql_secure_installation<\/code><\/pre>\n<p>  4. \u041d\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043c. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 ip-\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u043e\u0434, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0445 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432 ipWhitelist. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043f\u0440\u043e 1.1.1.2. \u0438 1.1.1.3:<\/p>\n<pre><code>mysqlsh &gt; \\c 127.0.0.1:3301 &gt; dba.configureLocalInstance(&quot;127.0.0.1:3301&quot;, {mycnfPath: &quot;\/etc\/my.cnf&quot;, clusterAdmin: &quot;cladmin&quot;, clusterAdminPassword: &quot;SomePassword!123&quot;}) &gt; \\c cladmin@1.1.1.1:3301 &gt; dba.checkInstanceConfiguration() &gt; cl=dba.createCluster('TestCluster', {ipWhitelist: '1.1.1.1'}) &gt; dba.configureLocalInstance() &gt; cl.status()<\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e! cl.status \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>{     &quot;clusterName&quot;: &quot;TestCluster&quot;,     &quot;defaultReplicaSet&quot;: {         &quot;name&quot;: &quot;default&quot;,         &quot;primary&quot;: &quot;1.1.1.1:3301&quot;,         &quot;ssl&quot;: &quot;REQUIRED&quot;,         &quot;status&quot;: &quot;OK_NO_TOLERANCE&quot;,         &quot;statusText&quot;: &quot;Cluster is NOT tolerant to any failures.&quot;,         &quot;topology&quot;: {             &quot;1.1.1.1:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.1:3301&quot;,                 &quot;mode&quot;: &quot;R\/W&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             }         }     },     &quot;groupInformationSourceMember&quot;: &quot;mysql:\/\/cladmin@1.1.1.1:3301&quot; } <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u043e\u0434\u0430\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 dba.configureLocalInstance() \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<pre><code>WARNING: On instance '1.1.1.1:3301' membership change cannot be persisted since MySQL version 5.7.23 does not support the SET PERSIST command (MySQL version &gt;= 8.0.11 required). Please use the &lt;Dba&gt;.configureLocalInstance command locally to persist the changes.<\/code><\/pre>\n<p>   \u0422.\u043a. \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u043d\u043e\u0434, \u0442\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u044f\u0437\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c 1.1.1.1, \u043e\u043d \u043d\u0430\u043c \u0435\u0449\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u043e\u0434\u0443 1.1.1.2. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430 \u043d\u0435\u0439 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043e 3 \u0448\u0430\u0433\u0430 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c server_id, loose-group_replication_local_address \u0438 report_host. <\/p>\n<p>  4. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430 1.1.1.2:<\/p>\n<pre><code>mysql -p &gt; set GLOBAL group_replication_allow_local_disjoint_gtids_join=ON;<\/code><\/pre>\n<p>  \u042f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0447\u0435\u0440\u0435\u0437 mysqlsh, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u0432 \u0440\u0435\u0436\u0438\u043c sql, \u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u0430\u043c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u043b\u0438 \u043d\u0430 \u043d\u0435\u0435 \u0432 mysql. \u0414\u0430\u043b\u0435\u0435:<\/p>\n<pre><code>mysqlsh &gt; \\c 127.0.0.1:3301 &gt; dba.configureLocalInstance(&quot;127.0.0.1:3301&quot;, {mycnfPath: &quot;\/etc\/my.cnf&quot;, clusterAdmin: &quot;cladmin&quot;, clusterAdminPassword: &quot;SomePassword!123&quot;}) &gt; \\c cladmin@1.1.1.2:3301 &gt; dba.checkInstanceConfiguration()<\/code><\/pre>\n<p>  5. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0434\u0435 1.1.1.1. \u0415\u0441\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u043b\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u0442\u0430\u043a:<\/p>\n<pre><code>mysqlsh --uri cladmin@1.1.1.1:3301 --cluster &gt; \\sql &gt; STOP GROUP_REPLICATION; &gt; SET GLOBAL group_replication_ip_whitelist=&quot;1.1.1.1,1.1.1.2&quot;; &gt; START GROUP_REPLICATION; &gt; \\js &gt; cluster.addInstance('cladmin@1.1.1.2:3301', {ipWhitelist: '1.1.1.1,1.1.1.2'}) &gt; cluster.status() <\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0434\u044b \u0431\u0435\u0437 \u043e\u043f\u0446\u0438\u0438 ipWhitelist \u043e\u043d \u0435\u0439 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<br \/>  \u0415\u0441\u043b\u0438 whitelist \u0443 \u0432\u0430\u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0432\u0441\u0435 \u043d\u043e\u0434\u044b \u0438\u043b\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u044c, \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 sql \u0440\u0435\u0436\u0438\u043c\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c dba.configureLocalInstance() \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u043e\u0434\u0430\u0445 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0445 \u0434\u0432\u0443\u0445 \u043d\u043e\u0434:<\/p>\n<pre><code>{     &quot;clusterName&quot;: &quot;TestCluster&quot;,     &quot;defaultReplicaSet&quot;: {         &quot;name&quot;: &quot;default&quot;,         &quot;primary&quot;: &quot;1.1.1.1:3301&quot;,         &quot;ssl&quot;: &quot;REQUIRED&quot;,         &quot;status&quot;: &quot;OK_NO_TOLERANCE&quot;,         &quot;statusText&quot;: &quot;Cluster is NOT tolerant to any failures.&quot;,         &quot;topology&quot;: {             &quot;1.1.1.1:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.1:3301&quot;,                 &quot;mode&quot;: &quot;R\/W&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             },             &quot;1.1.1.2:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.2:3301&quot;,                 &quot;mode&quot;: &quot;R\/O&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             }         }     },     &quot;groupInformationSourceMember&quot;: &quot;mysql:\/\/cladmin@1.1.1.1:3301&quot; } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0436, \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043d\u043e\u0434 \u0435\u0441\u0442\u044c, \u043d\u043e \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u00abCluster is NOT tolerant to any failures.\u00bb<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0440\u0435\u0442\u044c\u044e, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0439.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043e\u043f\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c whitelist, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u0434\u043e \u043d\u0430 r\/w \u043d\u043e\u0434\u0435, \u0442.\u043a. \u043d\u0430 r\/o \u043d\u043e\u0434\u0430\u0445 \u044d\u0442\u043e \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0432\u0440\u043e\u0434\u0435 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c r\/o \u043d\u043e\u0434\u044b \u043e\u0442\u0432\u0430\u043b\u044f\u0442\u0441\u044f \u0438 \u0438\u0445 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0432 \u043d\u043e\u0432\u044b\u0439 whitelist.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435:<\/p>\n<pre><code>&gt; cluster.rejoinInstance('cladmin@1.1.1.2:3301', {ipWhitelist: '1.1.1.1,1.1.1.2,1.1.1.3'})<\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c dba.configureLocalInstance() \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u043e\u0434\u0430\u0445 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043d\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>{     &quot;clusterName&quot;: &quot;TestCluster&quot;,     &quot;defaultReplicaSet&quot;: {         &quot;name&quot;: &quot;default&quot;,         &quot;primary&quot;: &quot;1.1.1.1:3301&quot;,         &quot;ssl&quot;: &quot;REQUIRED&quot;,         &quot;status&quot;: &quot;OK&quot;,         &quot;statusText&quot;: &quot;Cluster is ONLINE and can tolerate up to ONE failure.&quot;,         &quot;topology&quot;: {             &quot;1.1.1.1:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.1:3301&quot;,                 &quot;mode&quot;: &quot;R\/W&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             },             &quot;1.1.1.2:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.2:3301&quot;,                 &quot;mode&quot;: &quot;R\/O&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             },             &quot;1.1.1.3:3301&quot;: {                 &quot;address&quot;: &quot;1.1.1.3:3301&quot;,                 &quot;mode&quot;: &quot;R\/O&quot;,                 &quot;readReplicas&quot;: {},                 &quot;role&quot;: &quot;HA&quot;,                 &quot;status&quot;: &quot;ONLINE&quot;             }         }     },     &quot;groupInformationSourceMember&quot;: &quot;mysql:\/\/cladmin@1.1.1.1:3301&quot; } <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0440\u0430\u0437\u0432\u0430\u043b\u0438\u043b\u0441\u044f \u0434\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u043d\u043e\u0434\u044b, \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c loose-group_replication_bootstrap_group = ON \u0432 \/etc\/my.cnf<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u044d\u0442\u0430 \u043d\u043e\u0434\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 mysql-router \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u0443\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0432\u0438\u0436\u0443.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435 \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/423587\/\"> https:\/\/habr.com\/post\/423587\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  \u041a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0435\u0441\u0442\u044c \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 innoDB cluster \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0430\u0445 \u0441 centos 7.5, \u043d\u0430\u0434\u043e \u0435\u0433\u043e \u043f\u043e\u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u043d\u043e\u0434. \u041c\u043e\u0436\u043d\u043e \u043b\u043e\u043c\u0430\u0442\u044c \u0438 \u0438\u0437\u0434\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e. \u0417\u0432\u0443\u0447\u0438\u0442 \u0437\u0430\u043c\u0430\u043d\u0447\u0438\u0432\u043e.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-289520","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289520"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289520\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}