{"id":122,"date":"2018-04-28T14:33:34","date_gmt":"2018-04-28T05:33:34","guid":{"rendered":"https:\/\/0x0c.info\/?p=122"},"modified":"2018-04-28T14:33:34","modified_gmt":"2018-04-28T05:33:34","slug":"%e3%80%90centos7%e3%80%91-mysql-innodb-cluster-%e3%81%ae%e6%a7%8b%e7%af%89","status":"publish","type":"post","link":"https:\/\/0x0c.info\/?p=122","title":{"rendered":"\u3010CentOS7\u3011 MySQL InnoDB Cluster \u306e\u69cb\u7bc9"},"content":{"rendered":"<p>\t\t\t\t\u8a73\u3057\u304f\u306f <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/mysql-innodb-cluster-production-deployment.html\">https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/mysql-innodb-cluster-production-deployment.html<\/a> \u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<hr \/>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>CentOS7\u30b5\u30fc\u30d0\u30923\u304b\u30894\u53f0\u304f\u3089\u3044\u8d77\u52d5\u3057\u307e\u3059\u3002<br \/>\n\u6700\u4f4e3\u53f0\u306eDB\u30b5\u30fc\u30d0\u3068\u4e00\u53f0\u306e\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\n\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u306fDB\u30b5\u30fc\u30d0\u3068\u540c\u5c45\u3067\u304d\u307e\u3059\u304c\u3001\u3067\u304d\u308c\u3070\u5206\u96e2\u3057\u305f\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<br \/>\n\u305d\u3046\u3059\u308b\u30684\u53f0\u304c\u6700\u5c0f\u69cb\u6210\u3068\u306a\u308a\u307e\u3059(DB\u30b5\u30fc\u30d0x3\u53f0+\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0x1\u53f0)<\/p>\n<hr \/>\n<h2>\u521d\u671f\u8a2d\u5b9a<\/h2>\n<p>\u5168\u53f0\u3068\u3082\u306b<br \/>\n<code>#vi \/etc\/selinux\/config<\/code> \u3068\u3057<\/p>\n<pre><code>SELINUX=disabled\n<\/code><\/pre>\n<p>\u3068\u3057\u3066\u304b\u3089 <code>reboot<\/code> \u3057\u3001<\/p>\n<pre><code># yum install -y http:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm\n# yum remove -y mysql-libs\n<\/code><\/pre>\n<p>\u3092\u5b9f\u884c\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<hr \/>\n<h2>db\u30b5\u30fc\u30d0\u306e\u8a2d\u5b9a<\/h2>\n<p>\u4e0b\u8a18\u306e\u8a2d\u5b9a\u30923\u53f0\u304b\u305d\u308c\u4ee5\u4e0a\u306edb\u30b5\u30fc\u30d0\u306b\u9069\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code># yum install -y mysql-server mysql-shell\n# service mysqld start\n<\/code><\/pre>\n<p><code>$ cat \/var\/log\/mysqld.log | grep temporary<\/code> \u3068\u3057\u3001\u51fa\u3066\u304d\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3067 <code>mysql -u root -p<\/code> \u3068\u3057\u307e\u3059\u3002<\/p>\n<pre><code>SET PASSWORD = \"MySQL_5.7\";\nUNINSTALL PLUGIN validate_password;\nSET PASSWORD = \"\u306a\u306b\u304c\u3057\u304b\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\";\n\\q\n<\/code><\/pre>\n<p><code>$ mysqlsh<\/code> \u3068\u3057\u3001<\/p>\n<pre><code>    &gt;dba.configureLocalInstance('root@localhost:3306')\n\n    Please provide the password for 'root@localhost:3306':\n\n    Detecting the configuration file...\n    Found configuration file at standard location: \/etc\/my.cnf\n    Do you want to modify this file? [Y|n]:  [Y|n]: Y\n\n    MySQL user 'root' cannot be verified to have access to other hosts in the network.\n\n    1) Create root@% with necessary grants\n    2) Create account with different name\n    3) Continue without creating account\n    4) Cancel\n    Please select an option [1]: 2\n\n    account name= clusteradmin\n    &gt;\\q\n<\/code><\/pre>\n<p><code># service mysqld restart<\/code> \u3057\u307e\u3059\u3002<\/p>\n<hr \/>\n<h2>\u30af\u30e9\u30b9\u30bf\u306e\u4f5c\u6210<\/h2>\n<p>\u30af\u30e9\u30b9\u30bf\u306e\u3046\u3061\u306e\u3069\u308c\u304b\u304b\u3089\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p><code>$ mysqlsh<\/code><\/p>\n<pre><code>    dba.checkInstanceConfiguration('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d01\u306eIP\u30a2\u30c9\u30ec\u30b9:3306')\n    dba.checkInstanceConfiguration('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d02\u306eIP\u30a2\u30c9\u30ec\u30b9:3306')\n    dba.checkInstanceConfiguration('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d03\u306eIP\u30a2\u30c9\u30ec\u30b9:3306')\n    shell.connect('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d01\u306eIP\u30a2\u30c9\u30ec\u30b9:3306')\n    var cluster = dba.createCluster('Cluster001(\u2190\u30af\u30e9\u30b9\u30bf\u540d\u3001\u4efb\u610f\u306e\u540d\u524d\u3067ok\u3067\u3059)')\n    cluster.addInstance('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d02\u306eIP\u30a2\u30c9\u30ec\u30b9:3306');\n    cluster.addInstance('clusteradmin@\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d03\u306eIP\u30a2\u30c9\u30ec\u30b9:3306');\n<\/code><\/pre>\n<hr \/>\n<h2>\u30af\u30e9\u30b9\u30bf\u5316\u3055\u308c\u305f\u30b3\u30f3\u30d5\u30a3\u30b0\u306e\u4fdd\u5b58<\/h2>\n<p>\u5404db\u30b5\u30fc\u30d0\u3067\u4fee\u6b63\u3055\u308c\u305f\u30b3\u30f3\u30d5\u30a3\u30b0\u3092\u30bb\u30fc\u30d6\u3057\u307e\u3059\u3002<br \/>\n\u4e09\u53f0\u304b\u305d\u308c\u4ee5\u4e0a\u306edb\u30b5\u30fc\u30d0\u3059\u3079\u3066\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><code>$ mysqlsh<\/code><\/p>\n<pre><code>    &gt;dba.configureLocalInstance('clusteradmin@localhost:3306')\n<\/code><\/pre>\n<p>\u30b9\u30ec\u30fc\u30d6\u30b5\u30fc\u30d0\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059<\/p>\n<pre><code>    Do you want to disable super_read_only and continue? [y|N]:y\n<\/code><\/pre>\n<hr \/>\n<h2>router\u30b5\u30fc\u30d0\u306e\u8a2d\u5b9a<\/h2>\n<p>\u901a\u5e38\u3001db\u30b5\u30fc\u30d0\u3067\u306f\u306a\u3044\u30b5\u30fc\u30d0\u3067router\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code># yum install -y mysql-router mysql-shell\n$ mysqlrouter --bootstrap clusteradmin@\u30af\u30e9\u30b9\u30bf1\u306eIP\u30a2\u30c9\u30ec\u30b9:3306 --user=mysqlrouter --conf-base-port 3306\n# service mysqlrouter start\n<\/code><\/pre>\n<hr \/>\n<h2>\u304a\u307e\u3051<\/h2>\n<p>\u3061\u3083\u3093\u3068\u52d5\u3044\u3066\u308b\u304b\u3069\u3046\u304b\u30c6\u30b9\u30c8<\/p>\n<pre><code># \u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d01\u304c r\/w server\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u3046\u306e\u3067\u3001 root\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002 \u672c\u756a\u74b0\u5883\u3067\u306fadmin\u306e\u63a5\u7d9a\u5143\u3092\u5236\u9650\u3057\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\ncreate user admin@'%' identified by 'admin';\ngrant all on *.* to admin@'%';\n\n# \u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3001sql\u304c\u30af\u30e9\u30b9\u30bf\u5185db\u30b5\u30fc\u30d0\u3059\u3079\u3066\u306b\u53cd\u6620\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002\n$ mysql-shell\nmysql-sql&gt; \\connect admin@10.10.16.209   \/\/\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u81ea\u8eab\u306e\u30a2\u30c9\u30ec\u30b9\ncreate database testbase;\nuse testbase;\nCREATE TABLE item (\n  id INT PRIMARY KEY AUTO_INCREMENT,\n  name VARCHAR(10),\n  description VARCHAR(30),\n  price INT UNSIGNED,\n  created_at DATETIME\n);\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8a73\u3057\u304f\u306f https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/mysql-innodb-cluster-production-deployment.html \u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002 \u306f\u3058\u3081\u306b CentOS7\u30b5\u30fc\u30d0\u30923\u304b\u30894\u53f0\u304f\u3089\u3044\u8d77\u52d5\u3057\u307e\u3059\u3002 \u6700\u4f4e3\u53f0\u306eDB\u30b5\u30fc\u30d0\u3068\u4e00\u53f0\u306e\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u304c\u5fc5\u8981\u3067\u3059\u3002 \u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0\u306fDB\u30b5\u30fc\u30d0\u3068\u540c\u5c45\u3067\u304d\u307e\u3059\u304c\u3001\u3067\u304d\u308c\u3070\u5206\u96e2\u3057\u305f\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002 \u305d\u3046\u3059\u308b\u30684\u53f0\u304c\u6700\u5c0f\u69cb\u6210\u3068\u306a\u308a\u307e\u3059(DB\u30b5\u30fc\u30d0x3\u53f0+\u30eb\u30fc\u30bf\u30fc\u30b5\u30fc\u30d0x1\u53f0) \u521d\u671f\u8a2d\u5b9a \u5168\u53f0\u3068\u3082\u306b #vi \/etc\/selinux\/config \u3068\u3057 SELINUX=disabled \u3068\u3057\u3066\u304b\u3089 reboot \u3057\u3001 # yum install -y http:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm # yum remove -y mysql-libs \u3092\u5b9f\u884c\u3057\u3066\u304a\u304d\u307e\u3059\u3002 db\u30b5\u30fc\u30d0\u306e\u8a2d\u5b9a \u4e0b\u8a18\u306e\u8a2d\u5b9a\u30923\u53f0\u304b\u305d\u308c\u4ee5\u4e0a\u306edb\u30b5\u30fc\u30d0\u306b\u9069\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002 # yum install -y mysql-server mysql-shell # service mysqld start $ cat \/var\/log\/mysqld.log | grep temporary \u3068\u3057\u3001\u51fa\u3066\u304d\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3067 mysql -u root -p \u3068\u3057\u307e\u3059\u3002 SET PASSWORD = &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/0x0c.info\/?p=122\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;\u3010CentOS7\u3011 MySQL InnoDB Cluster \u306e\u69cb\u7bc9&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[21,53],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos7","tag-mysql-innodb-cluster"],"_links":{"self":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=122"}],"version-history":[{"count":0,"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions"}],"wp:attachment":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}