Redis Installation
Add the EPEL repository, and update YUM
1 2 |
sudo yum install epel-release sudo yum update -y |
Install Redis
1 |
sudo yum install redis -y |
Start Redis and setup automatically start Redis on boot
1 2 |
sudo systemctl start redis sudo systemctl enable redis |
Verify the Installation
1 |
redis-cli ping |
If Redis is running, it will return: PONG
Redis Configuration
Password settings
1 2 |
sudo vi /etc/redis.conf requirepass master_password |
find and uncomment the requirepass line in the configuration file, and replace master_password with a secure password
Firewall settings
1 2 3 |
sudo yum install firewalld -y sudo firewall-cmd --permanent --add-port=6379/tcp sudo firewall-cmd --reload |
Local Benchmark Test
1 |
redis-benchmark -q -n 100000 |
Check Redis Version
1 |
redis-server --version |
Setup PHP session to Redis
1 2 3 |
yum install php-pecl-redis session.save_handler = redis session.save_path = "tcp://<redis_server_ip>:6379?auth=<password>" |