OpenStack和Redis
生活随笔
收集整理的這篇文章主要介紹了
OpenStack和Redis
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言: 最近開始搗鼓OpenStack了,在用RDO部署OpenStack的時候,發現裝了Redis, 遂決定看看OpenStack哪些地方(可以)用到Redis。
- ?Redis作為OpenStack Dashboard的session storage backend
目前(M版本,后面默認為M版本) OpenStack的Dashboard支持以下三種session storage backend:
Local memory cache
Key-Value store(Memcached, Redis)
Database(Mysql/Mariadb)
其中Local memory cache是最簡單而且是最快的,但是缺點也很明顯,比如在process和worker之間不能共享,存儲隨著process結束而結束。Database作為backend相對而言最慢的,但是可以做到scalable,persistent. K-V storage速度上介于兩者之間,也可以salable,比較適合小規模部署的環境,一下是配置Redis作為Session storage的backend。
1. 安裝依賴包:redis, django-redis。
2. 修改local_settings配置文件:/etc/openstack-dashboard/local_settings.
SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = {"default": {"BACKEND": "redis_cache.cache.RedisCache","LOCATION": "127.0.0.1:6379:1","OPTIONS": {"CLIENT_CLASS": "redis_cache.client.DefaultClient",}} }如果django-redis版本是3.8.0或以上,那么應該要這樣配置(https://niwinz.github.io/django-redis/latest/#_configure_as_cache_backend):
SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = {'default': {'BACKEND': 'django_redis.cache.RedisCache','LOCATION': 'redis://127.0.0.1:6379/1','OPTIONS': {'CLIENT_CLASS': 'django_redis.client.DefaultClient',}} }3. 重啟httpd/apache, 登陸Dashboard,然后查看Redis的key:
?
- ?Redis作為OpenStack Keystone的token storage backend
Keystone支持的Token storage backend目前有三個:
Mysql(Mariadb)
MemCache
Redis
Mysql會有token無限增長的問題,需要定期清理不需要的token, Memcache的問題是空間固定,不好擴容,相對而言Redis是一個不錯的選擇,一下是配置Redis的步驟:
1. 安裝依賴包: Redis.
2. 修改keystone.conf:
[cache] enabled=true expiration_time=600 backend=dogpile.cache.redis backend_argument=url:redis://127.0.0.1:6379/2[token] caching=true driver = keystone.token.persistence.backends.kvs.Token?
? ? ? ?3. 重啟keystone(httpd), 查看Redis的key:
? ? ? ?
?
- Redis作為OpenStack Telemetry的多個agent instances之間協作的backend
? ? ? ?RDO 安裝后,默認的就是Redis作為backend, 參看/etc/ceilometer/ceilometer.conf:
? ? ? ?
[coordination]# # From ceilometer ## The backend URL to use for distributed coordination. If left empty, per- # deployment central agent and per-host compute agent won't do workload # partitioning and will only function correctly if a single instance of that # service is running. (string value) #backend_url = <None> backend_url = redis://9.114.112.108:6379# Number of seconds between heartbeats for distributed coordination. (floating # point value) #heartbeat = 1.0# Number of seconds between checks to see if group membership has changed # (floating point value) #check_watchers = 10.0?
轉載于:https://www.cnblogs.com/dreamrivulet/p/5978847.html
總結
以上是生活随笔為你收集整理的OpenStack和Redis的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Kafka 0.10.0文档翻译二
- 下一篇: Linux操作系统报:read-only