Tag Archives: Amazon AWS

Amazon AWS – Installing Redis on EBS

In this step-by-step guide i’ll show you how to install Redis on AWS (Amazon Linux AMI).

I’ll assume you’re performing steps below as a su (sudo -s).

  1. First thing you need is to have following tools installed:
    > gcc
    > gcc-c++
    > make

    yum -y install gcc gcc-c++ make
    

    _

  2. Download Redis:
    cd /usr/local/src
    wget http://download.redis.io/releases/redis-2.8.12.tar.gz
    tar xzf redis-2.8.12.tar.gz
    rm -f redis-2.8.12.tar.gz
    

    _

  3. Build it:
    cd redis-2.8.12
    make distclean
    make
    

    _

  4. Create following directories and copy binaries:
    mkdir /etc/redis /var/redis
    cp src/redis-server src/redis-cli /usr/local/bin
    

    _

  5. Copy Redis template configuration file into /etc/redis/ (using Redis port number instance as its name (according to best practices mentioned on Redis site)):
    cp redis.conf /etc/redis/6379.conf
    

    _

  6. Create directory inside /var/redis that will act as working/data directory for this Redis instance:
    mkdir /var/redis/6379
    

    _

  7. Edit Redis config file to make necessary changes:
    nano /etc/redis/6379.conf
    

    _

  8. Make following changes to 6379.conf
    > Set daemonize to yes (by default it is set to no).
    > Set pidfile to /var/run/redis.pid
    > Set preferred loglevel
    > Set logfile to /var/log/redis_6379.log
    > Set dir to /var/redis/6379

    _

  9. Don’t copy the standard Redis init script from utils directory into /etc/init.d (as it’s not Amazon Linux AMI/chkconfig compliant), instead download the following:
    wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
    

    _

  10. Move and chmod downloaded redis init script:
    mv redis-server /etc/init.d
    chmod 755 /etc/init.d/redis-server
    

    _

  11. Edit redis-server init script and change redis conf file name as following:
    > REDIS_CONF_FILE=”/etc/redis/6379.conf”

    nano /etc/init.d/redis-server
    

    _

  12. Auto-enable Redis instance:
    chkconfig --add redis-server
    chkconfig --level 345 redis-server on
    

    _

  13. Start Redis:
    service redis-server start
    

    _

  14. (optional) Add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf (otherwise background save may fail under low memory condition – according to info on Redis site):
    > vm.overcommit_memory = 1

    nano /etc/sysctl.conf
    

    _

  15. Activate the new sysctl change:
    sysctl vm.overcommit_memory=1
    

    _

  16. Try pinging your instance with redis-cli:
    /usr/local/bin/redis-cli ping
    

    _

  17. Do few tests with redis-cli and check that the dump file is correctly stored into /var/redis/6379/ (you should find a file called dump.rdb):
    /usr/local/bin/redis-cli
    >set testkey testval
    >get testkey
    >del testkey
    >exit
    

    _

  18. Check that your Redis instance is correctly logging in the log file:
    cat /var/log/redis_6379.log
    

    _

 

And that would be basically it. Cheers.

 

Amazon AWS – CloudWatch – monitoring

Basic information about Amazon CloudWatch Service:

 

AWS Free Tier availability:

  • 10 Metrics,
  • 10 Alarms,
  • 1,000,000 API requests

 

Developer Resources:

 

Functionality:

  • Monitoring AWS resources automatically (without installing additional software):
    • Basic Monitoring for Amazon EC2 instances: ten pre-selected metrics at five-minute frequency, free of charge.
    • Detailed Monitoring for Amazon EC2 instances: seven pre-selected metrics at one-minute frequency, for an additional charge.
    • Amazon EBS volumes: eight pre-selected metrics at five-minute frequency, free of charge.
    • Elastic Load Balancers: ten pre-selected metrics at one-minute frequency, free of charge.
    • Amazon RDS DB instances: thirteen pre-selected metrics at one-minute frequency, free of charge.
    • Amazon SQS queues: eight pre-selected metrics at five-minute frequency, free of charge.
    • Amazon SNS topics: four pre-selected metrics at five-minute frequency, free of charge.
    • Amazon ElastiCache nodes: twenty-nine pre-selected metrics at one-minute frequency, free of charge.
    • Amazon DynamoDB tables: seven pre-selected metrics at five-minute frequency, free of charge.
    • AWS Storage Gateways: eleven pre-selected gateway metrics and five pre-selected storage volume metrics at five-minute frequency, free of charge.
    • Amazon Elastic MapReduce job flows: twenty-three pre-selected metrics at five-minute frequency, free of charge.
    • Auto Scaling groups: seven pre-selected metrics at one-minute frequency, optional and charged at standard pricing.
    • Estimated charges on your AWS bill: you can also choose to enable metrics to monitor your AWS charges.
  • Submitting Custom Metrics generated by your own applications (or by AWS resources not mentioned above) and having them monitored by Amazon CloudWatch. You can submit these metrics to Amazon CloudWatch via a simple Put API request.
  • Setting alarms on any of your metrics to receive notifications or take other automated actions when your metric crosses your specified threshold. You can also use alarms to detect and shut down EC2 instances that are unused or underutilized.
  • Viewing graphs and statistics for any of your metrics, and getting a quick overview of all your alarms and monitored AWS resources in one location on the Amazon CloudWatch dashboard.
  • Useing Auto Scaling to add or remove Amazon EC2 instances dynamically based on your Amazon CloudWatch metrics.

 

 

 

Resources:

Amazon AWS – ElastiCache – caching

Basic information about Amazon ElastiCache Service:

 

AWS Free Tier availability:

  • 750hrs of Micro Cache Node

 

Developer Resources:

 

Cache engines supported:

  • Memcached – widely adopted memory object caching system.
  • Redis – popular open-source in-memory key-value store that supports data structures such as sorted sets and lists.
    • ElastiCache supports Redis master / slave replication which can be used to achieve cross AZ redundancy.

 

Features:

  • Ease of management via the AWS Management Console.
  • Compatibility with the specific engine protocol.
  • Detailed monitoring statistics for the engine nodes at no extra cost via Amazon CloudWatch

 

Available Node Types:

  • Micro
    • Micro Cache Node (cache.t1.micro):
      • 213 MB memory,
      • Up to 2 ECU (for short periodic bursts),
      • 64-bit platform,
      • Low I/O Capacity
  • Standard
    • Small Cache Node (cache.m1.small):
      • 1.3 GB memory,
      • 1 ECU (1 virtual core with 1 ECU),
      • 64-bit platform,
      • Moderate I/O Capacity
    • Medium Cache Node (cache.m1.medium):
      • 3.35 GB memory,
      • 2 ECU (1 virtual core with 2 ECUs),
      • 64-bit platform,
      • Moderate I/O Capacity
    • Large Cache Node (cache.m1.large):
      • 7.1 GB memory,
      • 4 ECUs (2 virtual cores with 2 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
    • Extra Large Cache Node (cache.m1.xlarge):
      • 14.6 GB of memory,
      • 8 ECUs (4 virtual cores with 2 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
  • Enhanced
    • Extra Large Cache Node (cache.m3.xlarge):
      • 14.6 GB memory,
      • 13 ECUs (4 virtual cores with 3.25 ECUs each),
      • 64-bit platform,
      • Moderate I/O Capacity
    • Double Extra Large Cache Node (cache.m3.2xlarge):
      • 29.6 GB memory,
      • 26 ECUs (8 virtual cores with 3.25 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
  • High-Memory
    • High-Memory Extra Large Cache Node (cache.m2.xlarge):
      • 16.7 GB memory,
      • 6.5 ECU (2 virtual cores with 3.25 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
    • High-Memory Double Extra Large Cache Node (cache.m2.2xlarge):
      • 33.8 GB memory,
      • 13 ECUs (4 virtual cores with 3.25 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
    • High-Memory Quadruple Extra Large Cache Node (cache.m2.4xlarge):
      • 68 GB memory,
      • 26 ECUs (8 virtual cores with 3.25 ECUs each),
      • 64-bit platform,
      • High I/O Capacity
  • High-CPU
    • High-CPU Extra Large Cache Node (cache.c1.xlarge):
      • 6.6 GB memory,
      • 20 ECUs (8 virtual cores with 2.5 EC2 Compute Units each),
      • 64-bit platform,
      • High I/O Capacity

 

Note: Each Cache Node Type above lists the memory available to Memcached or Redis after taking System Software overhead into account. One ECU provides the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007 Xeon processor. Enhanced cache nodes are only available with Memcached.

 

 

 

Resources: