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?
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.
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.
npm install redis
doesn't install redis, it installs a redis client for node. You need to install the redis server.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With