An eviction policy is an algorithm that determine the keys to remove when the database reaches the maximum memory limit. By default, Vultr sets noeviction
eviction policy. Eviction aims to make room for new data and to prevent unexpected behavior from your applications, always choose a large database plan that can handle your data. Follow this guide to manage Vultr Managed Database for Caching eviction policy.
Navigate to Products and select Databases.
Click the target database instance.
Navigate to Settings then Eviction Policies. Choose your preferred eviction policy and click Save.
List all the database instances by sending a GET
request to the List Managed Databases endpoint and note the database ID. For example, 43b4c774-5dff-4ac0-a01f-78a23c2205b5
.
$ curl "https://api.vultr.com/v2/databases" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PUT
request to the Update Managed Database endpoint specifying the database ID to change the eviction policy.
$ curl "https://api.vultr.com/v2/databases/database_id" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"--redis-eviction-policy" : "volatile-lru"
}'
Visit the Update Managed Database endpoint to view additional attributes to add to your request.
List all database instances and note the database ID. For instance, d6ac2a3c-92ea-43ef-8185-71a23e58ad8c
.
$ vultr-cli database list --summarize
Run the following command to change the eviction policy and specify the database ID.
$ vultr-cli database update database_id \
--redis-eviction-policy "volatile-lru"
Run vultr-cli database update --help
to view all options.