AWS Amazon cloud creates Redis cluster
Article directory
1. AWS-Redis service
- AWS offers two fully managed services to run Redis.
- The first is Amazon MemoryDB for Redis .
- The second is Amazon ElastiCache for Redis .
- Amazon MemoryDB for Redis is a Redis-compatible, persistent in-memory database service that delivers blazing-fast performance.
- Amazon ElastiCache for Redis is a fully managed caching service that speeds access to data from primary databases and data stores with latency down to microseconds.
2. Create a Redis database cluster
- Here I am using Amazon MemoryDB for Redis database cluster
2.1 Getting Started
2.2 Create a cluster
2.3 Select a cluster creation method
- Generally, a new cluster is created, and the restore from the snapshot is only selected when restoring the Redis backup.
2.4 Cluster information
- Cluster name and description Fill in the specified name according to your own business
2.5 Select or create a subnet
2.6 Basic settings of Redis cluster
2.7 Security Group and Encryption
2.8 Snapshot and backup
2.9 Maintenance
2.10 Labels
2.11 create
3. Connect to the Redis cluster
- To connect to the Redis cluster, the server must install the redis service
3.1 Install redis cluster
#redis软件仓库
http://download.redis.io/releases/
#下载
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
#解压
上传至 /redis
tar xzf redis-5.0.5.tar.gz
mv redis-5.0.5 redis
#安装依赖并编译
yum -y install gcc automake autoconf libtool make
cd redis
make
yum install tcl
cd src
make test
#环境变量
vim /etc/profile
export PATH=/redis/redis/src:$PATH
source /etc/profile
#启动
redis-server &
#连接测试
redis-cli
127.0.0.1:6379> set num 10
OK
127.0.0.1:6379> get num
10
3.2 The server is connected to the Redis cluster
-
Start with Amazon Memory DB for Redis --> cluster --> Redis (cluster you created) --> cluster endpoint
-
Find the cluster endpoint and execute the following command in the EC2 instance to connect to the cluster
redis-cli -h mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com -p 6379
- If the connection is successful, the following will be displayed
redis mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com 6379>
3.3 Add the server address or security group that needs to connect to the cluster to the Redis 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
4. Summary
- AWS Amazon cloud creation of Redis cluster is complete