You can access all the tutorial resources, including deployment script (Terraform), related source code, sample data, and instruction guidance, from the GitHub project: https://github.com/alibabacloud-howto/opensource_with_apsaradb/tree/main/apache-superset
For more tutorials around Alibaba Cloud Database, please refer to: https://github.com/alibabacloud-howto/database
Use Terraform to provision ECS, Redis and ApsaraDB RDS for MySQL instances that used in this solution against this .tf file: https://github.com/alibabacloud-howto/solution-mysql-redis-cache-simple/blob/master/deployment/terraform/main.tf
For more information about how to use Terraform, please refer to this tutorial:
For the video tutorial about how to use Redis and RDS MySQL, and cache retiring based on TTL in Redis, please refer to: https://www.youtube.com/watch?v=_JqcsKyDljw
In this tutorial, Alibaba Cloud Linux is used. When you check with the terraform script, you will see the image id is: aliyun_2_1903_x64_20G_alibase_20200904.vhd
yum install java-latest-openjdk.x86_64 yum install maven yum install mysql
Execute the following commands one by one, which are to download the demo application code, then build the demo Java application.
wget https://github.com/alibabacloud-howto/solution-mysql-redis-cache-simple/raw/master/source.tar.gz tar xvf source.tar.gz && cd source mvn clean package assembly:single -DskipTests
Edit the env.sh file to set the Redis and RDS MySQL endpoints (you can get from Redis and RDS MySQL web console) accordingly.
Use the mysql_client.sh to create a demo table and insert some records into the RDS MySQL.
sh mysql_client.sh < rosebowl.sql
You can also use mysql_client.sh to query the data in RDS MySQL. There should be 30 records now.
Run the Redis demo application to verify the cache and TTL logic. You can pick up a query from the file query.sql to run. The default TTL is set as 10 seconds in the demo application. It will tell you that the result is fetched from MySQL or Redis cache. Do remember that the life time of query result in Redis cache is only 10 seconds. If you want to make it longer, you can modify the code https://github.com/alibabacloud-howto/solution-mysql-redis-cache-simple/blob/master/source/src/main/java/demo/RedisCache.java and build to run again.
Iain Ferguson - May 18, 2022
ApsaraDB - April 14, 2020
Alibaba Clouder - February 22, 2019
ApsaraDB - November 21, 2022
ApsaraDB - September 9, 2021
Alibaba Cloud Project Hub - April 2, 2021
Alibaba Cloud’s world-leading database technologies solve all data problems for game companies, bringing you matured and customized architectures with high scalability, reliability, and agility.Learn More
ApsaraDB: Faster, Stronger, More SecureLearn More
When demand is unpredictable or testing is required for new features, the ability to spin capacity up or down is made easy with Alibaba Cloud gaming solutions.Learn More
A key value database service that offers in-memory caching and high-speed access to applications hosted on the cloudLearn More
More Posts by ApsaraDB