redis – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Fri, 06 Jan 2023 07:46:15 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Change Redis Max Memory https://tecadmin.net/limit-redis-max-memory/ https://tecadmin.net/limit-redis-max-memory/#respond Wed, 21 Dec 2022 01:38:10 +0000 https://tecadmin.net/?p=22957 To configure the maximum amount of memory that Redis will use, you can use the `maxmemory` directive in the Redis configuration file (`redis.conf`). This directive takes an integer value, representing the maximum number of bytes that Redis will use to store data in memory. For example, to set the maximum memory to `1GB`, (or 1024*1024*1024 [...]

The post How to Change Redis Max Memory appeared first on TecAdmin.

]]>
To configure the maximum amount of memory that Redis will use, you can use the `maxmemory` directive in the Redis configuration file (`redis.conf`). This directive takes an integer value, representing the maximum number of bytes that Redis will use to store data in memory.

For example, to set the maximum memory to `1GB`, (or 1024*1024*1024 bytes) you can use the following configuration:

maxmemory 1073741824

You can also specify a policy for how Redis should handle the situation when the maximum memory limit is reached. This is done using the `maxmemory-policy` directive, which can take one of the following values:

  • noeviction: Redis will return an error when the maximum memory limit is reached and a new key needs to be added.
  • allkeys-lru: Redis will remove the least recently used keys in order to make space for new keys.
  • volatile-lru: Redis will remove the least recently used keys among keys with an expire set in order to make space for new keys.
  • allkeys-random: Redis will randomly select keys to remove in order to make space for new keys.
  • volatile-random: Redis will randomly select keys with an expire set to remove in order to make space for new keys.
  • volatile-ttl: Redis will remove keys with the shortest time to live in order to make space for new keys.

For example, to set the `maxmemory-policy` to `allkeys-lru`, you can use the following configuration:

maxmemory-policy allkeys-lru

Note that the maxmemory and maxmemory-policy directives must be set in the Redis configuration file (redis.conf) and cannot be set using the CONFIG SET command at runtime. You will need to restart Redis for the changes to take effect.

It’s also worth noting that Redis will automatically try to free memory when it is running out of available memory, by releasing memory used by the least recently used keys. However, this process is limited by the maxmemory-samples directive, which determines the number of keys that Redis will sample in order to determine the keys to be removed. By default, this value is set to 3, so Redis will only sample 3 keys in order to determine the keys to be removed. You can adjust this value if needed by using the maxmemory-samples directive in the Redis configuration file.

The post How to Change Redis Max Memory appeared first on TecAdmin.

]]>
https://tecadmin.net/limit-redis-max-memory/feed/ 0
How to Install Redis on Debian 11 Linux https://tecadmin.net/how-to-install-redis-on-debian-11/ https://tecadmin.net/how-to-install-redis-on-debian-11/#comments Thu, 16 Sep 2021 08:24:02 +0000 https://tecadmin.net/?p=27766 Redis is an open-source in-memory database for storing data structure, caching, and as a message broker. It supports data structures such as strings, lists, sets, hashes, sorted sets with range queries, bitmaps, HyperLogLogs, and geospatial indexes with radius queries. Redis has a built-in replication feature, which makes it work as highly available clusters in your [...]

The post How to Install Redis on Debian 11 Linux appeared first on TecAdmin.

]]>
Redis is an open-source in-memory database for storing data structure, caching, and as a message broker. It supports data structures such as strings, lists, sets, hashes, sorted sets with range queries, bitmaps, HyperLogLogs, and geospatial indexes with radius queries. Redis has a built-in replication feature, which makes it work as highly available clusters in your production environments.

This tutorial will help you to install Redis server on Debian 11 (Bullseye) Linux system.

Step 1: Updating System Packages

It’s a good practice to keep packages up to date on your system. You should always update the before beginning any major installations. Issue the command below:

sudo apt update 
sudo apt upgrade 

