Redis installation from source¶
Redis installation from source involves compiling the Redis server manually from a downloaded release tarball.^[600-developer__big-data__redis__redis-01-install.md]
Prerequisites¶
Before compiling, the system must have the necessary build tools installed.^[600-developer__big-data__redis__redis-01-install.md]
- GCC/C++ Compiler: Verify and install the compiler using
yum install gcc-c++^[600-developer__big-data__redis__redis-01-install.md].
Installation¶
The compilation process requires downloading the source code, extracting it, and running the build command^[600-developer__big-data__redis__redis-01-install.md].
- Download the source code (e.g.,
wget http://download.redis.io/releases/redis-5.0.0.tar.gz).^[600-developer__big-data__redis__redis-01-install.md] - Extract the tarball (
tar zxvf ...).^[600-developer__big-data__redis__redis-01-install.md] - Create a symbolic link (optional) for easier directory management (
ln -s redis-5.0.0 redis).^[600-developer__big-data__redis__redis-01-install.md] - Compile the source by running
makeinside the directory^[600-developer__big-data__redis__redis-01-install.md].
Running Redis¶
To run the server with the default configuration, navigate to the source directory and execute the server binary^[600-developer__big-data__redis__redis-01-install.md].
You can verify that the server is running by checking the process list or open ports^[600-developer__big-data__redis__redis-01-install.md].
ps -ef | grep redislsof -i:6379^[600-developer__big-data__redis__redis-01-install.md]
System Configuration¶
During runtime, Redis may issue warnings regarding kernel parameters that affect performance and stability^[600-developer__big-data__redis__redis-01-install.md].
TCP Backlog (net.core.somaxconn)¶
A warning indicates if the TCP backlog setting (default 511) exceeds the kernel limit (default 128)^[600-developer__big-data__redis__redis-01-install.md]. The net.core.somaxconn parameter defines the socket listening queue limit^[600-developer__big-data__redis__redis-01-install.md].
To resolve this, edit /etc/sysctl.conf and apply the changes^[600-developer__big-data__redis__redis-01-install.md]:
net.core.somaxconn=32768
sysctl -p
Overcommit Memory¶
Redis warns if vm.overcommit_memory is set to 0, as background saves may fail under low memory conditions^[600-developer__big-data__redis__redis-01-install.md].
To fix this, set the value to 1 in /etc/sysctl.conf and apply it immediately^[600-developer__big-data__redis__redis-01-install.md]:
sysctl vm.overcommit_memory=1
Transparent Huge Pages (THP)¶
Enabled THP support can cause latency and memory usage issues^[600-developer__big-data__redis__redis-01-install.md]. To disable it, run the following command as root and add it to /etc/rc.local to persist across reboots^[600-developer__big-data__redis__redis-01-install.md]:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Installation Paths¶
By default, make installs binaries in the src directory of the source tree^[600-developer__big-data__redis__redis-01-install.md]. To install Redis to a specific system directory, use the PREFIX variable^[600-developer__big-data__redis__redis-01-install.md].
Sources¶
- 600-developer__big-data__redis__redis-01-install.md