问题
The same Azure Redis cache is getting connected from local machince. The port 6380, on which cache is running is open in firewall of both inbound and outbound in the VM.
I tried in both NodeJs and Java. Both are connecting to remote Azure Redis from local and the exact same code for NodeJS and Java is not connceting to Azure Redis cache from VM.
Java config:
spring.redis.host=my-cache.redis.cache.windows.net
spring.redis.password=<password>
spring.redis.port=6380
spring.redis.ssl=true
NodeJS config:
const client = redis.createClient(6380,
'my-cache.redis.cache.windows.net',
{
auth_pass: <password>,
tls: { servername: 'my-cache.redis.cache.windows.net' }
});
回答1:
well, the other end must accept connection as well, so you mist allow connections from the VM if you have any firewall rules at all:
https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/cache-configure#firewall
回答2:
This is solved by the following on my Windows Desktop VM:
- Click Start.
- Enter cmd in the Start menu search text box.
- Right-click Command Prompt and select Run as Administrator.
- Run the following command: ipconfig /flushdns
- Run the following command: ipconfig /registerdns
来源:https://stackoverflow.com/questions/63008459/azure-vm-not-connecting-to-azure-redis-cache-but-local-is-connecting-to-azure-re