问题原文
原帖链接 · Kanuj Bhatnagar · CC BY-SA 3.0
I've a AWS ElastiCache Redis cluster setup that I wish to manage. Since AWS doesn't let you access ElastiCache outside the VPC, I've setup a micro EC2 instance that carried a copy of the phpRedisAdmin script pointed to this cluster. But AWS has disabled the 'CONFIG' command on the Redis cluster so phpRedisAdmin can't connect and manage the ElastiCache cluster.
I've tried the redis-browser node package but it runs on 0.0.0.0:4567 and I'll need a public IP on this instance to manage the Redis cluster.
Any sugggestions?
已采纳解答
原帖链接 · FGRibreau · CC BY-SA 3.0
You may want to give a try to Redsmin.
If you have an EC2 instance in the same subnet as your Redis ElasticCache
Note:
- This will only work if the EC2 instance you connect to is in the same subnet as your ElasticCache Redis instance.
- The following example will state that your ElastiCache private IP is
172.31.5.13and is running on port6379. - The following example will state that your EC2 private IP is
172.31.5.14and its public IP is52.50.145.87.
Now let's do this step by step:
- Connect to this EC2 instance through SSH
- run
sudo iptables -t nat -A PREROUTING -p tcp --dport 6379 -j DNAT --to-destination 172.31.5.13:6379don't forget to change your IPs and maybe even the port number - run
sudo iptables -t nat -A POSTROUTING -p tcp -d 172.31.5.13 --dport 6379 -j SNAT --to-source 172.31.5.14 - run
sudo service iptables save if the previous command did not work, try:
- on Debian/Ubuntu =>
iptables-save > /etc/iptables/rules.v4 - on RHEL/CentOS =>
iptables-save > /etc/sysconfig/iptables
- on Debian/Ubuntu =>
Add a rule in the security group to allow inbound request from Redsmin IP
62.210.222.165, protocol=TCP, port=6379- Add a new Direct Server in redsmin with the connection string:
redis://52.50.145.87:6379, done!
If you don't have an EC2 instance in the same subnet as your Redis ElasticCache
- Follow this amazon tutorial to setup a NAT instance, setup it on the same subnet as your ElastiCache server.
- Now follow the previous section above.
If you simply want to connect Redsmin to an EC2 Redis
- Add a rule in the security group to allow inbound request from Redsmin IP
62.210.222.165(don't forget to specify the right port, for instance6379) - Connect your Redis server in Redsmin using the EC2 public IP and the port you opened.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
