spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Failed to get connection from GCP hyper scaler Redis env

Open iihero opened this issue 2 years ago • 2 comments

The redis server configuration looks like: "password": "aaaaaaaa", "hostname": "10.*.64.20", "port": 6378, "uri": "rediss://:aaaaaaa@10.*.64.20:6378", "cluster_mode": false, "tls": { "server_ca": "-----BEGIN CERTIFICATE-----\nMIIDnTCCAoWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBhTEtMCsGA1UELhMkN2Y1\nYjhhMDYtZGVkZi00NWZjLTkxN2YtNThlOTA0ZDhjZTMzMTEwLwYDVQQDEyhHb29n\nbGUgQ2xvdWQgTWVtb3J5c3RvcmUgUmVkaXMgU2VydmVyIENBMRQwEgYDVQQKEwtH**** }

I just used the spring redis 2.7.*
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(poolocnfig); jedisConFactory.setUseSsl(true); jedisConFactory.setHostName(hostName); jedisConFactory.setPort(6378); jedisConFactory.setPassword(****);

Finally, it still failed to get the connection.

The same code can work on other env like (azure, aws) hyperscaler option. Because in their env, 
the tls is simple with value "true".

I just worry the part of "tls" , server_ca,  I failed to find any code to set it.  
Anybody can help?  

iihero avatar Oct 13 '22 06:10 iihero

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem. A stack trace along with the error message would be helpful.

mp911de avatar Oct 13 '22 14:10 mp911de

The call stack looks like this: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at :10.160.64.20org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool","stacktrace":["org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool","\tat org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:292)","\tat

Here, I just assume that the "server_ca" is the key part. Perhaps Redis client library need some convinient support when the provided truststore is a PEM certificate in TLS connection mode? I can't find any sample on how to use it.

iihero avatar Oct 14 '22 00:10 iihero

Can you please include the full stack trace and the outermost exception message? The details above show only an excerpt.

mp911de avatar Oct 17 '22 14:10 mp911de

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Oct 24 '22 14:10 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Oct 31 '22 14:10 spring-projects-issues