1.Redis 安装

reids下载

地址:http://download.redis.io/releases/
选择对应版本下载。
5.0以及以上版本对集群做了修改。
先看5.0以下的版本如何集群
以redis-3.2.8.tar.gz为例

wget http://download.redis.io/releases/redis-3.2.8.tar.gz

解压安装

tar -zxvf redis-3.2.8.tar.gz

cd redis-3.2.8

make && make install

执行完成后  提示

Hint: It's a good idea to run 'make test' ;)

make[1]: 离开目录“/root/redis-3.2.8/src”
cd src && make install
make[1]: 进入目录“/root/redis-3.2.8/src”

使用make test

You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] 错误 1
make[1]: 离开目录“/root/redis-3.2.8/src”
make: *** [test] 错误 2

搜索 tcl

[root@localhost redis-3.2.8]# yum search tcl
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cn99.com
================================================================================= N/S matched: tcl ==================================================================================
graphviz-tcl.i686 : Tcl extension & tools for graphviz
graphviz-tcl.x86_64 : Tcl extension & tools for graphviz
libdb-tcl.i686 : Development files for using the Berkeley DB with tcl

安装 tcl

yum install tcl-devel.x86_64  -y


再次执行 make test

最后提示

\o/ All tests passed without errors!

到此 redis安装完成

设置下redis的配置文件 让redis 后台运行

配置文件在redis的根路径下

daemonize    yes 

启动redis server
在redis根路径下

cd /src

./redis-server ../redis.conf

启动完成后 查看下redis是否启动

[root@localhost src]# ps -ef | grep redis
root     31050     1  0 13:59 ?        00:00:00 ./redis-server 127.0.0.1:6379
root     31058 13943  0 14:00 pts/0    00:00:00 grep --color=auto redis

使用redis-cli 测试下
在redis的跟路径下

cd src/
[root@localhost src]# ./redis-cli 
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> set test 11111
OK
127.0.0.1:6379> get test
"11111"
127.0.0.1:6379> keys *
1) "test"
127.0.0.1:6379> quit

使用cli 关闭redis-server

[root@localhost src]# ./redis-cli 
127.0.0.1:6379> shutdown 

你可能感兴趣的:(1.Redis 安装)