Redis Enterprise

Page last updated:

Integrating the Service With Your App

After the creation of the service and the binding of the service to the application, the environment variable VCAP_SERVICES is created. Information about the credentials are stored in this variable as shown here:

{
  "redisent": [
    {
      "credentials": {
        "host": "09a2ff2e-e485-49ce-b175-06206beeab42-master.service.consul",
        "master": "redis://09a2ff2e-e485-49ce-b175-06206beeab42",
        "password": "HGiTVNno25gf6Gc3",
        "port": 33505,
        "sentinels": [
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-2.service.consul",
            "port": 27348
          },
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-0.service.consul",
            "port": 27348
          },
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-1.service.consul",
            "port": 27348
          }
        ],
        "servers": [
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-2.service.consul",
            "port": 33505
          },
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-0.service.consul",
            "port": 33505
          },
          {
            "host": "09a2ff2e-e485-49ce-b175-06206beeab42-1.service.consul",
            "port": 33505
          }
        ]
      },
      "label": "redisent",
      "name": "redisent-example",
      "plan": "large",
      "provider": null,
      "syslog_drain_url": null,
      "tags": [],
      "volume_mounts": []
    }
  ]
}

You can connect to your service by discovering the current master via one of the “sentinels”. Be sure to use one of the supported client libraries with the sentinel feature. See the Redis Enterprise sample app.

For administrative work, you can connect directly via the "host" and "port", which always points to the currently elected master. Please note that this connection variant should not be used for your production applications, always use sentinel-based discovery when possible.

Administrating your Redis instances

To connect to a running Redis instance with your local development tools, you can use the cf ssh feature of the cf CLI.

Sample Application

Swisscom: Redis Enterprise Example

View the source for this page in GitHub