Redis in-memory key-value store है — caching, sessions, queues के लिए व्यापक। यह गाइड Ubuntu/Debian पर localhost-only (अनुशंसित) Redis इंस्टॉल करता है।
पूर्वापेक्षाएँ
sudoवाला VPS, Ubuntu 20.04+ या Debian 11+
इंस्टॉलेशन
Bash1sudo apt update && sudo apt upgrade -y 2sudo apt install -y redis-server 3sudo systemctl enable redis-server 4sudo systemctl start redis-server 5sudo systemctl status redis-server
परीक्षण
Bashredis-cli ping # PONG redis-cli SET test "hello" redis-cli GET test
कॉन्फ़िग (/etc/redis/redis.conf)
bind 127.0.0.1 ::1— ऐप उसी सर्वर पर हो तो localhost रखेंprotected-mode yesrequirepass— नेटवर्क एक्सेस बढ़ाने परmaxmemory 256mb+maxmemory-policy allkeys-lru— छोटे VPS cache के लिए
Bashsudo systemctl restart redis-server
सुरक्षा
इंटरनेट पर expose न करें; UFW के साथ संयोजन करें।
Connection URL: redis://127.0.0.1:6379
समस्या निवारण
- Connection refused:
systemctl status redis-server,ss -tlnp | grep 6379 - OOM:
maxmemoryकम करें या RAM बढ़ाएँ