Configurare Redis come servizio fornito dall'utente
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questo documento illustra la procedura per associare la tua app a un'istanza Redis non elencata nel marketplace Kf (incluso Memorystore) con il connettore Spring Cloud Foundry. Di conseguenza, le credenziali Redis vengono iniettate nella tua app, proprio come l'associazione ai servizi di cui è stato eseguito il provisioning tramite i piani del marketplace.
Prima di iniziare
Assicurati che Redis sia installato e accessibile dal tuo cluster Kf.
Assicurati che Redis sia già stato configurato per la tua app.
Assicurati di avere scelto come target lo spazio in cui è in esecuzione la tua app.
Crea l'istanza fornita dall'utente
Affinché Kf possa associare correttamente un'app all'istanza Redis, la variabile di ambiente minima è l'URI (ad esempio redis://:password@host:port). Se vuoi, puoi includere altre coppie chiave-valore. I seguenti esempi dovrebbero essere sufficienti per i deployment di base.
Conferma le nuove variabili di ambiente fornite alla tua app:
kfvcap-servicesapplication-name
Aggiorna l'istanza fornita dall'utente
Se vengono apportate modifiche all'ambiente (ad esempio l'aggiornamento della password o dell'host nell'URI o l'aggiunta di nuove coppie chiave-valore) che devono essere trasmesse a qualsiasi app associata, puoi aggiornare l'istanza fornita dall'utente:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Set up Redis as a user-provided service\n\n| **Note:** You can leverage services that aren't listed in the marketplace by creating user-provided service instances that an App can bind to. Learn more about [user-provided services](../concepts/user-provided-services).\n\nThis document guides you through binding your App to a Redis instance not listed in the Kf marketplace (including [Memorystore](/memorystore)) with the Spring Cloud Foundry Connector. This results in the Redis credentials being injected into your App, just like binding to services provisioned through marketplace plans.\n\nBefore you begin\n----------------\n\n- Ensure you have Redis installed and accessible by your Kf cluster.\n- Ensure Redis has already been set up for your App.\n- Ensure you have targeted the Space running your App.\n\nCreate the user-provided instance\n---------------------------------\n\nFor Kf to successfully bind an App to your Redis instance, the minimum environment variable is the URI (for example `redis://:password@host:port`). Additional key-value pairs may be included if desired. The following examples should be sufficient for basic deployments.\n\n### For Redis with no AUTH configured\n\n kf cups \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e -p '{\"uri\":\"redis://\u003cvar translate=\"no\"\u003eredis-host\u003c/var\u003e:\u003cvar translate=\"no\"\u003e6379\u003c/var\u003e\"}' -t \"redis\"\n\n### For Redis with AUTH configured\n\n kf cups \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e -p '{\"uri\":\"redis://:\u003cvar translate=\"no\"\u003epassword\u003c/var\u003e@\u003cvar translate=\"no\"\u003eredis-host\u003c/var\u003e:\u003cvar translate=\"no\"\u003e6379\u003c/var\u003e\"}' -t \"redis\"\n\nBind your App\n-------------\n\nNow that the user-provided service has been created, you can bind your App to\nthe instance name: \n\n kf bind-service \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e\n\nRestart your App for the changes to take effect: \n\n kf restart \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e\n\nConfirm the new environment variables being provided to your App: \n\n kf vcap-services \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e\n\nUpdate the user-provided instance\n---------------------------------\n\nIf there are changes to the environment (for example password or host update in\nthe URI, or the addition of new key-value pairs) that need to be passed on to\nany App bound to it, you can update the user-provided instance: \n\n kf uups \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e -p '{\"uri\":\"\u003cvar translate=\"no\"\u003enew-uri\u003c/var\u003e\", \"\u003cvar translate=\"no\"\u003esome-new-key\u003c/var\u003e\": \"\u003cvar translate=\"no\"\u003esome-new-value\u003c/var\u003e\"}'\n\nWhat's next\n-----------\n\n- [VCAP_SERVICES](/migrate/kf/docs/2.10/how-to/app-runtime#vcapservices)\n- [Unbind service](../cli/kf-unbind-service)\n- [Delete service](../cli/kf-delete-service)"]]