0

I'm currently running a web service on an aws web server (ec2). I'm using elasticache memcached to keep the login status.

However, the screen loads very slowly, so I considered storing the query execution results in elasticache's redis. The reason for choosing redis over memcached is that redis has a larger capacity than memcached, so we decided that redis was the appropriate place to store the query execution results.

Is it possible to use redis while keeping the existing login status in memcached? Or is it better to migrate the login state keeping itself to redis?

First, I was forced to install redis and memcahed to make them coexist. I'm trying added redis to a web server that already has memcached, I don't know why, but it is working... :( But if you know, I would like to know the official procedure.

In php.ini, there is memcached connection information

session.save_handler = memcached

For some reason, /etc/php.d/ contains memcached and redis.

50-memcached.ini
50-redis.ini

I was able to install redis and run both memcached and redis with this procedure.

  1. Install redis-cli on ec2
sudo yum install gcc
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
sudo make BUILD_TLS=yes
  1. install pecl, the php package manager
sudo yum install php-pear
  1. Install Redis client library phppredis
sudo yum install php-devel
sudo pecl install redis
  1. Add extension to php.ini
sudo systemctl restart httpd

Environment information php 8 (Codeigniter) i am using AWS WEB server: EC2 (3 units on each AZ) DB server: RDS (Aurora cluster mode) Elasticache (redis(7.1.0) and memcached(1.5.16))

0