Step 2: Installing Redis on Debian 11

Redis 6.0 packages are available under the default Bullseye repositories. You can quickly install Redis by using the apt package manager on your Debian Linux system.

sudo apt install redis-server 

Once the installation is finished successfully, check the Redis service status by the below-mentioned command.

sudo systemctl status redis.service 
Redis Server Setup on Debian
Redis Service Status

Step 3: Configuring Redis

You can use Redis with the default settings from the local system. But in case you need to customize the Redis server like allowing access from remote hosts, changing the default port, or increasing the memory allocation.

Edit the Redis configuration file in a text editor:

sudo nano /etc/redis/redis.conf 

Now, make the required changes to the Redis server. Below are some quick uses changes in the Redis server.

  • Change Redis Port: You can run your Redis server to a non-standard port. This is good practice for security purposes. Search for the below section and update the port under port 6379.

    # Accept connections on the specified port, default is 6379 (IANA #815344).
    # If port 0 is specified Redis will not listen on a TCP socket.
    port 6379

  • Allow Remote Connection: Search for bind 127.0.0.1 ::1 line and comment it by adding “#” at start of line.

    # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
    # JUST COMMENT OUT THE FOLLOWING LINE.
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # bind 127.0.0.1 ::1

  • Change Memory Allocation: Update the following values in the Redis configuration file according to your requirement. You can increase the max memory limit as per available memory on your server.

    maxmemory 256mb
    maxmemory-policy allkeys-lru

After doing the required changes, save the file. Then restart the Redis service to apply changes.

sudo systemctl restar redis.service 

Step 4: Connect to Redis

Type redis-cli on the command line to connect to the Redis server.

redis-cli 

You will get the Redis server prompt as below. Now type “ping” on the Redis command prompt. On successful connection with the Redis server, you will get PONG as a result.

 ping 
PONG

Conclusion

This tutorial helps you with the installation of the Redis server on the Debian 11 Bullseye Linux system.
You can find more details about the `redis-cli` command line tool from its official documentation.

The post How to Install Redis on Debian 11 Linux appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-redis-on-debian-11/feed/ 1
How To Install Redis on Debian 10 https://tecadmin.net/how-to-install-redis-on-debian-10/ https://tecadmin.net/how-to-install-redis-on-debian-10/#respond Tue, 07 Jul 2020 14:04:56 +0000 https://tecadmin.net/?p=21829 Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server.This tutorial will help you to install Redis server on Debian 10 Linux system. This will also help [...]

The post How To Install Redis on Debian 10 appeared first on TecAdmin.

]]>
Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server.This tutorial will help you to install Redis server on Debian 10 Linux system. This will also help you to install Redis PHP extensions on your system.

Prerequisites

You must have shell access with sudo privileged account access to Debian 10 system. First of all, Login to your system and upgrade the current packages.

sudo apt update && sudo apt upgrade

Step 1 – Install Redis on Debian 10

Redis packages are available under the default apt repository. You can directly install Redis on Debian 10 system without adding any PPA. Run the following command to install Redis on Debian:

sudo apt install redis-server

After installation, enable Redis service to start on system boot.

sudo systemctl enable redis-server

Step 2 – Configure Memory for Redis

Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

sudo vim /etc/redis/redis.conf

Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server.

maxmemory 256mb
maxmemory-policy allkeys-lru

The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

sudo systemctl restart redis-server

Step 3 – Install Redis PHP Extension

This is an optional step. If you need to connect Redis from PHP application, You need to install Redis PHP extension on your Debian system. To install Redis PHP extension, simply type:

sudo apt install php-redis

The installer will automatically enable redis extension for all the pre installed PHP versions. If you installer new PHP version after this, you can use below command to enable redis module. For example to enable extension for PHP 7.4, type:

sudo phpenmod -v 7.4 -s ALL redis

Step 4 – Connect to Redis Server

Use redis-cli tool to verify the connection between the Redis server.

redis-cli

