Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redis Sentinel Support #185

Closed
markbigler opened this issue Dec 6, 2016 · 10 comments
Closed

Add Redis Sentinel Support #185

markbigler opened this issue Dec 6, 2016 · 10 comments

Comments

@markbigler
Copy link
Contributor

Is there any plan to extend RedisServiceInfo, RedisServiceInfoCreator and RedisConnectionFactoryCreator with master/sentinel properties?

@scottfrederick
Copy link
Contributor

@markbigler This is the first request we've had to add this. Can you provide an example of what the credentials would look like on one of the supported clouds for a Redis service that provided master/sentinel credentials?

@markbigler
Copy link
Contributor Author

@scottfrederick On a cloud foundry based cloud the credentials for a (high available) redis service looks like:

  "VCAP_SERVICES": {
    "redisent": [
      {
        "credentials": {
          "master": "redis://aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa",
          "password": "...",
          "sentinels": [
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-2.service.consul",
              "port": 1234
            },
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-1.service.consul",
              "port": 1234
            },
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-0.service.consul",
              "port": 1234
            }
          ],
          "servers": [
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-2.service.consul",
              "port": 2345
            },
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-1.service.consul",
              "port": 2345
            },
            {
              "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-0.service.consul",
              "port": 2345
            }
          ],
          "host": "aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa-master.service.consul",
          "port": 2345
        },
        ...
      }
    ]
  }
}

Some additional information on how to deal with redis sentinel:

@nisheethagarwal
Copy link

I face a similar issue but the VCAP structure for my Redis instance is different than the one posted here.

"redis": [
			{
				"credentials": {
					"password": "...",
					"redis_nodes": [
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxx"
						},
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxx"
						},
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxx"
						}
					],
					"sentinel_nodes": [
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxxx"
						},
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxxx"
						},
						{
							"hostname": "xx.xx.xx.xxx",
							"port": "xxxxx"
						}
					],
					"uri": "redis-sentinel://a:[email protected]:xxxxx,xx.xx.xx.xxx:xxxxx,xx.xx.xx.xxx:xxxxx#mymaster"
				},
				...
			}
		]

@scottfrederick
Copy link
Contributor

Thanks @nisheethagarwal, this is helpful.

One of the goals of spring-cloud-cloudfoundry-connector is to "normalize" the information provided in VCAP_SERVICES from different service brokers into a common data model that can be consumed by apps and used in the Spring service bean creation logic in spring-cloud-spring-service-connector.

These two examples look similar in structure, with different names for the fields (sentinels and servers vs sentinel_nodes and redis_nodes). I'm not sure about the difference between "master": "redis://aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa" and "uri": "redis-sentinel://a:[email protected]:xxxxx,xx.xx.xx.xxx:xxxxx,xx.xx.xx.xxx:xxxxx#mymaster".

The work involved for this would be:

  • add sentinel-related fields to RedisServiceInfo in spring-cloud-core
  • add parsing of sentinel-related fields to RedisServiceInfoCreator in spring-cloud-cloudfoundry-connector, recognizing several possible names for the fields
  • modify RedisConnectionFactoryCreator in spring-cloud-spring-service-connector to use sentinel-related fields in the Spring Data Redis connection factory setup

@anwarchk
Copy link

anwarchk commented Nov 2, 2017

@scottfrederick I can pick this up if no one else called dibs on it :-)

@ljheric
Copy link

ljheric commented Aug 31, 2018

Is there any update for this functionality? When will it available in the spring-cloud-connectors?

@ljheric
Copy link

ljheric commented Sep 4, 2018

@scottfrederick Is there any update for this functionality? When will it available in the spring-cloud-connectors? Thank you!

@siimp
Copy link

siimp commented Dec 3, 2018

This functionality still is relevant to our project, any progress info?

@scottfrederick
Copy link
Contributor

@siimp @ljheric There are no immediate plans to add this feature to Spring Cloud Connectors. I'd be happy to provide some guidance and and assistance to anyone who wants to contribute a solution.

@markpollack
Copy link

markpollack commented May 31, 2019

Contributions are welcome in the https://github.com/pivotal-cf/java-cfenv project as Spring Cloud Connectors are now in maint mode only. There is already an issue for this in that repo - pivotal-cf/java-cfenv#32

Are the example JSON coming from products or are they from a home made tile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants