How To Install Redis 2.x on Red Hat

Redis 2.4
1. Install using yum. The current yum version as of this writing is Redis 2.4.

> yum install redis php-pecl-redis

2. Edit redis.conf. Comment out the bind configuration to bind Redis on all IPs.

> vi /etc/redis.conf
#bind 127.0.0.1

3. Start Redis manually and on startup.

> service redis start
> chkconfig redis on

Redis 2.8

1. Download Redis 2. The latest Redis 2 version as of this writing is Redis 2.8.22.

> mkdir redis; cd redis
> wget http://download.redis.io/releases/redis-2.8.22.tar.gz
> tar xzf redis-2.8.22.tar.gz
> cd redis-2.8.22

2. You need to compile Redis. In case you don’t have Make, use yum to install it.

> yum update
> yum install gcc make

3. Compile Redis. Do an initial distclean just in case.

> make distclean
> make

4. Install Redis under the default /usr/local/bin directory.

> make install

5. Copy the Redis init.d script.

> cp utils/redis_init_script /etc/init.d/redis

6. Start Redis manually and on startup.

> service redis start
> chkconfig redis on

Warnings

Redis will give out warnings on startup. Here are the commands used to get rid of these warnings.

1. Enable kernel virtual memory overcommit.

> sysctl vm.overcommit_memory=1
> vi /etc/sysctl.conf
vm.overcommit_memory=1

2. Disable Transparent Huge Pages (THP).

> echo never > sys/kernel/mm/transparent_<wbr />hugepage/enabled

3. Increase system wide open files limit.

> sysctl -w fs.file-max=10032
> vi /etc/sysctl.conf
fs.file-max=10032

4. Increase backlogged sockets count.

> sysctl -w net.core.somaxconn=512
> vi /etc/sysctl.conf
net.core.somaxconn=512 

No Comments


Leave a Reply

Your email address will not be published. Required fields are marked *