|NO.Z.00102|——————————|^^ 部署 ^^|——|Linux&NoSQL.V02|——|Redis部署|

一、Redis 安装部署
### --- Redis 的官方网站是:http://redis.io
### --- 下载安装包:

[root@server21 ~]# wget http://download.redis.io/releases/redis-2.8.6.tar.gz
### --- 编译安装:

[root@server21 ~]# yum install -y gcc*
[root@server21 ~]# tar -zxvf redis-2.8.6.tar.gz 
[root@server21 ~]# cd redis-2.8.6
[root@server21 ~]# make
make[1]: Leaving directory `/root/redis-2.8.6/src'
[root@server21 redis-2.8.6]# make PREFIX=/usr/local/redis install
cd src && make install
make[1]: Entering directory `/root/redis-2.8.6/src'

Hint: To run 'make test' is a good idea ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
 make[1]: Leaving directory # `/root/redis-2.8.6/src'
### --- 指定安装位置,如果没有指定安装位置 PREFIX=/usr/local/redis,
~~~     则 make install 会把 redis 安装到/usr/local/bin/目录下

[root@server21 redis-2.8.6]# mkdir /usr/local/redis/etc
[root@server21 redis-2.8.6]# cp ./redis.conf   /usr/local/redis/etc/
### --- 复制 Redis 的配置文件到/usr/local/redis/etc/下,便于管理。
~~~     修改配置文件:
~~~     修改为 yes;默认是no,不允许后台运行

[root@server21 ~]# vim /usr/local/redis/etc/redis.conf 
daemonize yes                                                   
### --- 启动服务:后台启动
~~~     /usr/local/redis/bin/redis-server 配置文件
~~~     必须制定配置文件位置,否则会提示警告

[root@server21 ~]# ln -s /usr/local/redis/bin/* /usr/local/bin/
[root@server21 ~]# redis-server /usr/local/redis/etc/redis.conf // 启动Redis
[root@server21 ~]# netstat -antp
tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      3582/redis-server * 
### --- 客户端连接:
~~~     /usr/local/redis/bin/redis-cli 
~~~     -h  IP:         连接指定的 redis 服务器
~~~     -p  6379:       指定 redis 服务器的端口
~~~     -a  密码:       使用密码登录   
~~~     -n  数据库号:   指定连接哪个数据库   
~~~     --raw:          redis 支持存储中文

[root@server21 ~]# redis-cli 
127.0.0.1:6379> 
### --- 停止 Redis:
~~~     /usr/local/redis/bin/redis-cli shutdown
[root@server21 ~]# redis-cli shutdown
[root@server21 ~]# netstat -antp 

### --- OR
[root@server21 ~]# pkill -9 redis

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(4)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示