Looker는 각 인스턴스의 일부로 캐시를 유지합니다. Looker의 기본 캐시는 인메모리, 로컬 디스크, 원격 디스크 등 여러 레이어에 기반한 커스텀 캐싱 솔루션입니다. Looker 내부 데이터베이스는 캐시된 객체가 시스템에서 어디에 있는지 식별하는 색인으로 사용됩니다.
자체 Looker 인스턴스를 호스팅하는 경우 별도로 호스팅되는 Redis 캐시를 사용하도록 Looker를 구성할 수도 있습니다. Redis 캐시는 다음과 같은 이점을 제공합니다.
캐시 검색 개선: 일관된 캐시 검색 시간이 주요 개선사항입니다. Looker 클러스터의 노드 수가 증가하면 노드 간 통신으로 인해 캐시 성능이 저하될 수 있습니다. 새로운 Redis 캐시 아키텍처가 캐시를 통합하므로 Looker 클러스터의 크기에 관계없이 일관된 캐시 검색 시간을 확보할 수 있습니다.
부하 감소 — 또한 캐시는 Looker 인스턴스와 별도의 계층에 있으므로 Looker 인스턴스의 부하가 줄어듭니다.
확장성: Redis 캐시를 사용하면 Looker 인스턴스와 별개로 캐시를 확장할 수도 있습니다.
요구사항
Looker는 Redis 버전 4.0.x 및 5.0.x를 지원합니다. Looker에서 Redis 캐시를 사용하려면 Redis 인스턴스가 다음 요구사항을 충족해야 합니다.
Looker 인스턴스에서 Redis 인스턴스에 액세스할 수 있어야 합니다.
Redis 인스턴스는 클러스터가 아니어야 합니다. 그러나 고가용성을 위해 기본/복제본 구성을 사용할 수는 있습니다.
Redis 캐시의 크기는 Looker 캐시의 크기와 거의 같아야 합니다. 기본적으로 Looker 캐시는 노드당 2GB이므로 3노드 Looker 클러스터가 있는 경우 6GB Redis 캐시가 권장됩니다.
Redis maxmemory-policy 구성은 volatile-lru로 설정해야 합니다.
모든 Redis 인증은 사용 중지해야 합니다. Redis에 저장된 모든 데이터는 Redis 서버로 전송되기 전에 Looker 인스턴스에서 암호화됩니다.
AWS ElastiCache 또는 Google MemoryStore에서 호스팅되는 Redis 옵션을 사용할 수 있습니다. 단, Redis 클러스터 구성이 아니어야 합니다.
또한 Looker에서 Redis를 사용하려면 Looker의 GCM 암호화 시스템이 필요합니다. Redis를 사용 설정하기 전에 기존 암호화를 사용하는 인스턴스의 암호화를 업데이트해야 합니다. GCM 암호화 없이 Redis를 사용 설정하려고 하면 Looker가 시작되지 않으며 유사한 오류 메시지가 표시됩니다.
2020-01-23 10:28:44.253 -0800 [ERROR|007e4|cache] :: Must enable GCM encryption to use Redis caching
Redis 캐시를 사용 설정하려면 LOOKER_REDIS_CACHE_DISCOVERY 환경 변수가 Redis 연결 URL을 가리키도록 설정한 후 클러스터의 모든 노드를 포함하여 Looker 인스턴스를 완전히 다시 시작해야 합니다. 서버를 완전히 종료하고 필요에 따라 환경 및 시작 스크립트를 수정하여 환경 변수를 추가한 후 모든 노드를 시작하는 것이 좋습니다.
Looker를 종료하려면 각 노드에서 다음 명령어를 실행하세요.
cd looker
./looker stop
예를 들어 기본 포트의 동일한 호스트에 로컬 Redis 인스턴스가 있는 경우 LOOKER_REDIS_CACHE_DISCOVERY 환경 변수를 다음과 같이 설정합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-03-04(UTC)"],[],[],null,["# Enabling a Redis cache on a customer-hosted instance\n\nLooker maintains a [cache](/looker/docs/caching-and-datagroups#how_looker_uses_cached_queries) as part of each instance. Looker's default cache is a custom caching solution that is based on several layers: in-memory, local disk, and remote disk. The Looker internal database is used as an index that identifies where cached objects are located in the system.\n\nIf you are hosting your own Looker instance, you can optionally configure Looker to use a separately hosted [Redis](https://redis.io/) cache. A Redis cache can provide the following benefits:\n\n- **Improved cache retrieval** --- The primary improvement will be in consistent cache-retrieval times. As the number of nodes in a Looker cluster increases, the inter-node communication can degrade cache performance. The new Redis cache architecture consolidates the cache, which results in consistent cache-retrieval times no matter the size of your Looker cluster.\n- **Less load** --- Additionally, the cache is in a separate tier from your Looker instance, which leads to less load on the Looker instance.\n- **Scalability** --- Use of a Redis cache also allows the cache to scale independently of your Looker instance.\n\nRequirements\n------------\n\nLooker supports Redis versions 4.0.x, 5.0.x, and 7.2.x. To use a Redis cache with Looker, your Redis instance must meet the following requirements:\n\n- The Redis instance must be accessible from the Looker instance.\n- The Redis instance must not be a cluster. However, you can use a replica instance for high availability.\n- The size of the Redis cache should be approximately equal to the size of your Looker cache. By default, the Looker cache is 2 GB per node; so, if you have a three-node Looker cluster, a 6 GB Redis cache is recommended.\n- The Redis `maxmemory-policy` configuration should be set to `volatile-lru`.\n- You will need to disable any Redis authentication. All data stored in Redis is encrypted in the Looker instance before being sent to the Redis server.\n- You can use a Redis option that is hosted on an AWS ElastiCache or a Google Memorystore, as long as it's not a Redis cluster configuration.\n\nIn addition, Looker's [GCM encryption](/looker/docs/migrating-to-aes-256-gcm-encryption) system is required to use Redis in Looker. You must update encryption for instances that use legacy encryption prior to enabling Redis. If you attempt to enable Redis without GCM encryption, Looker will fail to start with an error message similar to the following: \n\n 2020-01-23 10:28:44.253 -0800 [ERROR|007e4|cache] :: Must enable GCM encryption to use Redis caching\n\nFor instructions on upgrading from legacy encryption to GCM encryption, see the [Migrating to AES-256 GCM encryption](/looker/docs/migrating-to-aes-256-gcm-encryption) documentation page.\n\nSetting an environment variable to enable the Redis cache\n---------------------------------------------------------\n\nTo enable the Redis cache, you must set the `LOOKER_REDIS_CACHE_DISCOVERY` environment variable to point to the Redis connection URL and then do a complete restart of your Looker instance, including all nodes in the cluster. We recommend that you shut your server down completely, modify your environment and startup scripts as needed to include the environment variable, and then start all the nodes.\n\nTo shut down Looker, run the following commands on each node: \n\n cd looker\n ./looker stop\n\nThen, for example, if you have a local Redis instance on the same host at the default port, set the `LOOKER_REDIS_CACHE_DISCOVERY` environment variable as follows: \n\n export LOOKER_REDIS_CACHE_DISCOVERY=redis://localhost:6379\n\nThen restart Looker: \n\n ./looker start\n\nVerifying that the Redis cache is enabled\n-----------------------------------------\n\nTo determine if your Redis cache is enabled, look for entries in your [Looker log](/looker/docs/admin-panel-server-log). There should be log entries similar to the following: \n\n 2021-06-11 16:54:41.532 +0000 [INFO|007e4|RedissonClientPool] :: Creating client for redis://localhost:6379/\n ...\n 2021-06-11 16:54:42.802 +0000 [INFO|007e4|cache] :: Creating render_cache DataShelf: redis"]]