|NO.Z.00003|——————————|Deployment|——|Hadoop&Flink计算领域锋利的武器.v03|——|Redis.v01|环境部署|

一、Redis单机版安装和使用
### --- 安装C 语言需要的GCC 环境

[root@hadoop ~]# yum install -y gcc-c++
[root@hadoop ~]# yum install -y wget
### --- 下载并解压缩Redis 源码压缩包

[root@hadoop software]# wget http://download.redis.io/releases/redis-5.0.5.tar.gz
[root@hadoop software]# tar -zxvf redis-5.0.5.tar.gz 
### --- 编译Redis 源码,进入redis-5.0.5 目录,执行编译命令

[root@hadoop software]# cd redis-5.0.5/src/
[root@hadoop src]#  make
### --- 安装Redis ,需要通过PREFIX 指定安装路径

[root@hadoop src]# mkdir -p /opt/yanqi/servers/redis
[root@hadoop src]# make install PREFIX=/opt/yanqi/servers/redis

[root@hadoop src]# ls ../../../servers/redis/bin/
redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server
三、Redis启动:前端启动
### --- 前端启动
~~~     启动命令: redis-server ,直接运行bin/redis-server 将以前端模式启动

### --- 关闭命令: ctrl+c
~~~     启动缺点:客户端窗口关闭则redis-server 程序结束,不推荐使用此方法
[root@hadoop ~]# cd /opt/yanqi/servers/redis/bin/
[root@hadoop bin]# ./redis-server
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 12001
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
二、Redis启动:后端启动(守护进程启动)
### --- 拷贝redis-5.0.5/redis.conf 配置文件到Redis 安装目录的bin 目录

[root@hadoop ~]# cp /opt/yanqi/software/redis-5.0.5/redis.conf /opt/yanqi/servers/redis/bin/
### --- 修改redis.conf

[root@hadoop ~]# vim /opt/yanqi/servers/redis/bin/redis.conf
# 将`daemonize`由`no`改为`yes`
daemonize yes
# 默认绑定的是回环地址,默认不能被其他机器访问
# bind 127.0.0.1
# 是否开启保护模式,由yes该为no
protected-mode no
### --- 启动服务

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

[root@hadoop bin]# ps -ef |grep 6379
root      12008      1  0 16:43 ?        00:00:00 ./redis-server 127.0.0.1:6379
### --- 后端启动的关闭方式

[root@hadoop bin]# ./redis-cli shutdown
### --- 命令说明

redis-server :                  #  启动redis 服务
redis-cli :                     #  进入redis 命令客户端
redis-benchmark :               #  性能测试的工具
redis-check-aof :               #  aof 文件进行检查的工具
redis-check-dump#  rdb 文件进行检查的工具
redis-sentinel :                #  启动哨兵监控服务
四、Redis命令行客户端
### --- 命令格式

[root@hadoop bin]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379>
### --- 参数说明

~~~     -h:redis服务器的ip地址
~~~     -p:redis实例的端口号
### --- 默认方式

~~~     如果不指定主机和端口也可以
~~~     默认主机地址是127.0.0.1
~~~     默认端口是6379
./redis0-cli

 
 
 
 
 
 
 
 
 

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

导航

统计

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