Installation redis - kwantu/platformconfiguration GitHub Wiki

back to installation

#Redis installation

https://www.linode.com/docs/databases/redis/install-and-configure-redis-on-centos-7/

  1. Add the EPEL repository, and update YUM to confirm your change:
sudo yum install epel-release
sudo yum update
  1. Install Redis:
sudo yum install redis
  1. Start Redis:
#(on older version of centos)
service redis start 
#(centos 7)
sudo systemctl start redis 
  1. Optional: To automatically start Redis on boot:
# (centos 7)
sudo systemctl enable redis
  1. Verify the Installation
#Verify that Redis is running with redis-cli:
redis-cli ping

#If Redis is running, it will return:
PONG
  1. Set redis configuration
vim /etc/redis.conf

# set the location of the data file
dir /usr/local/data/redis

# Set the behaviour of the persist
appendonly yes
appendfsync everysec

port 6379
loglevel notice  (set to debug for now but back to notice for production)
  1. Create the data directory
sudo mkdir /usr/local/data/redis
sudo chown redis:redis /usr/local/data/redis
  1. Redis security settings https://redis.io/topics/security While Redis does not try to implement Access Control, it provides a tiny layer of authentication that is optionally turned on editing the redis.conf file. When the authorization layer is enabled, Redis will refuse any query by unauthenticated clients. A client can authenticate itself by sending the AUTH command followed by the password. The password is set by the system administrator in clear text inside the redis.conf file. It should be long enough to prevent brute force attacks:

For now I have not set a password. It should be set before moving to production.

  1. Server Tuning for Redis To improve Redis performance, set the Linux kernel overcommit memory setting to 1:
sudo sysctl vm.overcommit_memory=1

This immediately changes the overcommit memory setting, but the change will not persist across reboots. To make it

permanent, add vm.overcommit_memory = 1 in /etc/sysctl.conf:

Redis clients.

https://redis.io/clients#nodejs