Difference between revisions of "MySQL InnoDB Cluster"

From Michael's Information Zone
Jump to navigation Jump to search
Line 8: Line 8:
 
sudo systemctl enable --now mysqld.service
 
sudo systemctl enable --now mysqld.service
 
</pre>
 
</pre>
*Grab the temp password from /var/log/mysqld.log <ref>https://dba.stackexchange.com/questions/127537/setting-root-password-in-fresh-mysql-5-7-installation</ref> and run secure setup. I allowed remote root user for cluster purposes, this should be restricted later to just the cluster hosts and the adminapi host.
+
*Grab the temp password from /var/log/mysqld.log <ref>https://dba.stackexchange.com/questions/127537/setting-root-password-in-fresh-mysql-5-7-installation</ref> and run secure setup.
 +
**Root by default is restricted to localhost. I added an account for the mysqlsh to connect from my workstation. Also added the permissions to configure the clusteradmin
 +
<pre>
 +
mysql> create user 'root'@'ip address' identified with mysql_native_password BY 'password';
 +
mysql> grant all privileges on *.* to 'root'@'password';
 +
mysql> GRANT CLONE_ADMIN, CONNECTION_ADMIN, CREATE USER, EXECUTE, FILE, GROUP_REPLICATION_ADMIN, PERSIST_RO_VARIABLES_ADMIN, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, REPLICATION_APPLIER, REPLICATION_SLAVE_ADMIN, ROLE_ADMIN, SELECT, SHUTDOWN, SYSTEM_VARIABLES_ADMIN ON *.* TO 'root'@'password' WITH GRANT OPTION;
 +
mysql> flush privileges;
 +
</pre>
 
<ref>https://dev.mysql.com/doc/mysql-shell/8.0/en/deploying-new-production-cluster.html</ref>
 
<ref>https://dev.mysql.com/doc/mysql-shell/8.0/en/deploying-new-production-cluster.html</ref>
 
*Installed mysql shell on my Fedora 33 workstation.
 
*Installed mysql shell on my Fedora 33 workstation.
 
<pre>
 
<pre>
 
sudo dnf install -y mysql-shell
 
sudo dnf install -y mysql-shell
 +
</pre>
 +
*Set variables and run setup function.
 +
<pre>
 +
mysqlsh
 +
MySQL  JS > values={'password':'<root password>', 'clusterAdmin':'<cluster admin name>', 'clusterAdminPassword':'<cluster password>'}
 +
MySQL  JS > dba.configureInstance('root@node1:3306', values )
 
</pre>
 
</pre>

Revision as of 12:07, 25 April 2021

Purpose

To attempt installing a 3 node cluster.

Process

Started with downloading and installing mysql80-community-release-el7-3.noarch.rpm on each node, and the workstation I used for the admin API.

  • Install and configure mysql server on first node. In my case this is Amazon Linux 2
sudo yum install mysql-server
sudo systemctl enable --now mysqld.service
  • Grab the temp password from /var/log/mysqld.log [1] and run secure setup.
    • Root by default is restricted to localhost. I added an account for the mysqlsh to connect from my workstation. Also added the permissions to configure the clusteradmin
mysql> create user 'root'@'ip address' identified with mysql_native_password BY 'password';
mysql> grant all privileges on *.* to 'root'@'password';
mysql> GRANT CLONE_ADMIN, CONNECTION_ADMIN, CREATE USER, EXECUTE, FILE, GROUP_REPLICATION_ADMIN, PERSIST_RO_VARIABLES_ADMIN, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, REPLICATION_APPLIER, REPLICATION_SLAVE_ADMIN, ROLE_ADMIN, SELECT, SHUTDOWN, SYSTEM_VARIABLES_ADMIN ON *.* TO 'root'@'password' WITH GRANT OPTION;
mysql> flush privileges;

[2]

  • Installed mysql shell on my Fedora 33 workstation.
sudo dnf install -y mysql-shell
  • Set variables and run setup function.
mysqlsh
MySQL  JS > values={'password':'<root password>', 'clusterAdmin':'<cluster admin name>', 'clusterAdminPassword':'<cluster password>'}
MySQL  JS > dba.configureInstance('root@node1:3306', values )