Learn about Centmin Mod LEMP Stack today
Become a Member

Redis How to run / install Redis php?

Discussion in 'Other Centmin Mod Installed software' started by chorong91, Jul 20, 2016.

Tags:
  1. chorong91

    chorong91 New Member

    16
    2
    3
    Dec 1, 2015
    Ratings:
    +2
    Local Time:
    2:21 AM
    I maybe had problem or maybe I don't know how to run redis
    Is it centmin by default install redis, right?
    so I don't need install redis by yum?

    I can run :
    php --ri redis
    and output like this:
    redis

    Redis Support => enabled
    Redis Version => 2.2.7

    But I cant run
    redis
    or
    service redis
    #withoutput : redis: unrecognized service
    • Server or VPS details ? XEN, KVM, OpenVZ, VMWare or dedicated server ? OS ? CentOS 6.7 or 7.2 ? 32bit or 64bit ?
    • Im Using VPS at DigitalOcean spec : 512 MB Memory / 20 GB Disk / SGP1 - CentOS 6.8 x32
    • What version of Centmin Mod ? .07 stable or 08 stable or .09 beta01 or another branch version ?
    • 123.08stable
    • Was it fresh install or upgrade ?
    • fresh install
    • Method of install ? Via centmin.sh menu option 1, Git install or curl one liner install as outlined atcentminmod.com/download.html ?
    • ./centmin.sh install
    • How long ago did you install Centmin Mod ?
    • I had installed 1 on Vultr about 6 month ago?
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:21 AM
    Nginx 1.13.x
    MariaDB 5.5
  3. chorong91

    chorong91 New Member

    16
    2
    3
    Dec 1, 2015
    Ratings:
    +2
    Local Time:
    2:21 AM
    I think I successfully installing redis now..

    const util = require('util');
    const app = require('express')();
    const http = require('http').Server(app);
    const io = require('socket.io')(http);
    const redis = require("redis");

    const host = process.env.HOST || '0.0.0.0';
    const port = process.env.PORT || 9090;

    http.listen(port, host);
    util.log('Listening at http://' + host + ':' + port);

    io.on('connection', function (socket) {

    // util.log("connect");

    var redisClient = redis.createClient();

    redisClient.subscribe('notification');

    redisClient.on('message', function (channel, message) {
    util.log("New message in queue " + message + "channel");

    message = JSON.parse(message);
    // util.log(message.data.data.id);
    socket.emit(channel, message.data);
    });


    socket.on('disconnect', function () {
    redisClient.quit();
    });

    });

    but when I run node for upper code
    Error: Cannot find module 'redis'
    Did i must targeted it to redis location? where is the location instalation of redis?
     
  4. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    unfortunately don't know node.js programming so no idea
     
  5. chorong91

    chorong91 New Member

    16
    2
    3
    Dec 1, 2015
    Ratings:
    +2
    Local Time:
    2:21 AM
    Oh thanks..
    But may I know where the file location if I install redis via yum/npm?
    I think it must be targeted to redis or something like that.
     
  6. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    if you follow the guide at Redis - How to install Redis server on Centmin Mod LEMP stack | Centmin Mod Community to install redis via Remi YUM repo you can see list of files the redis rpm package installed via command
    Code (Text):
    rpm -ql redis
    

    Code (Text):
    rpm -ql redis
    /etc/logrotate.d/redis
    /etc/rc.d/init.d/redis
    /etc/rc.d/init.d/redis-sentinel
    /etc/redis-sentinel.conf
    /etc/redis.conf
    /etc/security/limits.d/95-redis.conf
    /usr/bin/redis-benchmark
    /usr/bin/redis-check-aof
    /usr/bin/redis-check-rdb
    /usr/bin/redis-cli
    /usr/bin/redis-sentinel
    /usr/bin/redis-server
    /usr/bin/redis-shutdown
    /usr/share/doc/redis-3.2.1
    /usr/share/doc/redis-3.2.1/00-RELEASENOTES
    /usr/share/doc/redis-3.2.1/BUGS
    /usr/share/doc/redis-3.2.1/CONTRIBUTING
    /usr/share/doc/redis-3.2.1/COPYING
    /usr/share/doc/redis-3.2.1/MANIFESTO
    /usr/share/doc/redis-3.2.1/README.md
    /var/lib/redis
    /var/log/redis
    /var/run/redis
     
  7. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:21 AM
    Nginx 1.13.x
    MariaDB 5.5