{"id":1578,"date":"2023-03-11T17:41:07","date_gmt":"2023-03-11T14:41:07","guid":{"rendered":"https:\/\/virtirio.com\/blog\/?p=1578"},"modified":"2025-03-25T13:22:25","modified_gmt":"2025-03-25T10:22:25","slug":"mysql-galera-%d0%b2-ubuntu","status":"publish","type":"post","link":"https:\/\/virtirio.com\/blog\/uk\/mysql-galera-%d0%b2-ubuntu\/","title":{"rendered":"\u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f MySQL \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Galera \u0432 Ubuntu 22.04"},"content":{"rendered":"<p>MySQL \u0454 \u043e\u0434\u043d\u0456\u0454\u044e \u0437 \u043d\u0430\u0439\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0456\u0448\u0438\u0445 \u0440\u0435\u043b\u044f\u0446\u0456\u0439\u043d\u0438\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u0438\u0445 \u0443 \u0441\u0432\u0456\u0442\u0456, \u044f\u043a\u0430 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u043d\u043d\u044f \u0442\u0430 \u043e\u0431\u0440\u043e\u0431\u043a\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 \u0440\u0456\u0437\u043d\u0438\u0445 \u0434\u043e\u0434\u0430\u0442\u043a\u0430\u0445. \u041f\u0440\u043e\u0442\u0435, \u044f\u043a \u0456 \u0431\u0443\u0434\u044c-\u044f\u043a\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u0438\u0445, MySQL \u043c\u043e\u0436\u0435 \u0437\u0456\u0442\u043a\u043d\u0443\u0442\u0438\u0441\u044f \u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u044e \u0432\u0456\u0434\u043c\u043e\u0432\u0438 \u0430\u0431\u043e \u0437\u0431\u043e\u044e, \u0449\u043e \u043c\u043e\u0436\u0435 \u043f\u0440\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0434\u043e \u0432\u0442\u0440\u0430\u0442\u0438 \u0434\u0430\u043d\u0438\u0445 \u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0438. \u041a\u043b\u0430\u0441\u0442\u0435\u0440 Galera \u2014 \u0446\u0435 \u0440\u0456\u0448\u0435\u043d\u043d\u044f, \u044f\u043a\u0435 \u0434\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u0441\u0442\u0432\u043e\u0440\u044e\u0432\u0430\u0442\u0438 \u0432\u0438\u0441\u043e\u043a\u043e\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0456 \u0442\u0430 \u0432\u0456\u0434\u043c\u043e\u0432\u043e\u0441\u0442\u0456\u0439\u043a\u0456 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438 MySQL, \u0434\u0435 \u0434\u0430\u043d\u0456 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u044e\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0456\u043b\u044c\u043a\u043e\u0445 \u0432\u0443\u0437\u043b\u0430\u0445 \u0456 \u043c\u043e\u0436\u0443\u0442\u044c \u0431\u0443\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u043c\u0438 \u043d\u0430\u0432\u0456\u0442\u044c \u043f\u0440\u0438 \u0432\u0456\u0434\u043c\u043e\u0432\u0456 \u043e\u0434\u043d\u043e\u0433\u043e \u0437 \u043d\u0438\u0445. \u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u043c\u0438 \u0440\u043e\u0437\u0433\u043b\u044f\u043d\u0435\u043c\u043e, \u044f\u043a \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0438 \u0442\u0430 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0432\u0438\u0441\u043e\u043a\u043e\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u0432\u0456\u0434\u043c\u043e\u0432\u043e\u0441\u0442\u0456\u0439\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Galera \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0456\u0439\u043d\u0456\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0456 Ubuntu 22.04.<\/p>\n<h3>\u041a\u0440\u043e\u043a 1: \u0412\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u043d\u0435\u043e\u0431\u0445\u0456\u0434\u043d\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u0456\u0432<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f MySQL \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Galera <em>(\u043e\u0444\u0456\u0446\u0456\u0439\u043d\u0438\u0439 \u0441\u0430\u0439\u0442: <a href=\"https:\/\/galeracluster.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/galeracluster.com\/<\/a>)<\/em> \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u0456\u0434\u043d\u043e \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0456 \u043f\u0430\u043a\u0435\u0442\u0438:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt update\r\nsudo apt install software-properties-common\r\nsudo add-apt-repository universe\r\nsudo apt update\r\nsudo apt install galera-4 mysql-server-8.0 mysql-client-8.0\r\n<\/pre>\n<h3>\u041a\u0440\u043e\u043a 2: \u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<p>\u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0447\u0438\u043d\u0430\u0454\u0442\u044c\u0441\u044f \u0437\u0456 \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u043a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0430\u0446\u0456\u0439\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0443 <code>\/etc\/mysql\/conf.d\/galera.cnf<\/code> \u0437 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u043c \u0432\u043c\u0456\u0441\u0442\u043e\u043c:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[mysqld]\r\nbinlog_format=ROW\r\ndefault-storage-engine=innodb\r\ninnodb_autoinc_lock_mode=2\r\nbind-address=0.0.0.0\r\n# Galera Provider Configuration\r\nwsrep_on=ON\r\nwsrep_provider=\/usr\/lib\/galera-4\/libgalera_smm.so\r\n# Galera Cluster Configuration\r\nwsrep_cluster_name=\"test_cluster\"\r\nwsrep_cluster_address=\"gcomm:\/\/\"\r\n# Galera Synchronization Configuration\r\nwsrep_sst_method=rsync\r\n<\/pre>\n<p>\u0422\u0443\u0442 \u043c\u0438 \u0432\u043c\u0438\u043a\u0430\u0454\u043c\u043e \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0443 \u0431\u0456\u043d\u0430\u0440\u043d\u0438\u0445 \u043b\u043e\u0433\u0456\u0432 ROW, \u0432\u043a\u0430\u0437\u0443\u0454\u043c\u043e \u0441\u0445\u043e\u0432\u0438\u0449\u0435 \u0437\u0430 \u0437\u0430\u043c\u043e\u0432\u0447\u0443\u0432\u0430\u043d\u043d\u044f\u043c InnoDB, \u0437\u0430\u0434\u0430\u0454\u043c\u043e \u0440\u0435\u0436\u0438\u043c \u0431\u043b\u043e\u043a\u0443\u0432\u0430\u043d\u043d\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0456\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0456\u0432 \u0442\u0430 \u0432\u0456\u0434\u043a\u0440\u0438\u0432\u0430\u0454\u043c\u043e \u043f\u0440\u0438\u0432\u2019\u044f\u0437\u043a\u0443 \u0434\u043e \u0431\u0443\u0434\u044c-\u044f\u043a\u043e\u0457 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0457 IP-\u0430\u0434\u0440\u0435\u0441\u0438. \u041f\u043e\u0442\u0456\u043c \u043c\u0438 \u0432\u043a\u0430\u0437\u0443\u0454\u043c\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438 \u0434\u043b\u044f \u043f\u0456\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044f \u0434\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Galera \u0442\u0430 \u043c\u0435\u0442\u043e\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0456\u0437\u0430\u0446\u0456\u0457 SST (State Snapshot Transfer).<\/p>\n<p>\u041f\u0456\u0441\u043b\u044f \u0442\u043e\u0433\u043e \u044f\u043a \u043c\u0438 \u0441\u0442\u0432\u043e\u0440\u0438\u043b\u0438 \u043a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0430\u0446\u0456\u0439\u043d\u0438\u0439 \u0444\u0430\u0439\u043b, \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0438:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo galera_new_cluster\r\n<\/pre>\n<h3>\u041a\u0440\u043e\u043a 3: \u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<p>\u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u0430\u0439\u0436\u0435 \u0456\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0435 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044e \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u0444\u0430\u0439\u043b <code>\/etc\/mysql\/conf.d\/galera.cnf<\/code> \u0437 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u043c \u0432\u043c\u0456\u0441\u0442\u043e\u043c:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[mysqld]\r\nbinlog_format=ROW\r\ndefault-storage-engine=innodb\r\ninnodb_autoinc_lock_mode=2\r\nbind-address=0.0.0.0\r\n# Galera Provider Configuration\r\nwsrep_on=ON\r\nwsrep_provider=\/usr\/lib\/galera-4\/libgalera_smm.so\r\n# Galera Cluster Configuration\r\nwsrep_cluster_name=\"test_cluster\"\r\nwsrep_cluster_address=\"gcomm:\/\/&lt;ip-\u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;\"\r\n# Galera Synchronization Configuration\r\nwsrep_sst_method=rsync\r\n<\/pre>\n<p>\u0417\u0430\u043c\u0456\u043d\u0456\u0442\u044c <code>&lt;ip-\u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;<\/code> \u043d\u0430 IP-\u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u043e\u0442\u0456\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u0441\u043b\u0443\u0436\u0431\u0443 MySQL \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl start mysql\r\n<\/pre>\n<h3>\u041a\u0440\u043e\u043a 4: \u041f\u0435\u0440\u0435\u0432\u0456\u0440\u043a\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430<\/h3>\n<p>\u041f\u0456\u0441\u043b\u044f \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0442\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0456\u0432 \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0442\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0432\u0438\u043a\u043e\u043d\u0430\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo mysql -u root -p -e \"SHOW STATUS LIKE 'wsrep_cluster_size'\"\r\n<\/pre>\n<p>\u0426\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0432\u0438\u043d\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u044f\u043a\u0438\u0439 \u043f\u043e\u0432\u0438\u043d\u0435\u043d \u0431\u0443\u0442\u0438 \u0440\u0456\u0432\u043d\u0438\u043c \u0434\u0432\u043e\u043c (\u043e\u0434\u0438\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0430 \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430).<\/p>\n<h3>\u041a\u0440\u043e\u043a 5: \u041f\u0435\u0440\u0435\u0432\u0456\u0440\u043a\u0430 \u0440\u0435\u043f\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u0434\u0430\u043d\u0438\u0445<\/h3>\n<p>\u041c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0442\u0438, \u0449\u043e \u0434\u0430\u043d\u0456 \u0440\u0435\u043f\u043b\u0456\u043a\u0443\u044e\u0442\u044c\u0441\u044f \u043c\u0456\u0436 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438, \u0441\u0442\u0432\u043e\u0440\u0438\u0432\u0448\u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456 \u0442\u0430 \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0432\u0448\u0438 \u0457\u0457 \u043d\u0430\u044f\u0432\u043d\u0456\u0441\u0442\u044c \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0432\u0438\u043a\u043e\u043d\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0456 \u043a\u043e\u043c\u0430\u043d\u0434\u0438 \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo mysql -u root -p -e \"CREATE DATABASE test_db\"\r\nsudo mysql -u root -p -e \"CREATE TABLE test_db.test_table (id INT PRIMARY KEY, name VARCHAR(50))\"\r\nsudo mysql -u root -p -e \"INSERT INTO test_db.test_table (id, name) VALUES (1, 'Test Data')\"\r\n<\/pre>\n<p>\u041f\u043e\u0442\u0456\u043c \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043d\u0430\u044f\u0432\u043d\u0456\u0441\u0442\u044c \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo mysql -u root -p -e \"SHOW DATABASES\"\r\nsudo mysql -u root -p -e \"USE test_db; SELECT * FROM test_table\"\r\n<\/pre>\n<p>\u042f\u043a\u0449\u043e \u0434\u0430\u043d\u0456 \u0440\u0435\u043f\u043b\u0456\u043a\u0443\u044e\u0442\u044c\u0441\u044f \u0443\u0441\u043f\u0456\u0448\u043d\u043e, \u0432\u0438 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u043f\u043e\u0431\u0430\u0447\u0438\u0442\u0438 \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044e, \u0430 \u0442\u0430\u043a\u043e\u0436 \u0434\u043e\u0434\u0430\u043d\u0438\u0439 \u0437\u0430\u043f\u0438\u0441 \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0456.<\/p>\n<h3>\u041a\u0440\u043e\u043a 6: \u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f<\/h3>\n<p>\u041d\u0430\u0440\u0435\u0448\u0442\u0456, \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0434\u043b\u044f \u0440\u043e\u0437\u043f\u043e\u0434\u0456\u043b\u0443 \u0442\u0440\u0430\u0444\u0456\u043a\u0443 \u043c\u0456\u0436 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0456. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u0430 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u0442\u0438 \u0431\u0443\u0434\u044c-\u044f\u043a\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f, \u0442\u0430\u043a\u0438\u0439 \u044f\u043a HAProxy \u0430\u0431\u043e NGINX.<\/p>\n<blockquote><p><em>\u0412\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u0430 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f <a href=\"https:\/\/virtirio.com\/blog\/uk\/nginx-%d0%b1%d0%b0%d0%bb%d0%b0%d0%bd%d1%81%d1%83%d0%b2%d0%b0%d0%bb%d1%8c%d0%bd%d0%bd%d1%8f-%d0%bd%d0%b0%d0%b2%d0%b0%d0%bd%d1%82%d0%b0%d0%b6%d0%b5%d0%bd%d0%bd%d1%8f\/\">Nginx \u0443 \u044f\u043a\u043e\u0441\u0442\u0456 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f<\/a> \u043c\u0438 \u0432\u0436\u0435 \u0440\u043e\u0437\u0433\u043b\u044f\u0434\u0430\u043b\u0438.<\/em><\/p><\/blockquote>\n<p>\u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u0434\u043b\u044f \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f HAProxy \u0441\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u0444\u0430\u0439\u043b <code>\/etc\/haproxy\/haproxy.cfg<\/code> \u0437 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u043c \u0432\u043c\u0456\u0441\u0442\u043e\u043c:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">frontend mysql-cluster\r\n    bind &lt;ip-\u0430\u0434\u0440\u0435\u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a\u0430&gt;:3306\r\n    mode tcp\r\n    default_backend mysql-nodes\r\n\r\nbackend mysql-nodes\r\n    mode tcp\r\n    balance roundrobin\r\n    option tcpka\r\n    option mysql-check user haproxy_check\r\n    server node1 &lt;ip-\u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;:3306 check weight 1\r\n    server node2 &lt;ip-\u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;:3306 check weight 1\r\n<\/pre>\n<p>\u0417\u0430\u043c\u0456\u043d\u0456\u0442\u044c <code>&lt;ip-\u0430\u0434\u0440\u0435\u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a\u0430&gt;<\/code>, <code>&lt;ip-\u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;<\/code> \u0442\u0430 <code>&lt;ip-\u0430\u0434\u0440\u0435\u0441 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430&gt;<\/code> \u043d\u0430 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u0456 IP-\u0430\u0434\u0440\u0435\u0441\u0438. \u041f\u043e\u0442\u0456\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u0441\u043b\u0443\u0436\u0431\u0443 HAProxy:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl start haproxy\r\n<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440 \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0456\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u0438\u0441\u044f \u0434\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f, \u044f\u043a\u0438\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0440\u043e\u0437\u043f\u043e\u0434\u0456\u043b\u044f\u0442\u0438\u043c\u0435 \u0442\u0440\u0430\u0444\u0456\u043a \u043c\u0456\u0436 \u043f\u0435\u0440\u0432\u0438\u043d\u043d\u0438\u043c \u0442\u0430 \u0432\u0442\u043e\u0440\u0438\u043d\u043d\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0456.<\/p>\n<h3>\u041a\u0440\u043e\u043a 7: \u041e\u0431\u0441\u043b\u0443\u0433\u043e\u0432\u0443\u0432\u0430\u043d\u043d\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Galera<\/h3>\n<p>\u042f\u043a \u0456 \u0431\u0443\u0434\u044c-\u044f\u043a\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u0438\u0445, \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Galera \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0454 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u0441\u043b\u0443\u0433\u043e\u0432\u0443\u0432\u0430\u043d\u043d\u044f \u0434\u043b\u044f \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0457 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0456 \u0442\u0430 \u043d\u0430\u0434\u0456\u0439\u043d\u043e\u0441\u0442\u0456. \u041e\u0441\u044c \u0434\u0435\u044f\u043a\u0456 \u0437\u0430\u0433\u0430\u043b\u044c\u043d\u0456 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0456\u0457 \u0437 \u043e\u0431\u0441\u043b\u0443\u0433\u043e\u0432\u0443\u0432\u0430\u043d\u043d\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Galera:<\/p>\n<ul>\n<li>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u044f\u0439\u0442\u0435 \u0441\u0442\u0430\u043d \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0442\u0430 \u0441\u0442\u0430\u0442\u0443\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0456\u0437\u0430\u0446\u0456\u0457 \u0432\u0443\u0437\u043b\u0456\u0432. \u0426\u0435 \u043c\u043e\u0436\u043d\u0430 \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0438 <code>SHOW STATUS LIKE 'wsrep_%'<\/code>.<\/li>\n<li>\u0420\u0435\u0437\u0435\u0440\u0432\u0443\u0439\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043d\u044c\u043e \u043c\u0456\u0441\u0446\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0443 \u0434\u043b\u044f \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0442\u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0456\u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0456\u0439.<\/li>\n<li>\u041e\u043f\u0442\u0438\u043c\u0456\u0437\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u0442\u0438 \u0442\u0430 \u0456\u043d\u0434\u0435\u043a\u0441\u0438 \u0434\u043b\u044f \u043f\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0456.<\/li>\n<li>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u0443\u0439\u0442\u0435 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0442\u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0456\u0439 \u0434\u043b\u044f \u0437\u0430\u0445\u0438\u0441\u0442\u0443 \u0432\u0456\u0434 \u0432\u0442\u0440\u0430\u0442\u0438 \u0434\u0430\u043d\u0438\u0445.<\/li>\n<li>\u041e\u043d\u043e\u0432\u043b\u044e\u0439\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0435 \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0435\u043d\u043d\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0447\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Galera, \u0449\u043e\u0431 \u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u0442\u0438 \u043e\u0441\u0442\u0430\u043d\u043d\u0456 \u0432\u0438\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044f \u043f\u043e\u043c\u0438\u043b\u043e\u043a \u0442\u0430 \u043f\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0456.<\/li>\n<\/ul>\n<h3>\u0412\u0438\u0441\u043d\u043e\u0432\u043a\u0438<\/h3>\n<p>\u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u043c\u0438 \u0440\u043e\u0437\u0433\u043b\u044f\u043d\u0443\u043b\u0438, \u044f\u043a \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0438 \u0442\u0430 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Galera \u043d\u0430 Ubuntu 22.04. \u041c\u0438 \u043f\u0440\u043e\u0439\u0448\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0443\u0441\u0456 \u043d\u0435\u043e\u0431\u0445\u0456\u0434\u043d\u0456 \u043a\u0440\u043e\u043a\u0438, \u043f\u043e\u0447\u0438\u043d\u0430\u044e\u0447\u0438 \u0432\u0456\u0434 \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f MySQL, \u0434\u043e \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0442\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0443\u0432\u0430\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f. \u0422\u0430\u043a\u043e\u0436 \u043c\u0438 \u0440\u043e\u0437\u0433\u043b\u044f\u043d\u0443\u043b\u0438 \u0434\u0435\u044f\u043a\u0456 \u0437\u0430\u0433\u0430\u043b\u044c\u043d\u0456 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0456\u0457 \u0437 \u043e\u0431\u0441\u043b\u0443\u0433\u043e\u0432\u0443\u0432\u0430\u043d\u043d\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0421\u043f\u043e\u0434\u0456\u0432\u0430\u044e\u0441\u044c, \u0446\u0435\u0439 \u043c\u0430\u0442\u0435\u0440\u0456\u0430\u043b \u0434\u043e\u043f\u043e\u043c\u043e\u0436\u0435 \u0432\u0430\u043c \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Galera \u0442\u0430 \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0438\u0442\u0438 \u043d\u0430\u0434\u0456\u0439\u043d\u0443 \u0442\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0434\u043b\u044f \u0432\u0430\u0448\u043e\u0433\u043e \u043f\u0440\u043e\u0454\u043a\u0442\u0443.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u0454 \u043e\u0434\u043d\u0456\u0454\u044e \u0437 \u043d\u0430\u0439\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0456\u0448\u0438\u0445 \u0440\u0435\u043b\u044f\u0446\u0456\u0439\u043d\u0438\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u0438\u0445 \u0443 \u0441\u0432\u0456\u0442\u0456, \u044f\u043a\u0430 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u043d\u043d\u044f \u0442\u0430 \u043e\u0431\u0440\u043e\u0431\u043a\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 \u0440\u0456\u0437\u043d\u0438\u0445 \u0434\u043e\u0434\u0430\u0442\u043a\u0430\u0445. \u041f\u0440\u043e\u0442\u0435, \u044f\u043a \u0456 \u0431\u0443\u0434\u044c-\u044f\u043a\u0430 \u0431\u0430\u0437\u0430&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1948,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[],"class_list":["post-1578","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-50"],"_links":{"self":[{"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/posts\/1578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/comments?post=1578"}],"version-history":[{"count":3,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/posts\/1578\/revisions"}],"predecessor-version":[{"id":1762,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/posts\/1578\/revisions\/1762"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/media\/1948"}],"wp:attachment":[{"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/media?parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/categories?post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtirio.com\/blog\/wp-json\/wp\/v2\/tags?post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}