Skip to content

Instantly share code, notes, and snippets.

@yustam
Last active December 16, 2023 06:45
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save yustam/9086610 to your computer and use it in GitHub Desktop.
Save yustam/9086610 to your computer and use it in GitHub Desktop.
Install Redis on Elastic Beanstalk
packages:
yum:
gcc-c++: []
make: []
sources:
/home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz
commands:
redis_build:
command: make
cwd: /home/ec2-user/redis-2.8.4
redis_config_001:
command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf
cwd: /home/ec2-user/redis-2.8.4
redis_config_002:
command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf
cwd: /home/ec2-user/redis-2.8.4
redis_config_003:
command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf
cwd: /home/ec2-user/redis-2.8.4
redis_server:
command: src/redis-server redis.conf
cwd: /home/ec2-user/redis-2.8.4
@agam16
Copy link

agam16 commented Aug 5, 2014

How can i run this in AMI. It created the conf file and folders But how can i check if this is running or not?

@udomsak
Copy link

udomsak commented Sep 10, 2015

@Yustum Thank you you save my time. :) @agam16 from my mind This is for testing purpose. Amazon not recommend to install everything on ElasticSearch cause problem with state image save you should create Custom AMI and run by Amazon Beanstalk again.

@so77id
Copy link

so77id commented Sep 9, 2016

@yustam thank for this gist save my day 👍

@yingliangzhang
Copy link

Got follwoing error on EB 64bit Amazon Linux 2016.09 v3.1.0 running Node.js

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
    at Object.exports._errnoException (util.js:893:11)
    at exports._exceptionWithHostPort (util.js:916:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1075:14)

@kavi2017
Copy link

kavi2017 commented Jun 18, 2019

@yusam really i am very struct with redis configured in AWS elastic beanstalk. I had completed sails.js framework with redis, it is working fine in local machine. How to do make runnable in AWS EB?
Below are i tried steps.

  1. ElasticCache - created Redis instance with security group which was created in AWS EB environment instance.
  2. sails - config/session.js - In this file, i am just enabled adapter redis and provide options host and port.

But i didnt get AWS EB workable for my sails.js API. Kindly advice.

@kshitijpurwar
Copy link

Updated in Nov 2019

packages: 
  yum:
    gcc-c++: [] 
    make: []
sources:
  /home/ec2-user: http://download.redis.io/releases/redis-5.0.5.tar.gz
commands:
  redis_build:
    command: make
    cwd: /home/ec2-user/redis-5.0.5
  redis_config_001:
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf
    cwd: /home/ec2-user/redis-5.0.5
  redis_config_002:
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf
    cwd: /home/ec2-user/redis-5.0.5
  redis_config_003:
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf
    cwd: /home/ec2-user/redis-5.0.5
  redis_server:
    command: src/redis-server redis.conf
    cwd: /home/ec2-user/redis-5.0.5

@ariel-frischer
Copy link

I'm getting the same error as @yingliangzhang, using single docker application

@lorenc-tomasz
Copy link

I have redis-2.8.4, how to update it on EB?

@juanccamachob94
Copy link

Thank you very much! works perfect to use in my application on 127.0.0.1

@nyousefzai
Copy link

nyousefzai commented Jul 25, 2023

2023

  yum:
    gcc-c++: [] 
    make: []
sources:
  /home/ec2-user: http://download.redis.io/releases/redis-6.2.6.tar.gz
commands:
  redis_build:
    command: make
    cwd: /home/ec2-user/redis-6.2.6
  redis_config_001:
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf
    cwd: /home/ec2-user/redis-6.2.6
  redis_config_002:
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf
    cwd: /home/ec2-user/redis-6.2.6
  redis_config_003:
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf
    cwd: /home/ec2-user/redis-6.2.6
  redis_server:
    command: src/redis-server redis.conf
    cwd: /home/ec2-user/redis-6.2.6```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment