Ferikgong 13, 2026Dikaelo
Jang go Tsenya le go Beakanya Redis mo Linux Server
Kaelo ya kgato ka kgato ya go tsenya Redis caching server mo Ubuntu le CentOS go tokafatsa tiragatso ya application.

Redis ke polokelo ya sebopeho sa data mo memory e e dirisiwang jaaka database, cache, le message broker. E botlhokwa ya di-application tsa tiragatso e e kwa godimo tse di tlhokang phithelelo ya data e e bonako. Kaelo e e go bontsha gore o ka tsenya le go beakanya Redis jang mo Hiddence server ya gago.
Go Tsenya Redis mo Ubuntu/Debian
bash
sudo apt update
sudo apt install redis-server -y
sudo systemctl start redis-server
sudo systemctl enable redis-server
# Netefatsa tsenyo
redis-cli ping
# E tshwanetse go busa: PONGGo Tsenya Redis mo CentOS/RHEL
bash
sudo yum install epel-release -y
sudo yum install redis -y
sudo systemctl start redis
sudo systemctl enable redis
# Netefatsa tsenyo
redis-cli ping
# E tshwanetse go busa: PONGGo Beakanya Redis
Fetola fayele ya peakanyo ya Redis go oketsa tiragatso:
bash
sudo nano /etc/redis/redis.conf
# Di-setting tsa botlhokwa:
# maxmemory 256mb
# maxmemory-policy allkeys-lru
# bind 127.0.0.1 (ya tshireletso)
# requirepass password_ya_gago_e_e_thata
sudo systemctl restart redisGo Sireletsa Redis
Ka default, Redis ga e a sireletswa ka password. Seta password:
bash
sudo nano /etc/redis/redis.conf
# Batla le go ntsha comment:
requirepass password_ya_gago_e_e_thata_fa
# Restart Redis
sudo systemctl restart redis
# Testa kgolagano ka password
redis-cli -a password_ya_gago_e_e_thata_fa pingTshebediso ya Motheo ya Redis
bash
# Golagana le Redis
redis-cli
# Seta key-value pair
SET mykey "Dumela Redis"
# Bona boleng
GET mykey
# Seta go fela (TTL)
SETEX mykey 60 "boleng"
# Tlhola fa key e le teng
EXISTS mykey
# Tlosa key
DEL mykeyGo Dirisa Redis ka PHP
bash
# Tsenya PHP Redis extension
sudo apt install php-redis -y # Ubuntu/Debian
sudo yum install php-redis -y # CentOS
# Restart PHP-FPM
sudo systemctl restart php-fpm
# Testa mo PHP:
# <?php
# $redis = new Redis();
# $redis->connect('127.0.0.1', 6379);
# $redis->set('test', 'Dumela Redis');
# echo $redis->get('test');Mekgwa e e Molemo ya Redis
- Seta maxmemory go thibela Redis go dirisa RAM yotlhe
- Dirisa pholisi e e nepagetseng ya eviction (allkeys-lru e a kgothalediwa)
- Letlelela persistence (RDB kgotsa AOF) ya go nna teng ga data
- Tlhokomela tshebediso ya memory ya Redis ka gale
- Dirisa Redis Sentinel ya go nna teng go go kwa godimo
- Sireletsa Redis ka password le melao ya firewall
- Dira backup ya data ya Redis ka gale