Setup Redis on AWS

Setup Redis on AWS

This setup will help you in setting up redis on AWS. Follow these steps:

1. Sign up for an Amazon Web Services account.
2. Set up an EC2 instance (10 minutes). Be sure to select the Amazon Linux.
3. Leave the AWS Dashboard open in your browser.
4. Use SSH to connect to the server.

You should now be at the Linux command line of your EC2 instance, and ready to begin installing Redis.

First, we will update server and install the toolchain.

sudo yum -y update
sudo yum -y install gcc make

Download and install Redis 3.2.

Double check Redis for the latest link. If you get an error, use command “ls” to check the file name.

cd /usr/local/src
sudo wget http://download.redis.io/releases/redis-3.2.0.tar.gz
sudo tar xzf redis-3.2.0.tar.gz
sudo rm -f 3.2.0.tar.gz

Recompile Redis

cd redis-3.2.0
sudo make distclean
sudo make

Install tcl and Test Redis Installation

sudo yum install -y tcl
sudo make test

Make directories & copy files

sudo mkdir -p /etc/redis /var/lib/redis /var/redis/6379
sudo cp src/redis-server src/redis-cli /usr/local/bin
sudo cp redis.conf /etc/redis/6379.conf

Configure Redis

You will need some vim basics for this part.
pressing “:set number” will show the line numbers
pressing “i” will allow you to insert text (edit)
pressing “esc” will stop inserting and allow other vim commands
pressing “:wq” followed by enter will write then quit vim

Open the config file

sudo vi /etc/redis/6379.conf

Edit the file, using vim, and confirm the options are set as shown. Line numbers may be shown in the bottom right hand side of the vim window. Don’t include the line numbers as you edit!

bind 127.0.0.1 //line 61
daemonize yes //line 127
logfile “/var/log/redis_6379.log” //line 162
dir /var/redis/6379 //line 246

Download and install the init script

sudo wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
sudo mv redis-server /etc/init.d
sudo chmod 755 /etc/init.d/redis-server

Open the Redis server init script with vim

sudo vi /etc/init.d/redis-server

Edit the config file reference to match

REDIS_CONF_FILE=”/etc/redis/6379.conf” //line 26

Auto-enable and start the Redis server

sudo chkconfig –add redis-server
sudo chkconfig –level 345 redis-server on
sudo service redis-server start

Open the system controller config file with vim.

sudo vi /etc/systctl.conf

Add the following lines to ensure background saves and fix low-memory issue. This is a new file.

# ensure redis background save issue
vm.overcommit_memory = 1
systctl vm.overcommit_memory=1

Test Redis Server

redis-cli ping

The response should be PONG. If not, something went wrong.

Subscribe to our Newsletter.

Thank you! Your subscription has been added to our newsletter!
Oops! Something went wrong while submitting the form.

Related Blogs.

What is Material Design Lite and What are its Advantages?
logos
What is Material Design Lite and What are its Advantages?
MDL stands for "Material Design Lite". It is a free and open source library used for website's designing and its a look like material design.
SEO with Angular – Angular Universal
logos
SEO with Angular – Angular Universal
SEO is an abbreviation of Search Engine Optimization. Here, you will learn how to do SEO with Angular for a web page.
Difference between Functional and Object Oriented Programming
logos
Difference between Functional and Object Oriented Programming
These are two very popular programming paradigms in software development that developers design and program to. Read more to find out.
How to use Font Awesome for your Website?
logos
How to use Font Awesome for your Website?
Font Awesome helps adding scalable and beautiful icons on a web page. Let's teach you how to use awesome fonts for your site.
JQuery: The Write Less, Do More
logos
JQuery: The Write Less, Do More
jQuery is a (write less or do more) lightweight JS library that simplifies programming with JavaScript. Know more about the benefits of using jQuery in this blog.
Cross Browser Compatibility Issues
logos
Cross Browser Compatibility Issues
What is Cross Browser issue? They usually occur in various web applications. Learn to solve these cross browser compatibility issues in this blog post.
How to add Flash Messages in AngularJS?
logos
How to add Flash Messages in AngularJS?
Is something wrong with adding flash messages in AngularJS? Read this guide to get professional advice.
Angular 4 FORMS Confusion
logos
Angular 4 FORMS Confusion
Many people are often stuck with the Angular 4 forms confusion. But no need to worry because this solution will work for you.
Publish Subscribe Pattern
logos
Publish Subscribe Pattern
Nowadays, Web Applications are set to target maximum relevant users as they can. In order to do so, an application must have these qualities.
Dependencies Issue when One Signal is used with Google Maps (React Native)
logos
Dependencies Issue when One Signal is used with Google Maps (React Native)
Problem Statement: Google maps work fine when used alone but it get dependency issue when one signal is added to the project.
React Native Facebook Login?
logos
React Native Facebook Login?
This guide provides examples of using the Facebook Login Button and Login Manager components in your React Native applications.
Create an Angular Modular Plugin
logos
Create an Angular Modular Plugin
How to develop a Modular Plug-in For angular 4? Learn to create an angular modular plugin here.
search-btnsearch-btn
cross-filter
Search by keywords
No results found.
Please try different keywords.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Index
Share this blog
Setup Redis on AWS

This setup will help you in setting up redis on AWS. Follow these steps:

1. Sign up for an Amazon Web Services account.
2. Set up an EC2 instance (10 minutes). Be sure to select the Amazon Linux.
3. Leave the AWS Dashboard open in your browser.
4. Use SSH to connect to the server.

You should now be at the Linux command line of your EC2 instance, and ready to begin installing Redis.

First, we will update server and install the toolchain.

sudo yum -y update
sudo yum -y install gcc make

Download and install Redis 3.2.

Double check Redis for the latest link. If you get an error, use command “ls” to check the file name.

cd /usr/local/src
sudo wget http://download.redis.io/releases/redis-3.2.0.tar.gz
sudo tar xzf redis-3.2.0.tar.gz
sudo rm -f 3.2.0.tar.gz

Recompile Redis

cd redis-3.2.0
sudo make distclean
sudo make

Install tcl and Test Redis Installation

sudo yum install -y tcl
sudo make test

Make directories & copy files

sudo mkdir -p /etc/redis /var/lib/redis /var/redis/6379
sudo cp src/redis-server src/redis-cli /usr/local/bin
sudo cp redis.conf /etc/redis/6379.conf

Configure Redis

You will need some vim basics for this part.
pressing “:set number” will show the line numbers
pressing “i” will allow you to insert text (edit)
pressing “esc” will stop inserting and allow other vim commands
pressing “:wq” followed by enter will write then quit vim

Open the config file

sudo vi /etc/redis/6379.conf

Edit the file, using vim, and confirm the options are set as shown. Line numbers may be shown in the bottom right hand side of the vim window. Don’t include the line numbers as you edit!

bind 127.0.0.1 //line 61
daemonize yes //line 127
logfile “/var/log/redis_6379.log” //line 162
dir /var/redis/6379 //line 246

Download and install the init script

sudo wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
sudo mv redis-server /etc/init.d
sudo chmod 755 /etc/init.d/redis-server

Open the Redis server init script with vim

sudo vi /etc/init.d/redis-server

Edit the config file reference to match

REDIS_CONF_FILE=”/etc/redis/6379.conf” //line 26

Auto-enable and start the Redis server

sudo chkconfig –add redis-server
sudo chkconfig –level 345 redis-server on
sudo service redis-server start

Open the system controller config file with vim.

sudo vi /etc/systctl.conf

Add the following lines to ensure background saves and fix low-memory issue. This is a new file.

# ensure redis background save issue
vm.overcommit_memory = 1
systctl vm.overcommit_memory=1

Test Redis Server

redis-cli ping

The response should be PONG. If not, something went wrong.