Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redis-server - Command Not Found

Tags:

node.js

redis

Totally new to nodejs and redis. Node.js is working fine and NPM works fine too.

I want to play around with Redis so I ran:

npm install redis

and this seemed to work ok but now I'm trying to run:

redis-server

and I'm getting a Command Not Found error. I'm on a Mac if that's relevant.

Can anyone offer some advice?

like image 967
tommyd456 Avatar asked Mar 12 '14 20:03

tommyd456


People also ask

How do I find my Redis server?

you can do it by this way. $redis = new Redis(); $redis->connect('127.0. 0.1', 6379); echo $redis->ping(); and then check if it print +PONG , which show redis-server is running.

How do I get Redis command?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command.


2 Answers

npm install redis doesn't install redis, it installs a redis client for node. You need to install the redis server.

like image 125
hobbs Avatar answered Oct 17 '22 08:10

hobbs


I downloaded http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz
cd redis-stable
make

I added this line to my .bash_profile:

export PATH=$PATH:$HOME/Downloads/redis-stable/src

restarted the terminal. Now can run redis-server

like image 19
robert king Avatar answered Oct 17 '22 08:10

robert king