2021 latest version-AWS Amazon cloud RDS to create an Aurora MySQL cluster

AWS Amazon Cloud RDS Create Aurora MySQL Cluster

1. Enter the AWS-RDS console to create a database

insert image description here

2. Select the database you want to create

  • Here we take Amazon Aurora as an example

insert image description here

3. Amazon Aurora database

  • Amazon Aurora is a MySQL- and PostgreSQL-compatible relational database purpose-built for the cloud that combines the performance and availability of traditional enterprise databases with the simplicity and cost-effectiveness of open source databases.

  • Amazon Aurora can be up to five times faster than a standard MySQL database and three times faster than a standard PostgreSQL database.

  • The above is the Amazon Aurora database officially defined by AWS. If you think about it, the Aurora database is cheap and five times that of the standard MySQL database. Do you suddenly feel very fragrant?

4. Version selection

  • Here I choose the compatible version of Amazon Aurora MySQL
  • MySQL chooses 5.7

insert image description here

5. Database cluster name and account password

  • The cluster name can be taken by yourself
  • It is best to set the main user name and password by yourself instead of using the automatically generated password

insert image description here

6. Database instance

  • Here I choose a 2-core 16G memory optimization class instance

    insert image description here

7. Availability and durability

  • It is best to choose here. If there is a problem with the cluster in the future, there will be a failover

insert image description here

8. Connect to the database

  • Select the VPC address where the database is located, whether the database can use external connections, and set the security group for the database

insert image description here

9. Database Authentication

  • It is equivalent to what verification we need to connect to the database

insert image description here

10. The database is created

insert image description here

11. The server connects to the database

  • If the server wants to connect to the database, the server must first install MySQL before remote connection
11.1 Server installation database
  • Here we take the CentOS7.8 system as an example
11.1.1 Download MySQL official yum
wget -i -c https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm 
11.1.2 Install MySQL.rpm package
rpm -ivh mysql57-community-release-el7-10.noarch.rpm 
11.1.3 Install MySQL service using yum
yum -y install mysql-community-server
11.1.4 Start and view MySQL status
systemctl start mysqld.service 
systemctl status mysqld.service 
11.1.5 View MySQL initialization password
grep "password" /var/log/mysqld.log
11.1.6 Login to MySQL
mysql -uroot -p 
11.1.7 Modify root user password
# 密码可以只有一种字符
mysql> set global validate_password_policy=0;
# 密码最小长度为1 
mysql> set global validate_password_length=1;
#修改root密码为mkcc2021.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
11.1.8 Modify the default character set
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
mysql> set character_set_database=utf8;
mysql> set character_set_server=utf8;
11.1.9 Authorize root user to log in from any host
mysql> grant all privileges on *.* to root@"%" identified by "123456" with grant option;
11.2 Server connection to Aurora MySQL database cluster
  • First click on the Aurora MySQL database cluster and find the terminal node section

insert image description here

  • Remember the endpoint name, because we need to use it when connecting to the database
11.2.1 Connect to the Aurora MySQL cluster (unencrypted) from the MySQL command line client
  • To connect to a database instance using the MySQL command-line client, enter the following command at the command prompt to connect to the database instance using the MySQL command-line client. The parameter -h is replaced by the database instance endpoint. The parameter -P is replaced by the database instance For the -u parameter, replace it with the main user name. Enter the main user password according to the system prompt.
mysql -h mysql–instance1.*********.us-east-1.rds.amazonaws.com -P 3306 -u user -p 
11.2.2 Connect to Aurora MySQL cluster from the MySQL command line client (SSL encryption)
  • Download root certificates for all AWS regions

  • To use the MySQL command line client to connect to the database instance, please enter the following command at the command prompt to use the MySQL command line client to connect to the database instance. The parameter -h is replaced by the database instance endpoint. The parameter --ssl-ca is replaced by For the corresponding SSL certificate file name. The parameter -P is replaced by the port of the database instance. For the -u parameter, it is replaced by the main user name. Enter the main user password according to the system prompt.

mysql -h mysql–instance1.*********.us-east-1.rds.amazonaws.com --ssl-ca=global-bundle.pem -P 3306 -u user -p
11.3 Add the server address or security group that needs to connect to the cluster to the Aurora MySQL database security group
  • In order to protect the security of the database cluster more effectively, it is not fully opened in the database security group, and only the address of the server that needs to connect to the cluster is added separately

insert image description here

12. The connection is successful

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 350
Server version: 5.7.33-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

13. Summary

  • AWS-RDS creation of Aurora MySQL cluster is complete
  • The next article will show you how to create a Redis cluster in AWS Amazon cloud

Guess you like

Origin blog.csdn.net/HYXRX/article/details/120973503