1.接到Amazon EC2实例。
2.下载和安装GNU Compiler Collection(gcc)。
在EC2 实例的命令提示符中键入下面的命令,然后在确认提示符处键入y。
sudo yum install gcc
3.下载并编译redis-cli实用工具。此实用工具包含在Redis软件发布版中。
在EC2实例的命令提示符处,键入以下命令:
wget https://file-edu.s3.cn-north-1.amazonaws.com.cn/experiment20/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make distclean // Ubuntu systems only
make
4.在EC2实例的命令提示符处,键入以下命令,并使用集群和端口的终端节点替换此示例中显示的相应内容。
src/redis-cli -c -h myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn -p 6379
Redis 命令提示符的结果类似于以下内容
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379>
5.运行Redis命令。
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> set a "hello"
OK
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> get a
"hello"
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> get b
(nil)
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> set b "Good-bye" EX 5
OK
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> get b
"Good-bye"
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> get b
(nil)
myredis.thnyom.0001.cnw1.cache.amazonaws.com.cn:6379> quit