กลับไปหน้า Tools

GetNotes Tools

redis/redis

Tool นี้คืออะไร

Redis เป็นแคช, เซิร์ฟเวอร์โครงสร้างข้อมูล, และเอนจินค้นหาเอกสาร/เวกเตอร์ที่รวดเร็วและมีฟีเจอร์ครบครัน เหมาะสำหรับนักพัฒนาที่สร้างแอปพลิเคชันที่ขับเคลื่อนด้วยข้อมูลแบบเรียลไทม์ โดยมอบประสิทธิภาพ ความยืดหยุ่น และความสามารถที่หลากหลาย.

ข้อมูลโปรเจกต์

ดาว

75.7K

Forks

24.7K

License

ไม่ระบุ

อัปเดต GitHub ล่าสุด

28 ก.ค. 2569

เพิ่มใน GetNotes

14 ก.ค. 2569

Repository

redis/redis

เหมาะกับงาน

ข้อมูลและ Analytics

เหมาะกับอาชีพ

Ecosystem

C

แปลและเรียบเรียงโดย AI

เนื้อหาฉบับภาษาไทย

ใช้อ่านเพื่อทำความเข้าใจเบื้องต้น โปรดตรวจสอบรายละเอียดสำคัญกับเอกสารต้นฉบับด้านล่าง

codecov

เอกสารนี้ทำหน้าที่เป็นทั้งคู่มือเริ่มต้นใช้งาน Redis อย่างรวดเร็ว และแหล่งข้อมูลโดยละเอียดสำหรับการสร้าง Redis จากซอร์สโค้ด

