Planet MySQL Planet MySQL -

MySQL install ‘n’ config one-liners

Back again, now with MySQL installs. And this means using the MySQL repository this time around. I’ve been installing and configuring InnoDB Clusters and ClusterSets and thinking about the Ansible and Terraform users amongst us, maybe one-liners might help someone out there. So, what about if I share how to install the MySQL repo, install the MySQL instance, create an InnoDB Cluster, add a MySQL Router, create a ClusterSet, make sure the Router is ClusterSet-aware, and then test it out. And all via one-liners. First up, obrigado Miguel for https://github.com/miguelaraujo/ClusterSet-Demo. To simplify the command execution sequence, these sections aim to help summarize the technical commands required to create the whole platform. And on a default path & port configuration, to ease operational deployments for all those 000’s of installs and posterior admin & ops tasks. First download the mysql repo binary for your env from https://dev.mysql.com/downloads/ On all servers / nodes: yum -y localinstall ./mysql80-community-release-el8-9.noarch.rpm On the database nodes only: yum install -y mysql-community-server-0:8.0.36-1.el8.x86_64yum install -y mysql-shell-0:8.0.36-1.el8.x86_64 On the MySQL Router dedicated nodes only: yum install -y mysql-router-community-0:8.0.36-1.el8.x86_64 On each of the database nodes (be VERY careful of security requirements and where you store passwords please!): systemctl start mysqldsystemctl enable mysqldpswd=grep -oP '(?<= A temporary password is generated for root@localhost: ).*' /var/log/mysqld.log | tail -1mysql -uroot -p$pswd -S /var/lib/mysql/mysql.sockalter user 'root'@'localhost' identified by 'Contr4sen!A';flush privileges;SET sql_log_bin = OFF;create user 'icadmin'@'localhost' identified by 'Contr4sen!A';grant all on . to 'icadmin'@'localhost' with grant option;create user 'icadmin'@'%' identified by 'Contr4sen!A';grant all on . to 'icadmin'@'%' with grant option;flush privileges;SET sql_log_bin = ON; And now for MySQL Shell’s turn: mysqlsh icadmin:'Contr4sen!A'@localhost:3306 -- dba check-instance-configurationmysqlsh icadmin:'Contr4sen!A'@localhost:3306 -- dba configure-local-instance --restart=true --interactive=FALSE On just one of the database nodes: mysqlsh icadmin:'Contr4sen!A'@dbnode01:3306 -- dba create-cluster VLCmysqlsh icadmin:'Contr4sen!A'@dbnode01:3306 -- cluster status --extended=0mysqlsh icadmin:'Contr4sen!A'@dbnode01:3306 -- cluster status --extended=1 Continuing on the same database node: mysqlsh icadmin@dbnode01:3306 -- cluster add-instance icadmin:'Contr4sen!A'@dbnode02:3306 --recoveryMethod=clonemysqlsh icadmin@dbnode01:3306 -- cluster add-instance icadmin:'Contr4sen!A'@dbnode03:3306 --recoveryMethod=clonemysqlsh icadmin@dbnode01:3306 -- cluster statusmysqlsh icadmin@dbnode01:3306 -- cluster describe On one of the database nodes: mysqlsh icadmin@dbnode01:3306 -- cluster setup-router-account 'routerAdmin' --password='Contr4sen!A' On the first router node, rtnode01: mysqlrouter --bootstrap icadmin:'Contr4sen!A'@dbnode02:3306 \--name="router_VLC01" --account=’routerAdmin’ \--conf-base-port=3306 --report-host=rtnode01 -u mysqlroutersystemctl start mysqlrouter On the 2nd router node, rtnode02: mysqlrouter --bootstrap icadmin:'Contr4sen!A'@dbnode02:3306 \--name="router_VLC02" --account=’routerAdmin’ \--conf-base-port=3306 --report-host=rtnode02 -u mysqlroutersystemctl start mysqlrouter On one of the database nodes, connected directly or via any router: mysqlsh icadmin@dbnode01:3306 -- cluster create-cluster-set csVLCmysqlsh icadmin@dbnode01:3306 -- clusterset status On router server rtnode01: systemctl stop mysqlroutermysqlrouter --bootstrap icadmin:'Contr4sen!A'@dbnode02:3306 \--name="router_VLC01" --account=’routerAdmin’ \--conf-base-port=3306 --report-host=rtnode01 --force -u mysqlroutersystemctl start mysqlrouter On router server rtnode02: systemctl stop mysqlroutermysqlrouter --bootstrap icadmin:'Contr4sen!A'@dbnode02:3306 \--name="router_VLC02" --account=’routerAdmin’ \--conf-base-port=3306 --report-host=rtnode02 --force -u mysqlroutersystemctl start mysqlrouter Validation: mysqlsh icadmin@rtnode01:3306 -- clusterset routing-options All yours! Thanks for getting through it all.

本文介绍了使用MySQL仓库安装和配置InnoDB集群和ClusterSets的步骤,包括下载二进制文件、安装MySQL仓库和实例、配置MySQL实例和创建InnoDB集群,以及安装和配置MySQL Router。最后,使用MySQL Shell进行操作和验证。

ClusterSets InnoDB集群 MySQL Router MySQL Shell MySQL仓库 mysql

相关推荐 去reddit讨论