Skip to content

Redis installation on Centos 7

visruth edited this page Jan 2, 2018 · 4 revisions

Introduction

Redis is written in ANSI C and runs on POSIX systems such as Linux, Mac OS X and Solaris. It can be accessed by applications through its client API library. Redis, which has a relatively rich set of data types when compared to many key-value data stores, holds its database entirely in memory, using the disk only for persistence.

Using Redis with Faveo will maximize the performance with its queue feature. You can keep track of sent mails, unsent mails and delayed mails. Redis has also another feature of caching.

Installation steps

Step1

Open command terminal and type following command

                              $ yum install redis -y

Step2

Once the packages and dependencies are installed correctly, type this command

                      $ systemctl start redis.service

To check the status of Redis type the command

                      $ systemctl status redis.service
                      $ redis-cli ping

Step3

Change the directory to /opt/faveo/faveo-helpdesk and run the PHP artisan commands

                                $ cd /opt/faveo/faveo-helpdesk

                                  $ php artisan config:clear

                                  $ php artisan cache:clear

                                  $ php artisan route:clear

                                  $ php artisan view:clear

Step4

Activate the redis from the admin panel by selecting the queue settings and activating redis from the option

Step5

Implementing supervisor

Supervisor is a process monitor for the Linux operating system, and will automatically restart your queue:listen or queue:work commands if they fail.

After activating redis we have to install supervisor

         $ yum install python-setuptools
         $ easy_install supervisor  
                 or
         $ yum install supervisor

       $ echo_supervisord_conf > /etc/supervisord.conf

You will now have access to the following commands to control Supervisor:

           $ service supervisord start

           $ service supervisord stop

           $ service supervisord status

           $ service supervisord restart

Step6

Once supervisor is installed and restarted then configure it from /etc/supervisord.conf' by adding the below entries

           $ vim /etc/supervisord.conf

            [program:faveo-worker]

            process_name=%(program_name)s_%(process_num)02d

            command=php /opt/faveo/faveo-helpdesk/artisan queue:work redis --sleep=3 --tries=3

            autostart=true

            autorestart=true

            numprocs=8

            redirect_stderr=true

            stdout_logfile=/opt/faveo/faveo-helpdesk/storage/logs/worker.log

A header value of [program:faveo-worker]describes a program with the name of “faveo-worker”. The name is used within client applications that control the processes that are created as a result of this configuration. It is an error to create a program section that does not have a name. The name must not include a colon character or a bracket character. The value of the name is used as the value for the %(program_name)s string expression expansion within other values where specified.

Section Values

process_name : A Python string expression that is used to compose the supervisor process name for this process.

command : The command that will be run when this program is started.

autostart : If true, this program will start automatically when supervisord is started.

autorestart : Specifies if supervisord should automatically restart a process if it exits when it is in the RUNNING state.

numprocs : Supervisor will start as many instances of this program as named by numprocs. Note that if numprocs > 1, the process_name expression must include %(process_num)s

stdout_logfile : Put process stdout output in this file Let’s discuss the switches used in the artisan’s command written in this program.

               php /path/to/artisan queue:work --tries=3 --daemon

Tries : This flag defines the maximum number of times a job should be attempted Daemon : Running queue:work with --daemon option forces the queue worker to continue processing jobs without ever rebooting the framework. This results in a significant reduction of CPU usage when compared to the queue:listen command. As daemon queue workers do not restart the framework before processing each job, you should be careful to free any heavy resources before the job finishes.

Once the configuration file has been created, we have to update the Supervisor configuration and start the processes using the following commands:

Step7 After configuring the /etc/supervisord.conf file run the following commands

          $ supervisorctl reread

          $ supervisorctl update

          $ supervisorctl start faveo-worker:*

Installation and Upgrade Guide

Administrator's Guide

Agent's Guide

Email Integration

Release & Upgrade Notes

Known Issues

Contribute & Feedback

Knowledge Base

Third Party Integration

Plugins

API

Clone this wiki locally