17 October, 2016

Multiple instances of redis


In the last post I have covered how to install redis server on Centos/Rhel using rpm method and yum method and some troubleshooting skills.

In this post i am going to cover how to install and configure redis to run with multiple ports.

         
                                                               
But why we need more ports ?


If you have read my earlier post , you already know that by default redis runs on single port 6379, which any one can use it for small website to cache the data. But for heavy website like magento we need to use additional ports along with 6379 to serve different cache from different ports.

Like in Magento there is simple cache which is normally stored under /var/cache directory. Then there is Full Page Cache which is stored under /var/full_page_cache and session cache which is stored under /var/session_cache.

Note : Discussion about cache/full page cache/session is not under the scope for this document.


                                                         
Where it is Beneficial then ?


Many of the website are using redis to fasten their response time to the end user using the advantages of redis. So if you want your website should serve as fast as possible then you should think of using redis in your environment.

But for beginners the question is ? how redis does that ? so the simplest answer i can give is 
when you visit any website for first time, your browser sends a request to the server asking for data
the server in return get the data from the application/database hosted on server and serve to browser and then to you.

This is the normal situation, where there is only browser-server in back-end application (may be php) and database (may be mysql)








but when redis is in use, browser sends the request to the server, it then checks whether the request which browser has made is available in redis database or not (means cache here), if the data present then it get served to the browser from redis itself, so here asking data from application/database gets eliminated.

so the total computation power needed for any application/database to generate requested data for the browser get saved. and then get served by REDIS. This situation is very much needed in environment   serving lots of users like some big social media sites and eCommerce sites.


                                               
Create Multiple Instances of Redis 

                                
So, let move towards creating additional instances of redis, I am assuming you already have installed redis on your linux server, if in any case if you are not, then you refer the LINK for the installation of redis on Centos/Rhel server.


    Step 1 :  Check first redis is listening on its default port i.e 6379 by running below command.


    which means your redis single instance is UP and running on the server. Now after every package installation normally two types of files gets created for redis.
    • First is init file
    • Second is Configuration file
    Init file location on the Centos/Rhel server is /etc/init.d/
    Configuration file location on Centos/Rhel server is /etc/redis.conf




    Step 2 
    : Now, install it using below command.



    Which means your redis package is installed now on your linux machine using rpm method.


    By YUM Method :-


    Step 1 :  For yum method, we first need to install repository containing the redis package by running below command



    it will create "epel.repo" file under /etc/yum.repos.d/



    That its redis is installed on your server now using yum method. Only difference between rpm method and yum method is yum finds the dependecny of package required for redis to get it install.

    means if redis also need to redis-server package to run properly then yum will install both at the same time.But rpm will not do it, instead it will install only redis package on the server.
                                               
    Status Check

    Next thing is to check how to verify redis is working properly or not, so to check that we have to run below commands



    commands explains it all, but thats command will run only on Centos/RHEL server upto OS version 6. For RHEL/Centos 7 there will be different commands to run.


    You can watch below video for to know about redis installation on linux machine and some troubleshooting skills while installing it.

    Go and watch and do not forgot to share the post if you like it.





    40 comments:


    1. Someone essentially help to make seriously articles I would state. That is the first time I frequented your web page and up to now? I amazed with the analysis you made to make this actual put up incredible. Wonderful task! www.401k.com fidelity login

      ReplyDelete
      Replies
      1. Thanks @Patricia , but that someone is "ME" only :) Glad you liked the page !

        Delete
    2. I'm gone to say to my little brother, that he should also pay a
      visit this web site on regular basis to get updated from latest
      information.

      ReplyDelete
    3. Having read this I thought it was very enlightening. I appreciate you taking the time and
      effort to put this short article together. I once again find myself spending way
      too much time both reading and posting comments. But so what, it was still
      worth it!

      ReplyDelete
    4. Hello! Quick question that's completely off topic.
      Do you know how to make your site mobile friendly? My weblog looks weird when browsing
      from my iphone4. I'm trying to find a theme or plugin that might be able to resolve this issue.
      If you have any recommendations, please share. Thanks!

      ReplyDelete
      Replies
      1. hmm... thats strange! recently got cleared all issue related to mobile template for my site and google verified it also here (https://search.google.com/test/mobile-friendly?utm_source=gws&utm_medium=onebox&utm_campaign=suit&id=73q0NJgx9u60Ig3DFS-_aQ)

        Try to clean your cache for the site and reload the website again, check if thats help.

        Thanks & Regards

        Delete
    5. Remarkable! Its genuinely amazing article, I have got much clear idea on the topic of from this piece
      of writing.

      ReplyDelete
      Replies
      1. Thank you :) I am glad that my blog helped you to understand redis

        Delete
    6. You are so interesting! I don't believe I have read something like that before.

      So great to discover another person with some unique thoughts
      on this issue. Really.. thank you for starting this up.
      This website is one thing that is needed on the internet, someone with a little originality!

      ReplyDelete
    7. Wow, this post is fastidious, my sister is analyzing these things, so I am going to tell her.

      ReplyDelete
    8. I've learn a few just right stuff here. Certainly value bookmarking for revisiting.
      I wonder how so much effort you put to make one of these fantastic informative website.

      ReplyDelete
    9. Greetings! Very useful advice in this particular post!
      It's the little changes that make the largest changes.
      Thanks a lot for sharing!

      ReplyDelete
    10. Et j'ai eu envie d'arrêter médecine, vraiment.

      ReplyDelete
    11. L'Imam Ali (as) a dit : «Ô toi, qui injurie la vie !

      ReplyDelete
    12. Greate article. Keep writing such kind of info on your site.
      Im really impressed by your blog.
      Hi there, You have performed an excellent job. I will certainly digg it and in my view suggest to
      my friends. I'm sure they will be benefited from this web site.

      ReplyDelete
    13. Everyone loves what you guys are up too. This sort of
      clever work and coverage! Keep up the excellent works guys I've included you guys to our blogroll.

      ReplyDelete
    14. I'm really impressed with your writing skills and also with the layout on your blog.

      Is this a paid theme or did you customize it yourself?
      Either way keep up the excellent quality writing, it is rare to see a
      great blog like this one nowadays.

      ReplyDelete
    15. I've been exploring for a little bit for any high-quality articles or blog
      posts on this sort of house . Exploring in Yahoo I eventually stumbled upon this site.
      Reading this info So i'm satisfied to exhibit that
      I have a very excellent uncanny feeling I discovered just what I needed.
      I so much certainly will make sure to do not omit this web site and provides it a
      look regularly.

      ReplyDelete
    16. You can definitely see your skills within the article you
      write. The arena hopes for more passionate writers such as you who are not afraid to mention how they believe.
      All the time go after your heart.

      ReplyDelete
    17. I blog often and I seriously thank you for your information. This great
      article has really peaked my interest. I am going to take a note of your website and keep checking
      for new information about once per week. I subscribed to
      your Feed too.

      ReplyDelete
    18. Appreciation to my father who told me regarding this
      webpage, this blog is actually amazing.

      ReplyDelete
      Replies
      1. Thank you :) You can refer this blog which i was recently reading, it will give some more insight how redis helped someone.

        https://blogs.perficientdigital.com/2018/09/18/using-caching-technology-to-boost-e-commerce-business/

        Delete
    19. Hi, of course this article is in fact pleasant and I have learned lot of
      things from it about blogging. thanks.

      ReplyDelete
      Replies
      1. Thats Sound great ! Glad website helped you to learn something new :)

        Delete