Linux中 redis的安装

Redis 没有官方的Windows版本,但是微软开源技术团队(Microsoft Open Tech group)开发和维护着这个 Win64 的版本,可在https://github.com/MicrosoftArchive/redis/releases下载或redis解压即用

Redis是c语言开发的。

安装redis需要c语言的编译环境。如果没有gcc需要在线安装。yum install gcc-c++

 

安装步骤:

第一步:redis的源码包上传到linux系统。

第二步:解压缩redis。

第三步:编译。进入redis源码目录。make

第四步:安装。make install PREFIX=/usr/local/redis

PREFIX参数指定redis的安装目录。一般软件安装到/usr目录下

连接redis

redis的启动:

前端启动:在redis的安装目录下直接启动redis-server

[root@localhost bin]# ./redis-server

后台启动:

把/root/redis-3.0.0/redis.conf复制到/usr/local/redis/bin目录下

[root@localhost redis-3.0.0]# cp redis.conf /usr/local/redis/bin/

修改配置文件:

[root@localhost bin]# ./redis-server redis.conf

查看redis进程:

[root@localhost bin]# ps aux|grep redis 或者 ps -ef|grep redis

root      5190  0.1  0.3  33936  1712 ?        Ssl  18:23   0:00 ./redis-server *:6379   

root      5196  0.0  0.1   4356   728 pts/0    S+   18:24   0:00 grep redis

[root@localhost bin]#

Redis-cli

使用客户端进行连接服务

[root@localhost bin]# ./redis-cli

默认连接localhost运行在6379端口的redis服务。

[root@localhost bin]# ./redis-cli -h 10.211.55.7 -p 6379

-h:连接的服务器的地址

-p:服务的端口号

 

关闭redis:


第一种  直接杀掉进程 kill 端口号或 kill -9 端口号

第二种  [root@localhost bin]# ./redis-cli shutdown

 

 

猜你喜欢

转载自blog.csdn.net/xiayubing_/article/details/81018995
今日推荐