สารบัญ

  • Redis คืออะไร?- [กรณีการใช้งานหลัก](#key-use-cases)
  • ทำไมต้องเลือก Redis?
  • Redis Open Source คืออะไร?
  • เริ่มต้นใช้งาน- [โปรเจกต์เริ่มต้น Redis](#redis-starter-projects) - [การใช้ Redis กับไลบรารีไคลเอนต์](#using-redis-with-client-libraries) - [การใช้ Redis กับ redis-cli](#using-redis-with-redis-cli) - [การใช้ Redis กับ Redis Insight](#using-redis-with-redis-insight)
  • ประเภทข้อมูล, เอนจินประมวลผล และความสามารถของ Redis
  • Redis ที่โฮสต์บนคลาวด์
  • ชุมชน
  • สร้าง Redis จากซอร์สโค้ด- [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - Ubuntu 22.04 (Jammy)](#build-and-run-redis-with-all-data-structures---ubuntu-2204-jammy) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - Ubuntu 24.04 (Noble)](#build-and-run-redis-with-all-data-structures---ubuntu-2404-noble) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - Ubuntu 26.04 (Resolute)](#build-and-run-redis-with-all-data-structures---ubuntu-2604-resolute) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - Debian 12 (Bookworm) / 13 (Trixie)](#build-and-run-redis-with-all-data-structures---debian-12-bookworm--13-trixie) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - AlmaLinux 8.10 / Rocky Linux 8.10](#build-and-run-redis-with-all-data-structures---almalinux-810--rocky-linux-810) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - AlmaLinux 9.7+ / Rocky Linux 9.7+](#build-and-run-redis-with-all-data-structures---almalinux-97--rocky-linux-97) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - AlmaLinux 10.1+ / Rocky Linux 10.1+](#build-and-run-redis-with-all-data-structures---almalinux-101--rocky-linux-101) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - Alpine 3.23+](#build-and-run-redis-with-all-data-structures---alpine-323) - [สร้างและรัน Redis ด้วยโครงสร้างข้อมูลทั้งหมด - macOS 14 (Sonoma), 15 (Sequoia), 26 (Tahoe)](#build-and-run-redis-with-all-data-structures---macos-14-sonoma-15-sequoia-26-tahoe) - [การใช้ build-environment image ที่สร้างไว้ล่วงหน้า (Docker)](#using-the-pre-built-build-environment-image-docker) - [การสร้าง Redis - แฟล็กและข้อสังเกตทั่วไป](#building-redis---flags-and-general-notes) - [การแก้ไขปัญหาการสร้างด้วย dependencies หรือ cached build options](#fixing-build-problems-with-dependencies-or-cached-build-options) - [การแก้ไขปัญหาการสร้างไบนารี 32 บิต](#fixing-problems-building-32-bit-binaries) - [Allocator](#allocator) - [Monotonic clock](#monotonic-clock) - [Verbose build](#verbose-build) - [การรัน Redis ด้วย TLS](#running-redis-with-tls)
  • การมีส่วนร่วมในโค้ด
  • เครื่องหมายการค้า Redis

Redis คืออะไร?

สำหรับนักพัฒนาที่สร้างแอปพลิเคชันที่ขับเคลื่อนด้วยข้อมูลแบบเรียลไทม์ Redis คือแคช, เซิร์ฟเวอร์โครงสร้างข้อมูล, และเอนจินค้นหาเอกสารและเวกเตอร์ที่ได้รับความนิยม รวดเร็วที่สุด และมีฟีเจอร์ครบครันที่สุด

กรณีการใช้งานหลัก

Redis มีความเป็นเลิศในแอปพลิเคชันหลากหลายประเภท ได้แก่:

  • Caching: รองรับนโยบายการลบข้อมูลหลายแบบ, การหมดอายุของคีย์, และการหมดอายุของ hash-field
  • Distributed Session Store: นำเสนอการสร้างแบบจำลองข้อมูลเซสชันที่ยืดหยุ่น (string, JSON, hash)
  • Data Structure Server: มีโครงสร้างข้อมูลระดับต่ำ (strings, lists, sets, hashes, sorted sets, JSON, ฯลฯ) พร้อมความหมายระดับสูง (counters, queues, leaderboards, rate limiters) และรองรับ transactions & scripting
  • NoSQL Data Store: การจัดเก็บข้อมูลแบบ Key-value, document, และ time series
  • Search and Query Engine: การทำ Indexing สำหรับเอกสาร hash/JSON, รองรับ vector search, full-text search, geospatial queries, ranking, และ aggregations ผ่าน Redis Search
  • Event Store & Message Broker: ใช้ queues (lists), priority queues (sorted sets), event deduplication (sets), streams, และ pub/sub พร้อมความสามารถในการประมวลผลสตรีมแบบ probabilistic
  • Vector Store สำหรับ GenAI: ผสานรวมกับแอปพลิเคชัน AI (เช่น LangGraph, mem0) สำหรับหน่วยความจำระยะสั้น, หน่วยความจำระยะยาว, การแคชการตอบสนองของ LLM (semantic caching), และ retrieval augmented generation (RAG)
  • Real-Time Analytics: ขับเคลื่อนการปรับแต่งส่วนบุคคล, คำแนะนำ, การตรวจจับการฉ้อโกง, และการประเมินความเสี่ยง

ทำไมต้องเลือก Redis?

Redis เป็นตัวเลือกยอดนิยมสำหรับนักพัฒนาทั่วโลกเนื่องจากการผสมผสานระหว่างความเร็ว ความยืดหยุ่น และชุดฟีเจอร์ที่หลากหลาย นี่คือเหตุผลที่ผู้คนเลือกใช้ Redis สำหรับ:

  • ประสิทธิภาพ: เนื่องจาก Redis เก็บข้อมูลส่วนใหญ่ไว้ในหน่วยความจำและใช้โครงสร้างข้อมูลที่มีประสิทธิภาพ จึงทำให้มีความหน่วงต่ำมาก (มักจะต่ำกว่ามิลลิวินาที) สำหรับทั้งการอ่านและการเขียน ทำให้เหมาะสำหรับแอปพลิเคชันที่ต้องการการตอบสนองแบบเรียลไทม์
  • ความยืดหยุ่น: Redis ไม่ใช่แค่ key-value store เท่านั้น แต่ยังรองรับโครงสร้างข้อมูลและความสามารถที่หลากหลายตามที่ระบุไว้ใน Redis คืออะไร?
  • ความสามารถในการขยาย: Redis ไม่ได้จำกัดอยู่แค่โครงสร้างข้อมูลในตัว แต่มี modules API ที่ทำให้สามารถขยายฟังก์ชันการทำงานของ Redis และนำคำสั่ง Redis ใหม่ๆ มาใช้ได้อย่างรวดเร็ว
  • ความเรียบง่าย: Redis มีโปรโตคอลที่เรียบง่ายแบบข้อความ และ ชุดคำสั่งที่มีเอกสารประกอบอย่างดี
  • ความแพร่หลาย: Redis ได้รับการทดสอบในการใช้งานจริงในระดับใหญ่ มีโอกาสสูงที่คุณจะโต้ตอบกับ Redis โดยอ้อมหลายครั้งต่อวัน
  • ความหลากหลาย: Redis เป็นมาตรฐานโดยพฤตินัยสำหรับกรณีการใช้งานต่างๆ เช่น:- **Caching:** เข้าถึงข้อมูลที่ใช้บ่อยได้อย่างรวดเร็วโดยไม่จำเป็นต้องสอบถามฐานข้อมูลหลักของคุณ - **Session management:** อ่านและเขียนข้อมูลเซสชันผู้ใช้โดยไม่กระทบต่อประสบการณ์ผู้ใช้หรือทำให้การเรียก API ทุกครั้งช้าลง - **Querying, sorting, and analytics:** ทำการ deduplication, full text search, และ secondary indexing บนข้อมูลในหน่วยความจำให้เร็วที่สุดเท่าที่จะทำได้ - **Messaging and interservice communication:** job queues, message brokering, pub/sub, และ streams สำหรับการสื่อสารระหว่างบริการต่างๆ - **Vector operations:** หน่วยความจำ LLM ระยะยาวและระยะสั้น, การดึงข้อมูล RAG, semantic caching, semantic routing, และ vector similarity search

โดยสรุปแล้ว Redis มอบชุดเครื่องมือที่ทรงพลัง รวดเร็ว และยืดหยุ่นสำหรับการแก้ปัญหาการจัดการข้อมูลที่หลากหลาย หากคุณต้องการทราบข้อมูลเพิ่มเติม นี่คือรายการจุดเริ่มต้น:

Redis Open Source คืออะไร?

Redis Community Edition (Redis CE) ได้รับการเปลี่ยนชื่อเป็น Redis Open Source พร้อมกับการเปิดตัวเวอร์ชัน 8.0

Redis Ltd. ยังนำเสนอ Redis Software ซึ่งเป็นซอฟต์แวร์ที่จัดการด้วยตนเองพร้อมการปฏิบัติตามข้อกำหนด ความน่าเชื่อถือ และความยืดหยุ่นเพิ่มเติม

การใช้ Redis กับไลบรารีไคลเอนต์

ในการเชื่อมต่อแอปพลิเคชันของคุณเข้ากับ Redis คุณจะต้องมีไลบรารีไคลเอนต์ Redis มีไลบรารีไคลเอนต์ที่จัดทำเอกสารไว้ในภาษาที่ได้รับความนิยมส่วนใหญ่ และมีไลบรารีไคลเอนต์ที่ชุมชนสนับสนุนในภาษาเพิ่มเติม

การใช้ Redis กับ redis-cli

redis-cli คืออินเทอร์เฟซบรรทัดคำสั่งของ Redis มีให้ใช้งานเป็นส่วนหนึ่งของการแจกจ่ายไบนารีทั้งหมด และเมื่อคุณสร้าง Redis จากซอร์ส

คุณสามารถเริ่มอินสแตนซ์ redis-server จากนั้นในเทอร์มินัลอื่นลองทำตามนี้:

sh
cd src
./redis-cli
text
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis>

การใช้ Redis กับ Redis Insight

เพื่อประสบการณ์ที่มองเห็นได้ชัดเจนและใช้งานง่ายยิ่งขึ้น ให้ใช้ Redis Insight ซึ่งเป็นเครื่องมือที่ช่วยให้คุณสำรวจข้อมูล ออกแบบ พัฒนา และปรับแต่งแอปพลิเคชันของคุณ พร้อมทั้งทำหน้าที่เป็นแพลตฟอร์มสำหรับการศึกษาและเริ่มต้นใช้งาน Redis อีกด้วย Redis Insight ได้รวม Redis Copilot ซึ่งเป็นผู้ช่วย AI ภาษาธรรมชาติที่ช่วยปรับปรุงประสบการณ์ในการทำงานกับข้อมูลและคำสั่งต่างๆ

ประเภทข้อมูล, เอ็นจิ้นประมวลผล และความสามารถของ Redis

Redis มีประเภทข้อมูล, เอ็นจิ้นประมวลผล และความสามารถที่หลากหลายเพื่อรองรับกรณีการใช้งานที่กว้างขวาง:

  • String: ลำดับของไบต์ รวมถึงข้อความ, อ็อบเจกต์ที่ถูกซีเรียลไลซ์ และอาร์เรย์ไบนารีที่ใช้สำหรับการแคช, ตัวนับ และการดำเนินการแบบบิตไวส์
  • JSON: เอกสาร JSON แบบซ้อนที่สามารถจัดทำดัชนีและค้นหาได้โดยใช้ JSONPath expressions และด้วย Redis Search
  • Array: คอลเลกชันของค่าสตริงที่สามารถระบุตำแหน่งด้วยดัชนีแบบกระจัดกระจาย
  • Hash: แผนที่ฟิลด์-ค่าที่ใช้เพื่อแสดงอ็อบเจกต์พื้นฐานและจัดเก็บกลุ่มของคู่คีย์-ค่า พร้อมรองรับ การหมดอายุของฟิลด์แฮช (TTL)
  • Redis Search: ใช้ Redis เป็นฐานข้อมูลเอกสาร, ฐานข้อมูลเวกเตอร์, ดัชนีรอง และเครื่องมือค้นหา กำหนดดัชนีสำหรับเอกสารแฮชและ JSON จากนั้นใช้ภาษาคิวรีที่หลากหลายสำหรับการค้นหาเวกเตอร์, การค้นหาข้อความเต็ม, คิวรีเชิงภูมิศาสตร์ และการรวมข้อมูล
  • List: ลิงก์ลิสต์ของค่าสตริงที่ใช้เป็นสแต็ก, คิว และสำหรับการจัดการคิว
  • Set: คอลเลกชันของสตริงที่ไม่ซ้ำกันและไม่มีลำดับ ใช้สำหรับการติดตามรายการที่ไม่ซ้ำกัน, ความสัมพันธ์ และการดำเนินการเซ็ตทั่วไป (การตัดกัน, การรวมกัน, ความแตกต่าง)
  • Sorted set: คอลเลกชันของสตริงที่ไม่ซ้ำกันที่จัดเรียงตามคะแนนที่เกี่ยวข้อง ใช้สำหรับกระดานผู้นำและตัวจำกัดอัตรา
  • Vector set (beta): คอลเลกชันของเวกเตอร์ฝังตัวที่ใช้สำหรับการค้นหาความคล้ายคลึงทางความหมาย, การแคชเชิงความหมาย, การกำหนดเส้นทางเชิงความหมาย และ Retrieval Augmented Generation (RAG)
  • Geospatial indexes: พิกัดที่ใช้สำหรับการค้นหาจุดใกล้เคียงภายในรัศมีหรือกรอบขอบเขตที่กำหนด
  • Bitmap: ชุดของการดำเนินการแบบบิตที่กำหนดบนประเภทสตริง ใช้สำหรับการแสดงเซ็ตที่มีประสิทธิภาพและการอนุญาตอ็อบเจกต์
  • Bitfield: สตริงที่เข้ารหัสไบนารีที่ช่วยให้คุณสามารถตั้งค่า, เพิ่ม และรับค่าจำนวนเต็มที่มีความยาวบิตตามอำเภอใจ ใช้สำหรับตัวนับช่วงจำกัด, ค่าตัวเลข และการอนุญาตอ็อบเจกต์หลายระดับ เช่น การควบคุมการเข้าถึงตามบทบาท (RBAC)
  • Hyperloglog: โครงสร้างข้อมูลเชิงความน่าจะเป็นสำหรับการประมาณค่าคาร์ดินาลิตี้ของเซ็ต ใช้สำหรับการวิเคราะห์ เช่น การนับจำนวนการเข้าชมที่ไม่ซ้ำกัน, การกรอกแบบฟอร์ม เป็นต้น
  • *Bloom filter: โครงสร้างข้อมูลเชิงความน่าจะเป็นเพื่อตรวจสอบว่ามีค่าที่กำหนดอยู่ในเซ็ตหรือไม่ ใช้สำหรับการตรวจจับการฉ้อโกง, การวางโฆษณา และการตรวจสอบคอลัมน์ที่ไม่ซ้ำกัน (เช่น ชื่อผู้ใช้/อีเมล/slug)
  • *Cuckoo filter: โครงสร้างข้อมูลเชิงความน่าจะเป็นสำหรับการตรวจสอบว่ามีค่าที่กำหนดอยู่ในเซ็ตหรือไม่ พร้อมทั้งอนุญาตให้มีการนับและการลบที่จำกัด ใช้ในการโฆษณาแบบกำหนดเป้าหมายและการตรวจสอบรหัสคูปอง
  • *t-digest: โครงสร้างข้อมูลเชิงความน่าจะเป็นที่ใช้สำหรับการประมาณค่าเปอร์เซ็นไทล์ของชุดข้อมูลขนาดใหญ่โดยไม่จำเป็นต้องจัดเก็บและจัดเรียงข้อมูลทั้งหมด ใช้สำหรับการตรวจสอบฮาร์ดแวร์/ซอฟต์แวร์, เกมออนไลน์, การตรวจสอบปริมาณการรับส่งข้อมูลเครือข่าย และการบำรุงรักษาเชิงคาดการณ์
  • *Top-k: โครงสร้างข้อมูลเชิงความน่าจะเป็นสำหรับการค้นหาค่าที่พบบ่อยที่สุดในสตรีมข้อมูล ใช้สำหรับการค้นพบแนวโน้ม
  • *Count-min sketch: โครงสร้างข้อมูลเชิงความน่าจะเป็นสำหรับการประมาณว่าค่าที่กำหนดปรากฏในสตรีมข้อมูลกี่ครั้ง ใช้สำหรับการคำนวณปริมาณการขาย
  • Time series: จุดข้อมูลที่จัดทำดัชนีตามลำดับเวลา ใช้สำหรับการตรวจสอบข้อมูลเซ็นเซอร์, การติดตามสินทรัพย์ และการวิเคราะห์เชิงคาดการณ์
  • Pub/sub: ความสามารถในการส่งข้อความแบบเบา ผู้เผยแพร่ส่งข้อความไปยังช่อง และผู้สมัครรับข้อมูลรับข้อความจากช่องนั้น
  • Stream: บันทึกแบบเพิ่มเท่านั้นที่มีความสามารถในการเข้าถึงแบบสุ่มและกลยุทธ์การบริโภคที่ซับซ้อน เช่น กลุ่มผู้บริโภค ใช้สำหรับการจัดหาเหตุการณ์, การตรวจสอบเซ็นเซอร์ และการแจ้งเตือน
  • Transaction: อนุญาตให้ดำเนินการกลุ่มคำสั่งในขั้นตอนเดียว คำขอที่ส่งโดยไคลเอนต์อื่นจะไม่ถูกให้บริการในระหว่างการดำเนินการของธุรกรรม สิ่งนี้รับประกันว่าคำสั่งจะถูกดำเนินการเป็นปฏิบัติการที่แยกต่างหากเพียงครั้งเดียว
  • Programmability: อัปโหลดและรันสคริปต์ Lua บนเซิร์ฟเวอร์ สคริปต์สามารถใช้โครงสร้างการควบคุมแบบโปรแกรมและใช้คำสั่งส่วนใหญ่ในขณะที่รันเพื่อเข้าถึงฐานข้อมูล เนื่องจากการรันสคริปต์บนเซิร์ฟเวอร์ การอ่านและเขียนข้อมูลจากสคริปต์จึงมีประสิทธิภาพมาก

Redis ที่โฮสต์บนคลาวด์

Redis ที่จัดการเต็มรูปแบบพร้อมประสิทธิภาพแบบเรียลไทม์ในระดับที่ปรับขนาดได้

Redis Cloud

ชุมชน

แหล่งข้อมูลชุมชน Redis

สร้าง Redis จากซอร์ส

ส่วนนี้อ้างถึงการสร้าง Redis จากซอร์ส หากคุณต้องการเริ่มต้นใช้งาน Redis อย่างรวดเร็วโดยไม่จำเป็นต้องสร้างจากซอร์ส โปรดดูส่วน Getting started

ไฟล์การกำหนดค่า: ส่วนที่ระบุระบบปฏิบัติการด้านล่างจะบอกให้คุณรัน ./src/redis-server redis-full.conf redis-full.conf คือไฟล์การกำหนดค่าการเปิดตัวที่สร้างขึ้นโดยอัตโนมัติโดย make modules-update — ซึ่งก็คือ redis.conf บวกกับบรรทัด loadmodule และการตั้งค่าต่อโมดูลสำหรับโมดูลที่รวมมาด้วย ซึ่งถูกผนวกต่อท้ายการกำหนดค่าหลัก แก้ไขการตั้งค่า Redis-core ใน redis.conf; make modules-update ครั้งถัดไป (หรือ make sync-redis-conf) จะสร้าง redis-full.conf ขึ้นมาใหม่ ไฟล์ tarball ของรุ่นจะรวมการกำหนดค่าโมดูลเข้ากับ redis.conf โดยตรงในระหว่างการบรรจุ ดังนั้นจากไฟล์ tarball ที่แตกออกมา คุณสามารถรัน ./src/redis-server redis.conf ได้เช่นกัน ดู modules/MODULES.md สำหรับขั้นตอนการกำหนดค่าทั้งหมด

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Ubuntu 20.04 (Focal)

ทดสอบด้วย Docker image ต่อไปนี้:

  • ubuntu:20.04
  1. 1ติดตั้ง Dependencies ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือและไลบรารีสำหรับการพัฒนาที่จำเป็น: apt-get update apt-get install -y sudo sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf gcc-10 g++-10 libtool
  2. 2ใช้ GCC 10 เป็นคอมไพเลอร์เริ่มต้น อัปเดตคอมไพเลอร์เริ่มต้นของระบบเป็น GCC 10: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
  3. 3ติดตั้ง CMake ติดตั้ง CMake โดยใช้ `pip3` และลิงก์เพื่อการเข้าถึงทั่วทั้งระบบ: pip3 install cmake==3.31.6 sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake cmake --version หมายเหตุ: CMake เวอร์ชัน 3.31.6 เป็นเวอร์ชันล่าสุดที่รองรับ ไม่สามารถใช้เวอร์ชันที่ใหม่กว่าได้
  4. 4ดาวน์โหลด Source Code ของ Redis ดาวน์โหลดไฟล์เก็บถาวร Source Code ของ Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชันของ Redis เช่น `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. 5แตกไฟล์เก็บถาวร Source Code สร้างไดเรกทอรีสำหรับ Source Code และแตกไฟล์เนื้อหาลงในนั้น: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  6. 6สร้าง Redis ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็นและคอมไพล์ Redis: cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  7. 7รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Ubuntu 22.04 (Jammy)

ทดสอบด้วย Docker image ต่อไปนี้:

  • ubuntu:22.04
  1. 1ติดตั้ง Dependencies ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือและไลบรารีสำหรับการพัฒนาที่จำเป็น: apt-get update apt-get install -y sudo sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. 2ติดตั้ง CMake ติดตั้ง CMake โดยใช้ `pip3` และลิงก์เพื่อการเข้าถึงทั่วทั้งระบบ: pip3 install cmake==3.31.6 sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake cmake --version หมายเหตุ: CMake เวอร์ชัน 3.31.6 เป็นเวอร์ชันล่าสุดที่รองรับ ไม่สามารถใช้เวอร์ชันที่ใหม่กว่าได้
  3. 3ดาวน์โหลด Source Code ของ Redis ดาวน์โหลดไฟล์เก็บถาวร Source Code ของ Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชันของ Redis เช่น `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. 4แตกไฟล์เก็บถาวร Source Code สร้างไดเรกทอรีสำหรับ Source Code และแตกไฟล์เนื้อหาลงในนั้น: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  5. 5สร้าง Redis ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็นและสร้าง Redis: cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  6. 6รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Ubuntu 24.04 (Noble)

ทดสอบด้วย Docker image ต่อไปนี้:

  • ubuntu:24.04
  1. 1ติดตั้ง Dependencies ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือและไลบรารีสำหรับการพัฒนาที่จำเป็น: apt-get update apt-get install -y sudo sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. 2ดาวน์โหลด Source Code ของ Redis ดาวน์โหลดไฟล์เก็บถาวร Source Code ของ Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชันของ Redis เช่น `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  3. 3แตกไฟล์เก็บถาวร Source Code สร้างไดเรกทอรีสำหรับ Source Code และแตกไฟล์เนื้อหาลงในนั้น: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  4. 4สร้าง Redis ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็นและสร้าง Redis: cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  5. 5รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Ubuntu 26.04 (Resolute)

ทดสอบด้วย Docker image ต่อไปนี้:

  • ubuntu:26.04

หมายเหตุ: Ubuntu 26.04 มาพร้อมกับ CMake 4.x และ clang/LLVM 21 ใน repositories เริ่มต้น การสร้างโมดูล Redis ต้องการ CMake ≤ 3.31.6 และส่งผ่าน -fuse-ld=lld อย่างชัดเจน ดังนั้น CMake ที่รองรับจะต้องถูกปักหมุดผ่าน pip3 และต้องติดตั้ง lld, llvm และ libcrypt-dev (อย่างหลังจำเป็นสำหรับการลิงก์โมดูล redisearch กับ libcrypt)

  1. 1ติดตั้ง Dependencies ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือและไลบรารีสำหรับการพัฒนาที่จำเป็น `lld` และ `llvm` จำเป็นเนื่องจากการสร้างโมดูลเรียกใช้ clang ด้วย `-fuse-ld=lld` และใช้ `llvm-ar`; `libcrypt-dev` จำเป็นสำหรับการลิงก์ `redisearch.so`: apt-get update apt-get install -y sudo sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev libcrypt-dev make git python3 python3-pip python3-venv python3-dev unzip rsync clang lld llvm automake autoconf libtool
  2. 2ติดตั้ง CMake ติดตั้ง CMake เวอร์ชันที่รองรับโดยใช้ `pip3` (ภายใน virtual environment เนื่องจาก Ubuntu บังคับใช้ PEP 668) และลิงก์เพื่อการเข้าถึงทั่วทั้งระบบ: python3 -m venv /opt/cmake-venv /opt/cmake-venv/bin/pip install cmake==3.31.6 sudo ln -sf /opt/cmake-venv/bin/cmake /usr/local/bin/cmake cmake --version หมายเหตุ: CMake เวอร์ชัน 3.31.6 เป็นเวอร์ชันล่าสุดที่รองรับ ไม่สามารถใช้เวอร์ชันที่ใหม่กว่าได้
  3. 3ดาวน์โหลด Source Code ของ Redis ดาวน์โหลดไฟล์เก็บถาวร Source Code ของ Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชันของ Redis เช่น `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. 4แตกไฟล์เก็บถาวร Source Code สร้างไดเรกทอรีสำหรับ Source Code และแตกไฟล์เนื้อหาลงในนั้น: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  5. 5สร้าง Redis ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็นและสร้าง Redis: cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  6. 6รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Debian 12 (Bookworm) / 13 (Trixie)

ทดสอบด้วย Docker images ต่อไปนี้:

  • debian:bookworm
  • debian:bookworm-slim
  • debian:trixie
  • debian:trixie-slim
  1. 1ติดตั้ง Dependencies ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือและไลบรารีสำหรับการพัฒนาที่จำเป็น: apt-get update apt-get install -y sudo sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. 2ดาวน์โหลด Source Code ของ Redis ดาวน์โหลดไฟล์เก็บถาวร Source Code ของ Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชันของ Redis เช่น `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  3. 3แตกไฟล์เก็บถาวร Source Code สร้างไดเรกทอรีสำหรับ Source Code และแตกไฟล์เนื้อหาลงในนั้น: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  4. 4สร้าง Redis ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็นและสร้าง Redis: cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  5. 5รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - AlmaLinux 8.10 / Rocky Linux 8.10

ทดสอบด้วย Docker images ต่อไปนี้:

  • almalinux:8.10
  • almalinux:8.10-minimal
  • rockylinux/rockylinux:8.10
  • rockylinux/rockylinux:8.10-minimal
  1. 1เตรียมระบบ ขั้นตอนด้านล่างนี้สมมติว่าคุณกำลังรันในฐานะ `root` เช่นเดียวกับใน Docker images ที่ทดสอบ บน AlmaLinux/Rocky 8.10-minimal ให้ติดตั้ง `dnf` ก่อน:

sh microdnf install dnf -y

code

เปิดใช้งาน repository ที่จำเป็นและติดตั้งเครื่องมือพัฒนาพื้นฐาน:

```sh
dnf groupinstall "Development Tools" -y
dnf config-manager --set-enabled powertools
dnf install -y epel-release
  1. 1ติดตั้ง dependency ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือพัฒนาและไลบรารีที่จำเป็น: dnf install -y pkg-config wget gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ git make openssl openssl-devel python3.11 python3.11-pip python3.11-devel unzip rsync clang libtool automake autoconf jq systemd-devel เปิดใช้งาน GCC toolset: cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh echo "source /etc/profile.d/gcc-toolset-13.sh" >> /etc/bashrc
  2. 2ติดตั้ง CMake ติดตั้ง CMake 3.25.1 ด้วยตนเอง: CMAKE_VERSION=3.25.1 ARCH=$(uname -m) if [ "$ARCH" = "x86_64" ]; then CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-x86_64.sh else CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-aarch64.sh fi wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE} chmod +x ${CMAKE_FILE} ./${CMAKE_FILE} --skip-license --prefix=/usr/local --exclude-subdir rm ${CMAKE_FILE} cmake --version
  3. 3ดาวน์โหลดซอร์สโค้ด Redis ดาวน์โหลดไฟล์เก็บถาวรซอร์สโค้ด Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชัน Redis เช่น: `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. 4แตกไฟล์เก็บถาวรซอร์สโค้ด สร้างไดเรกทอรีสำหรับซอร์สโค้ดและแตกไฟล์เนื้อหาลงไป: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  5. 5สร้าง Redis เปิดใช้งาน GCC toolset, ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็น และสร้าง Redis: source /etc/profile.d/gcc-toolset-13.sh cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  6. 6รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - AlmaLinux 9.7+ / Rocky Linux 9.7+

ทดสอบด้วย Docker image ต่อไปนี้:

  • almalinux:9.7
  • almalinux:9.7-minimal
  • rockylinux/rockylinux:9.7
  • rockylinux/rockylinux:9.7-minimal
  1. 1เตรียมระบบ ขั้นตอนด้านล่างนี้สมมติว่าคุณกำลังรันในฐานะ `root` เช่นเดียวกับใน container image ที่ทดสอบ บน AlmaLinux/Rocky 9-minimal ให้ติดตั้ง `dnf` ก่อน: microdnf install dnf -y เปิดใช้งาน repository ที่จำเป็น (`epel-release` และ CRB มีแพ็กเกจ `-devel` บางส่วน): dnf install -y epel-release dnf config-manager --set-enabled crb
  2. 2ติดตั้ง dependency ที่จำเป็น อัปเดตรายการแพ็กเกจของคุณและติดตั้งเครื่องมือพัฒนาและไลบรารีที่จำเป็น: dnf install -y pkg-config xz wget which gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ git make openssl openssl-devel python3 python3-pip python3-devel unzip rsync clang libtool automake autoconf jq systemd-devel เปิดใช้งาน GCC toolset: cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh echo "source /etc/profile.d/gcc-toolset-13.sh" >> /etc/bashrc
  3. 3ติดตั้ง CMake ติดตั้ง CMake 3.25.1 ด้วยตนเอง: CMAKE_VERSION=3.25.1 ARCH=$(uname -m) if [ "$ARCH" = "x86_64" ]; then CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-x86_64.sh else CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-aarch64.sh fi wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE} chmod +x ${CMAKE_FILE} ./${CMAKE_FILE} --skip-license --prefix=/usr/local --exclude-subdir rm ${CMAKE_FILE} cmake --version
  4. 4ดาวน์โหลดซอร์สโค้ด Redis ดาวน์โหลดไฟล์เก็บถาวรซอร์สโค้ด Redis เวอร์ชันเฉพาะจาก GitHub แทนที่ `<version>` ด้วยเวอร์ชัน Redis เช่น: `8.0.0` cd /usr/src wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. 5แตกไฟล์เก็บถาวรซอร์สโค้ด สร้างไดเรกทอรีสำหรับซอร์สโค้ดและแตกไฟล์เนื้อหาลงไป: cd /usr/src tar xvf redis-<version>.tar.gz rm redis-<version>.tar.gz
  6. 6สร้าง Redis เปิดใช้งาน GCC toolset, ตั้งค่าตัวแปรสภาพแวดล้อมที่จำเป็น และสร้าง Redis: source /etc/profile.d/gcc-toolset-13.sh cd /usr/src/redis-<version> export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes make -j "$(nproc)" all
  7. 7รัน Redis cd /usr/src/redis-<version> ./src/redis-server redis-full.conf

สร้างและรัน Redis พร้อมโครงสร้างข้อมูลทั้งหมด - Al

เอกสารโปรเจกต์

อ่านเอกสารต้นฉบับ

README วิธีติดตั้ง วิธีใช้งาน และข้อกำหนดจาก repository ต้นฉบับ

ดูไฟล์บน GitHub

codecov

This document serves as both a quick start guide to Redis and a detailed resource for building it from source.

Table of contents

What is Redis?

For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.

Key use cases

Redis excels in various applications, including:

  • Caching: Supports multiple eviction policies, key expiration, and hash-field expiration.
  • Distributed Session Store: Offers flexible session data modeling (string, JSON, hash).
  • Data Structure Server: Provides low-level data structures (strings, lists, sets, hashes, sorted sets, JSON, etc.) with high-level semantics (counters, queues, leaderboards, rate limiters) and supports transactions & scripting.
  • NoSQL Data Store: Key-value, document, and time series data storage.
  • Search and Query Engine: Indexing for hash/JSON documents, supporting vector search, full-text search, geospatial queries, ranking, and aggregations via Redis Search.
  • Event Store & Message Broker: Implements queues (lists), priority queues (sorted sets), event deduplication (sets), streams, and pub/sub with probabilistic stream processing capabilities.
  • Vector Store for GenAI: Integrates with AI applications (e.g. LangGraph, mem0) for short-term memory, long-term memory, LLM response caching (semantic caching), and retrieval augmented generation (RAG).
  • Real-Time Analytics: Powers personalization, recommendations, fraud detection, and risk assessment.

Why choose Redis?

Redis is a popular choice for developers worldwide due to its combination of speed, flexibility, and rich feature set. Here's why people choose Redis for:

  • Performance: Because Redis keeps data primarily in memory and uses efficient data structures, it achieves extremely low latency (often sub-millisecond) for both read and write operations. This makes it ideal for applications demanding real-time responsiveness.
  • Flexibility: Redis isn't just a key-value store, it provides native support for a wide range of data structures and capabilities listed in What is Redis?
  • Extensibility: Redis is not limited to the built-in data structures, it has a modules API that makes it possible to extend Redis functionality and rapidly implement new Redis commands
  • Simplicity: Redis has a simple, text-based protocol and well-documented command set
  • Ubiquity: Redis is battle tested in production workloads at a massive scale. There is a good chance you indirectly interact with Redis several times daily
  • Versatility: Redis is the de facto standard for use cases such as:- **Caching:** quickly access frequently used data without needing to query your primary database - **Session management:** read and write user session data without hurting user experience or slowing down every API call - **Querying, sorting, and analytics:** perform deduplication, full text search, and secondary indexing on in-memory data as fast as possible - **Messaging and interservice communication:** job queues, message brokering, pub/sub, and streams for communicating between services - **Vector operations:** Long-term and short-term LLM memory, RAG content retrieval, semantic caching, semantic routing, and vector similarity search

In summary, Redis provides a powerful, fast, and flexible toolkit for solving a wide variety of data management challenges. If you want to know more, here is a list of starting points:

What is Redis Open Source?

Redis Community Edition (Redis CE) was renamed Redis Open Source with the v8.0 release.

Redis Ltd. also offers Redis Software, a self-managed software with additional compliance, reliability, and resiliency for enterprise scaling, and Redis Cloud, a fully managed service integrated with Google Cloud, Azure, and AWS for production-ready apps.

Read more about the differences between Redis Open Source and Redis here.

Getting started

If you want to get up and running with Redis quickly without needing to build from source, use one of the following methods:

If you prefer to build Redis from source - see instructions below.

Redis starter projects

To get started as quickly as possible in your language of choice, use one of the following starter projects:

Using Redis with client libraries

To connect your application to Redis, you will need a client library. Redis has documented client libraries in most popular languages, with community-supported client libraries in additional languages.

Using Redis with redis-cli

redis-cli is Redis' command line interface. It is available as part of all the binary distributions and when you build Redis from source.

You can start a redis-server instance, and then, in another terminal try the following:

sh
cd src
./redis-cli
text
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis>

Using Redis with Redis Insight

For a more visual and user-friendly experience, use Redis Insight - a tool that lets you explore data, design, develop, and optimize your applications while also serving as a platform for Redis education and onboarding. Redis Insight integrates Redis Copilot, a natural language AI assistant that improves the experience when working with data and commands.

Redis data types, processing engines, and capabilities

Redis provides a variety of data types, processing engines, and capabilities to support a wide range of use cases:

  • String: Sequences of bytes, including text, serialized objects, and binary arrays used for caching, counters, and bitwise operations.
  • JSON: Nested JSON documents that are indexed and searchable using JSONPath expressions and with Redis Search
  • Array: Sparse, index-addressable collection of string values
  • Hash: Field-value maps used to represent basic objects and store groupings of key-value pairs with support for hash field expiration (TTL)
  • Redis Search: Use Redis as a document database, a vector database, a secondary index, and a search engine. Define indexes for hash and JSON documents and then use a rich query language for vector search, full-text search, geospatial queries, and aggregations.
  • List: Linked lists of string values used as stacks, queues, and for queue management.
  • Set: Unordered collection of unique strings used for tracking unique items, relations, and common set operations (intersections, unions, differences).
  • Sorted set: Collection of unique strings ordered by an associated score used for leaderboards and rate limiters.
  • Vector set (beta): Collection of vector embeddings used for semantic similarity search, semantic caching, semantic routing, and Retrieval Augmented Generation (RAG).
  • Geospatial indexes: Coordinates used for finding nearby points within a given radius or bounding box.
  • Bitmap: A set of bit-oriented operations defined on the string type used for efficient set representations and object permissions.
  • Bitfield: Binary-encoded strings that let you set, increment, and get integer values of arbitrary bit length used for limited-range counters, numeric values, and multi-level object permissions such as role-based access control (RBAC)
  • Hyperloglog: A probabilistic data structure for approximating the cardinality of a set used for analytics such as counting unique visits, form fills, etc.
  • *Bloom filter: A probabilistic data structure to check if a given value is present in a set. Used for fraud detection, ad placement, and unique column (i.e. username/email/slug) checks.
  • *Cuckoo filter: A probabilistic data structure for checking if a given value is present in a set while also allowing limited counting and deletions used in targeted advertising and coupon code validation.
  • *t-digest: A probabilistic data structure used for estimating the percentile of a large dataset without having to store and order all the data points. Used for hardware/software monitoring, online gaming, network traffic monitoring, and predictive maintenance.
  • *Top-k: A probabilistic data structure for finding the most frequent values in a data stream used for trend discovery.
  • *Count-min sketch: A probabilistic data structure for estimating how many times a given value appears in a data stream used for sales volume calculations.
  • Time series: Data points indexed in time order used for monitoring sensor data, asset tracking, and predictive analytics
  • Pub/sub: A lightweight messaging capability. Publishers send messages to a channel, and subscribers receive messages from that channel.
  • Stream: An append-only log with random access capabilities and complex consumption strategies such as consumer groups. Used for event sourcing, sensor monitoring, and notifications.
  • Transaction: Allows the execution of a group of commands in a single step. A request sent by another client will never be served in the middle of the execution of a transaction. This guarantees that the commands are executed as a single isolated operation.
  • Programmability: Upload and execute Lua scripts on the server. Scripts can employ programmatic control structures and use most of the commands while executing to access the database. Because scripts are executed on the server, reading and writing data from scripts is very efficient.

Cloud hosted Redis

Fully-managed Redis with real-time performance at scale.

Redis Cloud

Community

Redis Community Resources

Build Redis from source

This section refers to building Redis from source. If you want to get up and running with Redis quickly without needing to build from source see the Getting started section.

These instructions apply to Redis 8.10 and above. For versions lower than 8.10, see the 8.8 build instructions.

Configuration files: the build steps below tell you to run ./src/redis-server redis.conf. Release tarballs bake the bundled modules' loadmodule lines and per-module settings directly into redis.conf during packaging, so an extracted release tarball is ready to run as-is. When building from a git checkout instead, that module config lives in the auto-generated redis-full.conf produced by make modules-update (and regenerated by make sync-redis-conf) — run ./src/redis-server redis-full.conf there. Edit Redis-core settings in redis.conf. See modules/MODULES.md for the full config flow.

Install dependencies and build

Building Redis with all data structures (JSON, time series, Bloom / cuckoo / count-min / top-k, t-digest, and the Query Engine) needs a build toolchain plus a few version-sensitive dependencies — GCC/Clang, LLVM 21, CMake 3.25–3.31.6, Rust 1.94, OpenSSL, Python 3, and assorted -dev libraries. Instead of a per-OS package list, the repo installs them for you with make bootstrap, which detects your OS and installs each bundled module's prerequisites.

CMake version range matters. The modules require 3.25 ≤ CMake ≤ 3.31.6 — CMake 4.x is not supported and the build will fail with it. On distros that ship CMake 4.x by default (e.g. Ubuntu 26.04), pin a supported version, e.g. pip3 install 'cmake==3.31.6'. Note make bootstrap only installs CMake when it's missing or too old; it won't downgrade a pre-installed 4.x, so remove/pin that yourself.

1. Get the source

Either works — the release tarball already bundles the module sources; a git checkout needs one extra step to fetch them:

sh
# A) Release tarball (recommended for building/running a release).
#    Replace <version>, e.g. 8.10.0 — extracts into redis-<version>/:
wget -O redis-<version>.tar.gz https://github.com/redis/redis/releases/download/<version>/redis-full.tar.gz
tar xvf redis-<version>.tar.gz && cd redis-<version>

# B) git checkout — clone the bundled modules once:
git clone https://github.com/redis/redis.git && cd redis
make modules-update

2. Install the build dependencies

Pick whichever option fits your environment:

  1. 1**Build inside the Docker build environment — recommended.** The repo ships [`docker/Dockerfile.noble`](https://github.com/redis/redis/blob/unstable/docker/Dockerfile.noble) (Ubuntu 24.04) with every prerequisite baked in, so you build inside the container and never touch your host toolchain: docker build -f docker/Dockerfile.noble -t redis-build:noble . # Multi-arch (requires `docker buildx` configured): docker buildx build --platform linux/amd64,linux/arm64 \ -f docker/Dockerfile.noble -t redis-build:noble . # Build with the working tree mounted: docker run --rm -it -v "$PWD":/workspace -w /workspace redis-build:noble \ bash -lc 'make -j"$(nproc)" && make run'
  2. 2**Install everything on a fresh machine or container.** On a clean environment (for example a throwaway `ubuntu:24.04` container), let bootstrap install every prerequisite for Redis core and all cloned modules: make bootstrap ⚠️ `make bootstrap` installs system packages and may **override existing versions** of shared tools (compiler, CMake, LLVM, …). Prefer option 1, or run it in a disposable container, if that matters on your machine.
  3. 3**See only what's missing.** To inspect which prerequisites are absent *before* installing anything, print one deduped list across Redis core and all modules: make bootstrap list Then install just the reported packages yourself. (Version-gated deps are shown as `name (>= X)`; optional test/coverage deps are listed separately and don't fail the check.)
  4. 4**Get the exact install commands to copy-paste.** To run exactly what `make bootstrap` would, but only for the missing dependencies, use dry-run — it prints the precise install command for each missing dependency and installs nothing: make bootstrap dry-run The commands are printed **per module**, so a dependency shared by several modules appears once for each. Work through them iteratively: 1. Copy-paste the commands for a module to install its dependencies. 2. Re-run `make bootstrap dry-run` — the deps you just installed no longer show, so you now see only what's still missing for the remaining modules. 3. Repeat until `make bootstrap dry-run` prints no install commands.

Manual, per-OS install (no Docker, and you'd rather not let make bootstrap touch your host): follow the per-OS dependency instructions in the 8.8 README, which still lists them explicitly — https://github.com/redis/redis/tree/8.8#readme.

3. Build and run

sh
export BUILD_TLS=yes            # optional — TLS support (needs OpenSSL dev libs)
make -j "$(nproc)"

# Release tarball (module config is baked into redis.conf):
./src/redis-server redis.conf
# From a git checkout, use the auto-generated module config instead:
./src/redis-server redis-full.conf

make (same as make build / make all) builds whatever is cloned under modules/*/src alongside Redis core. To build just the core data structures — even with modules cloned — use make build redis.

Building Redis - flags and general notes

Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures, and both 32 bit and 64-bit systems.

It may compile on Solaris derived systems (for instance SmartOS) but our support for this platform is best effort and Redis is not guaranteed to work as well as on Linux, OSX, and *BSD.

To build Redis with all the data structures (including JSON, time series, Bloom filter, cuckoo filter, count-min sketch, top-k, and t-digest) and with Redis Query Engine, make sure first that all the prerequisites are installed (see Install dependencies and build above), then clone the bundled modules once and build:

sh
make modules-update
make

make (same as make build / make all) always builds whatever's cloned under modules/*/src alongside Redis core — there's no separate flag to opt in. If nothing is cloned yet, you get a core-only build.

To build Redis with just the core data structures — even if modules are already cloned — use:

sh
make build redis

To build with TLS support, you need OpenSSL development libraries (e.g. libssl-dev on Debian/Ubuntu) and the following flag in the make command:

sh
make BUILD_TLS=yes

To build with systemd support, you need systemd development libraries (such as libsystemd-dev on Debian/Ubuntu or systemd-devel on CentOS), and the following flag:

sh
make USE_SYSTEMD=yes

To append a suffix to Redis program names, add the following flag:

sh
make PROG_SUFFIX="-alt"

You can build a 32 bit Redis binary using:

sh
make 32bit

After building Redis, it is a good idea to test it using:

sh
make test

If TLS is built, running the tests with TLS enabled (you will need tcl-tls installed):

sh
./utils/gen-test-certs.sh
./runtest --tls

Redis supports compression of replication stream via zstd as of 8.10. To build with compression support you have to install zstd development libraries (e.g libzstd-dev on Debian/Ubuntu) and use the following flag when invoking the make command:

sh
make BUILD_COMPRESSION=yes

Fixing build problems with dependencies or cached build options

Redis has some dependencies which are included in the deps directory. make does not automatically rebuild dependencies even if something in the source code of dependencies changes.

When you update the source code with git pull or when code inside the dependencies tree is modified in any other way, make sure to use the following command in order to really clean everything and rebuild from scratch:

sh
make distclean

This will clean: jemalloc, lua, hiredis, linenoise and other dependencies.

Also, if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, those options are cached indefinitely until you issue a make distclean command.

Fixing problems building 32 bit binaries

If after building Redis with a 32 bit target you need to rebuild it with a 64 bit target, or the other way around, you need to perform a make distclean in the root directory of the Redis distribution.

In case of build errors when trying to build a 32 bit binary of Redis, try the following steps:

  • Install the package libc6-dev-i386 (also try g++-multilib).
  • Try using the following command line instead of make 32bit: make CFLAGS="-m32 -march=native" LDFLAGS="-m32"

Allocator

Selecting a non-default memory allocator when building Redis is done by setting the MALLOC environment variable. Redis is compiled and linked against libc malloc by default, except for jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc.

To force compiling against libc malloc, use:

sh
make MALLOC=libc

To compile against jemalloc on Mac OS X systems, use:

sh
make MALLOC=jemalloc

Monotonic clock

By default, Redis will build using the POSIX clock_gettime function as the monotonic clock source. On most modern systems, the internal processor clock can be used to improve performance. Cautions can be found here: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/

On ARM aarch64 systems, the hardware clock is enabled by default because the ARM Generic Timer is architecturally guaranteed to be available and monotonic on all ARMv8-A processors (see the “The Generic Timer in AArch64 state” section of the Arm Architecture Reference Manual for Armv8-A).

To build with support for the processor's internal instruction clock on other architectures, use:

sh
make CFLAGS="-DUSE_PROCESSOR_CLOCK"

Verbose build

Redis will build with a user-friendly colorized output by default. If you want to see a more verbose output, use the following:

sh
make V=1

Running Redis with TLS

Please consult the TLS.md file for more information on how to use Redis with TLS.

Running Redis with the Query Engine and optional proprietary Intel SVS-VAMANA optimisations

License Disclaimer If you are using Redis Open Source under AGPLv3 or SSPLv1, you cannot use it together with the Intel Optimizations (Leanvec and LVQ binaries). The reason is that the Intel SVS license is not compatible with those licenses. The Leanvec and LVQ techniques are closed source and are only available for use with Redis Open Source when distributed under the RSALv2 license. For more details, please refer to the information provided by Intel here.

By default, Redis with the Redis Query Engine supports SVS-VAMANA index with global 8-bit quantisation. To compile Redis with the Intel SVS-VAMANA optimisations, LeanVec and LVQ, use the following:

sh
make BUILD_INTEL_SVS_OPT=yes

Alternatively, you can export the variable before running the build step for your platform:

sh
export BUILD_INTEL_SVS_OPT=yes
make

Code contributions

By contributing code to the Redis project in any form, including sending a pull request via GitHub, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the Redis Software Grant and Contributor License Agreement. Please see the CONTRIBUTING.md file in this source distribution for more information. For security bugs and vulnerabilities, please see SECURITY.md and the description of the ability of users to backport security patches under Redis Open Source 7.4+ under BSDv3. Open Source Redis releases are subject to the following licenses:

  1. 1Version 7.2.x and prior releases are subject to BSDv3. These contributions to the original Redis core project are owned by their contributors and licensed under the 3BSDv3 license as referenced in the REDISCONTRIBUTIONS.txt file. Any copy of that license in this repository applies only to those contributions;
  2. 2Versions 7.4.x to 7.8.x are subject to your choice of RSALv2 or SSPLv1; and
  3. 3Version 8.0.x and subsequent releases are subject to the tri-license RSALv2/SSPLv1/AGPLv3 at your option as referenced in the LICENSE.txt file.

Redis Trademarks

The purpose of a trademark is to identify the goods and services of a person or company without causing confusion. As the registered owner of its name and logo, Redis accepts certain limited uses of its trademarks, but it has requirements that must be followed as described in its Trademark Guidelines available at: https://redis.io/legal/trademark-policy/.

#cache#caching#database#distributed-systems#in-memory#in-memory-database#json#key-value#key-value-store#message-broker#message-queue#no-sql