127.0.0.1:6379> ping
PONG

Few more examples of redis-cli command line tool. You can find more details about redis-cli here.

redis-cli info
redis-cli info stats
redis-cli info server

How to Install Redis on Debian 10

Conclusion

This tutorial helps you with the installation of Redis server on Debian 10 system.

The post How To Install Redis on Debian 10 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-redis-on-debian-10/feed/ 0
How to Install Redis on Ubuntu 20.04 https://tecadmin.net/install-redis-ubuntu-20-04/ https://tecadmin.net/install-redis-ubuntu-20-04/#respond Sun, 10 May 2020 11:57:51 +0000 https://tecadmin.net/?p=21306 Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server. This tutorial will help you to install Redis server along with PHP extensions on an Ubuntu 20.04 [...]

The post How to Install Redis on Ubuntu 20.04 appeared first on TecAdmin.

]]>
Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server.

This tutorial will help you to install Redis server along with PHP extensions on an Ubuntu 20.04 LTS system.

Prerequisites

Before beginning the Redis server installation on Ubuntu 20.04:

  • Login to Ubuntu as sudo privileged user
  • For the newly installed systems, required to complete initial server setup
  • Step 1 – Install Redis Server

    Redis packages are available under the default apt repository. For the installation of Redis on an Ubuntu VPS. Run below command from the terminal to install Redis on your machine:

    sudo apt update
    sudo apt install redis-server
    

    Next is to enable Redis to start on system boot. Also restart Redis service once.

    sudo systemctl enable redis-server
    

    Step 2 – Configure Redis

    Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

    sudo vim /etc/redis/redis.conf
    

    Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server.

    maxmemory 256mb
    maxmemory-policy allkeys-lru
    

    The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

    sudo systemctl restart redis-server
    

    Step 3 – Install PHP Extension (Optional)

    Next, if you need to use Redis with PHP application, you need to install Redis PHP extension on your Ubuntu system. To install Redis PHP extension, type:

    sudo apt install php-redis
    

    The installer will automatically enable redis extension for all the pre installed PHP versions. If you installer new PHP version after this, you can use below command to enable redis module. For example to enable extension for PHP 7.4, type:

    sudo phpenmod -v 7.4 -s ALL redis
    

    Step 4 – Connect to Redis Server

    Use redis-cli tool to verify the connection between the Redis server.

    redis-cli
    
    127.0.0.1:6379> ping
    PONG
    
    

    Few more examples of redis-cli command line tool. You can find more details about redis-cli here.

    redis-cli info
    redis-cli info stats
    redis-cli info server
    

    Installing redis ubuntu 20.04

    Conclusion

    This tutorial helps you with the installation of Redis server on Ubuntu 20.04 LTS (Focal Fossa) system.

    The post How to Install Redis on Ubuntu 20.04 appeared first on TecAdmin.

    ]]> https://tecadmin.net/install-redis-ubuntu-20-04/feed/ 0 How to Install Redis on CentOS 8 https://tecadmin.net/install-redis-on-centos-8/ https://tecadmin.net/install-redis-on-centos-8/#respond Sun, 08 Mar 2020 03:04:09 +0000 https://tecadmin.net/?p=20511 Redis is an in-memory data structure store. It is used as database store, cache server. You can also use redis as message broker to configure Publish/Subscribe (PUB/SUB) messaging system. Redis is capable to store Strings, Hashes, Lists, Sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indexes etc. It also provides a PHP module for communication [...]

    The post How to Install Redis on CentOS 8 appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store. It is used as database store, cache server. You can also use redis as message broker to configure Publish/Subscribe (PUB/SUB) messaging system. Redis is capable to store Strings, Hashes, Lists, Sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indexes etc. It also provides a PHP module for communication between PHP script with the Redis server. Redis is written in C programming language.

    This tutorial will help to install the Redis cache server along with PHP Redis extensions on a CentOS 8 Linux machine.

    Prerequisites

    • CentOS 8 Linux system with shell access
    • Newly installed system follow the initial server setup steps.

    Step 1 – Install Redis on CentOS 8

    The latest Redis versions are available under the AppStream repositories of CentOS 8. Now, You can use the DNF package manager to install the Redis server on your system. To install Redis, simply execute the following command on your system:

    sudo dnf install redis
    

    After successfully installation start Redis service and enable auto-start on system reboot.

    sudo systemctl enable redis.service
    sudo systemctl start redis.service
    

    Redis server is up and running on your system.

    ● redis.service - Redis persistent key-value database
       Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/redis.service.d
               └─limit.conf
       Active: active (running) since Wed 2020-03-04 10:23:56 UTC; 1min 28s ago
     Main PID: 19911 (redis-server)
        Tasks: 4 (limit: 17963)
       Memory: 6.6M
       CGroup: /system.slice/redis.service
               └─19911 /usr/bin/redis-server 127.0.0.1:6379
    
    Mar 08 10:23:56 tecadmin systemd[1]: Starting Redis persistent key-value database...
    Mar 08 10:23:56 tecadmin systemd[1]: Started Redis persistent key-value database.
    

    Step 2 – Install Redis PHP extension

    We assume you already have PHP installed on your system. You must have PHP pear package installed on your system.

    sudo dnf install php-pear php-devel
    

    Now, execute commands to enable the Redis PHP extension on your CentOS server.

    pecl install igbinary igbinary-devel redis
    

    After that execute a command to verify Redis PHP extension is enabled:

    php -m | grep redis
    

    Redis server has been installed on your system along with the PHP extension.

    Step 3 – Configure Redis as a Cache Server

    Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

    vim /etc/redis/redis.conf
    

    Update the following values in the Redis configuration file according to your requirement. You can increase the max memory limit as per available on your server.

    maxmemory 256mb
    maxmemory-policy allkeys-lru
    

    The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

    Step 4 – Test Connection to Redis Server

    Use redis-cli tool to verify the connection between the Redis server and redis-cli.

    redis-cli
    
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>
    

    Conclusion

    You have successfully installed the Redis cache server on your CentOS 8 system. If you found the older version installed follow this tutorial.

    The post How to Install Redis on CentOS 8 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-redis-on-centos-8/feed/ 0
    Clearing the Redis Cache: A Step-by-Step Guide https://tecadmin.net/clear-redis-cache/ https://tecadmin.net/clear-redis-cache/#respond Sun, 18 Nov 2018 10:05:41 +0000 https://tecadmin.net/?p=17672 Redis is an in-memory data structure store that can be used as a database, cache, and message broker. It supports a wide range of data structures, such as strings, hashes, lists, sets, and sorted sets, and it provides high performance and scalability. To clear the Redis cache, you can use the `FLUSHALL` command. This command [...]

    The post Clearing the Redis Cache: A Step-by-Step Guide appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store that can be used as a database, cache, and message broker. It supports a wide range of data structures, such as strings, hashes, lists, sets, and sorted sets, and it provides high performance and scalability.

    To clear the Redis cache, you can use the `FLUSHALL` command. This command removes all keys from all databases in the Redis instance.

    Here’s a step-by-step guide on how to clear the Redis cache:

    1. Connect to Redis Server
    2. Connect to the Redis instance using the `redis-cli` command-line utility. You can specify the hostname and port of the Redis instance as arguments, or you can use the -h and -p options. For example:

      redis-cli -h 127.0.0.1 -p 6379 
      

      You can authenticate the connection using `-a ` when connecting to the server.

    3. Redis: Flush All Databases Cache
    4. Once connected, Use the `FLUSHALL` command to clear the entire cache. This command removes all keys from all databases in the Redis instance. It is an administrative command, and it is not recommended for use in production environments.

      FLUSHALL 
      

      The `FLUSHALL` command will return `OK` if the cache was successfully cleared. You can then exit the redis-cli utility by typing exit and pressing Enter.

      exit 
      

      That’s it! The Redis cache is now empty, and all keys have been removed from all databases in the Redis instance.

    5. Redis: Flush Single Database Cache
    6. Use the `FLUSHDB` command to clear a specific database. This command removes all keys from the currently selected database. You can specify the database number as an argument, or you can use the `SELECT` command to switch to the desired database before running FLUSHDB.

      FLUSHDB
      

      Select the database first and then flush it.

      SELECT 2 
      FLUSHDB
      

    7. Redis: Delete Specific Key Values
    8. Use the `DEL` command to delete specific keys. This command takes one or more keys as arguments, and it removes the specified keys from the current database.

      DEL key1 key2 key3
      

      Use the `KEYS` command to list all keys in the current database. This command takes a pattern as an argument, and it returns a list of keys that match the pattern. You can use this command to find and delete specific keys.

      KEYS *
      DEL $(KEYS pattern*)
      

    9. Redis: Set Expireation Time for Specific Key
    10. Use the `EXPIRE` command to set an expiration time on keys. This command takes a key and a number of seconds as arguments, and it causes the key to be deleted after the specified time has elapsed.

      EXPIRE key1 3600
      

    11. Redis: Remove Expireation Time for Specific Key
    12. Use the `PERSIST` command to remove the expiration time from a key. This command takes a key as an argument, and it removes the expiration time from the key if it has one.

      PERSIST key1
      

    Conclusion

    Note that the `FLUSHALL` command is an administrative command, and it is not recommended for use in production environments. If you want to clear only a specific database or a subset of keys, you can use the FLUSHDB or DEL commands instead. For more information, you can consult the Redis documentation or search online for tutorials and examples.

    I hope these tips and tricks are helpful! Let me know if you have any other questions.

    The post Clearing the Redis Cache: A Step-by-Step Guide appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/clear-redis-cache/feed/ 0
    How To Install Redis on Debian Linux https://tecadmin.net/install-redis-on-debian/ https://tecadmin.net/install-redis-on-debian/#comments Fri, 05 Oct 2018 16:22:55 +0000 https://tecadmin.net/?p=17091 Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides PHP module for communication between PHP script with the Redis server. This tutorial will help you with the installation of the Redis server on a Debian Linux system. The [...]

    The post How To Install Redis on Debian Linux appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides PHP module for communication between PHP script with the Redis server.

    This tutorial will help you with the installation of the Redis server on a Debian Linux system. The PHP application also required Redis PHP extensions to work.

    Step 1 – Prerequsities

    First of all, Log in to your system with sudo privilege account using shell access, to which you need to install Redis.

    ssh root@debian
    

    Update the apt-get packages index files and also update existing packages to the newest versions. Run the following commands from terminal:

    sudo apt-get update
    sudo apt-get upgrade
    

    Step 2 – Install Redis on Debian

    The Redis packages are available under the default apt repository. For the installation of Redis on an Ubuntu VPS. Run below command from the terminal to install Redis on your machine:

    sudo apt-get install redis-server
    

    Next is to enable Redis to start on system boot. Also, restart Redis service once.

    sudo systemctl enable redis-server.service
    

    Step 3 – Configure Redis

    Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

    sudo vim /etc/redis/redis.conf
    

    Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server.

    /etc/redis/redis.conf
    maxmemory 256mb
    maxmemory-policy allkeys-lru
    

    Use the above configuration with Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

    sudo systemctl restart redis-server.service
    

    Step 4 – Install Redis PHP Extension

    To access the Redis server from a PHP application required php-redis extension. You also need to install this extension on your application server. So that your PHP application can communicate with the Redis server. Install this extension by running the following command:

    sudo apt-get install php-redis
    

    Step 5 – Test Connection

    Use redis-cli tool to verify the connection between the Redis server and redis-cli. Access redis-cli terminal and type “ping”, You will get “PONG” in response with the successful connection.

    redis-cli
    
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>
    

    The post How To Install Redis on Debian Linux appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-redis-on-debian/feed/ 2
    How to Install Redis Cache Server on CentOS 7/6 https://tecadmin.net/install-redis-centos/ https://tecadmin.net/install-redis-centos/#comments Thu, 22 Mar 2018 15:52:01 +0000 https://tecadmin.net/?p=15527 Redis is an in-memory data structure store, used as a database server, cache, and message broker. It also provides a PHP module for communication between PHP script with the Redis server. Redis is written in C programming language. This tutorial will help you with the installation of the Redis server along with PHP Redis PHP [...]

    The post How to Install Redis Cache Server on CentOS 7/6 appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store, used as a database server, cache, and message broker. It also provides a PHP module for communication between PHP script with the Redis server. Redis is written in C programming language.

    This tutorial will help you with the installation of the Redis server along with PHP Redis PHP extensions on a CentOS 7/6 server.

    Step 1 – Prerequisites

    First of all, log in to your server using shell access with the root account.

    ssh root@remote
    

    Redis packages are not available under default yum repositories. You need to enable EPEL yum repository on your server first. Execute below command to enable:

    ### CentOS/RHEL 7 
    yum install epel-release
    
    ### CentOS/RHEL 6 
    rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    

    Step 2 – Install Redis Server

    Now, You can use the yum package manager to install the Redis server on a VPS. Execute command to install Redis on your systems:

    yum install redis
    

    After successfully installation start Redis service and enable auto-start on system reboot.

    ### CentOS/RHEL 7 
    systemctl enable redis
    systemctl start redis
    
    ### CentOS/RHEL 6 
    chkconfig redis on
    service redis restart
    

    Redis server is up and running on your system.

    Step 3 – Install Redis PHP extension

    We assume you already have PHP installed on your system. You must have PHP pear package installed on your system.

    yum install php-pear php-devel
    

    Now, execute commands to enable Redis PHP extension on your CentOS server.

    pecl install igbinary igbinary-devel redis
    

    After that execute a command to verify Redis PHP extension is enabled:

    php -m | grep redis
    

    Redis server has been installed on your system along with the PHP extension.

    Step 4 – Configure Redis as a Cache Server

    Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

    vim /etc/redis/redis.conf
    

    Update the following values in the Redis configuration file according to your requirement. You can increase the max memory limit as per available on your server.

    maxmemory 256mb
    maxmemory-policy allkeys-lru
    

    The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

    Step 5 – Test Connection to Redis Server

    Use redis-cli tool to verify the connection between the Redis server and redis-cli.

    redis-cli
    
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>
    

    The post How to Install Redis Cache Server on CentOS 7/6 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-redis-centos/feed/ 2
    How to Install Redis on cPanel https://tecadmin.net/install-redis-cpanel/ https://tecadmin.net/install-redis-cpanel/#comments Wed, 21 Mar 2018 15:45:01 +0000 https://tecadmin.net/?p=15521 Redis is an in-memory data structure store, used as database server, cache and message broker. It also provides PHP module for communication between PHP script with Redis server. This guide will help you for the installation of Redis server and binding with PHP using Redis PHP extensions on a cPanel server. Step 1 – Prerequisites [...]

    The post How to Install Redis on cPanel appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store, used as database server, cache and message broker. It also provides PHP module for communication between PHP script with Redis server.

    This guide will help you for the installation of Redis server and binding with PHP using Redis PHP extensions on a cPanel server.

    Step 1 – Prerequisites

    In order to use this tutorial, you must have root shell access of your WHM/cPanel server. Login to your server shell access using root account.

    ssh root@remote.cpanel
    

    Redis packages are not available under default yum repositories. You need to enable EPEL yum repository on your server first. Execute below command to enable:

    ### CentOS/RHEL 7 
    yum install epel-release
    
    ### CentOS/RHEL 6 
    rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    

    Step 2 – Install Redis Server

    Now, You can use yum package manage to install Redis server packages by executing below command

    yum install redis
    

    After successfully installation start Redis service and enable to auto-start on system reboot.

    ### CentOS/RHEL 7 
    systemctl enable redis
    systemctl start redis
    
    ### CentOS/RHEL 6 
    chkconfig redis on
    service redis restart
    

    Redis server is up and running on your system. Go to next step to enable Redis PHP extension on your cPanel server.

    Step 3 – Install Redis PHP extension

    In this step there are two option available based in the EasyApache version on your cPanel server. Follow one of below step:

    cPanel with EasyApache 4

    You can install Redis PHP extension for all installed PHP version on your system or install for the active version only. We recommend to install for all versions.

    PHP 5.6

    /opt/cpanel/ea-php56/root/usr/bin/pecl install igbinary igbinary-devel redis 
    /opt/cpanel/ea-php56/root/usr/bin/php -m | grep redis
    

    PHP 7.0

    /opt/cpanel/ea-php70/root/usr/bin/pecl install igbinary igbinary-devel redis 
    /opt/cpanel/ea-php70/root/usr/bin/php -m | grep redis
    

    PHP 7.1

    /opt/cpanel/ea-php71/root/usr/bin/pecl install igbinary igbinary-devel redis 
    /opt/cpanel/ea-php71/root/usr/bin/php -m | grep redis
    

    cPanel with EasyApache 3

    If the cPanel is still running with EasyApache 3, Execute below commands to install Redis PHP extension on your system. Also check Redis module is enabled for PHP.

    pecl install igbinary igbinary-devel redis
    php -m | grep redis
    

    All done. Redis has been installed on your system along with the PHP extension.

    The post How to Install Redis on cPanel appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-redis-cpanel/feed/ 6
    How to Install Redis on Ubuntu 18.04 & 16.04 LTS https://tecadmin.net/install-redis-ubuntu/ https://tecadmin.net/install-redis-ubuntu/#comments Sun, 18 Mar 2018 15:46:05 +0000 https://tecadmin.net/?p=15529 Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server. This tutorial will help you with the installation of Redis server along with PHP Redis PHP extensions [...]

    The post How to Install Redis on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

    ]]>
    Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides a PHP module for communication between PHP script with the Redis server.

    This tutorial will help you with the installation of Redis server along with PHP Redis PHP extensions on an Ubuntu 19.04, 18.04 LTS, 16.04 LTS and 14.04.

    Step 1 – Prerequsities

    Log in to your system with sudo privilege account using shell access, to which you need to install Redis.

    ssh ubuntu@remote
    

    Update the apt-get packages index files and also update existing packages to the newest versions by using the following commands:

    sudo apt-get update
    sudo apt-get upgrade
    

    Step 2 – Installing Redis

    The Redis packages are available under the default apt repository. For the installation of Redis on an Ubuntu VPS. Run below command from the terminal to install Redis on your machine:

    sudo apt-get install redis-server
    

    Next is to enable Redis to start on system boot. Also restart Redis service once.

    sudo systemctl enable redis-server.service
    

    Step 3 – Configure Redis

    Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes

    sudo vim /etc/redis/redis.conf
    

    Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server.

    maxmemory 256mb
    maxmemory-policy allkeys-lru
    

    The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

    sudo systemctl restart redis-server.service
    

    Step 4 – Install Redis PHP Extension

    Now, if you need to use Redis from PHP application, you also need to install Redis PHP extension on your Ubuntu system. Run below command to install:

    sudo apt-get install php-redis
    

    Step 5 – Test Connection to Redis Server

    Use redis-cli tool to verify the connection between the Redis server.

    redis-cli
    
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>
    

    Few more examples of redis-cli command line tool. You can find more details about redis-cli here.

    redis-cli info
    redis-cli info stats
    redis-cli info server
    

    Install Redis on Ubuntu

    The post How to Install Redis on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-redis-ubuntu/feed/ 11