【云原生进阶之PaaS中间件】第一章Redis-1.5.1安装配置

1 Redis环境安装配置

在本节中,您将了解和学习Redis的环境安装设置。

1.1 在Ubuntu上安装Redis

要在Ubuntu上安装Redis,打开终端并键入以下命令 -

bash 复制代码
[yiibai@ubuntu:~]$ sudo apt-get update 
[yiibai@ubuntu:~]$ sudo apt-get install redis-server

这将在Ubuntu机器上安装Redis。

1.2 Mac OS上安装Redis

1.2.1 安装步骤

1、首先使用 sudo brew install redis 命令一键安装Redis, 默认会安装在 /usr/local/bin 路径中。

bash 复制代码
sudo brew install redis

2、cd 进入 /usr/local/bin,通过ls可以看到里面会有跟Redis相关的文件,执行 sudo ./redis-server 先开启redis服务, 可以看到 如下界面,表示已经开启 Redis 服务。

3、执行 sudo ./redis-cli 开启客户端即可

上述方法启动redis时是以非密码形式登录的,许多操作可能会出现 (error) NOAUTH Authentication required.

解决此问题的方法之一就是找到 /etc/redis.conf,并将#requirepass 前的 "#" 去掉。由于每个人电脑不同,有可能没法在 /etc 路径下找到redis.conf, 因此可以选择采用第二种方法:

(1)按照原来方式 ./redis-cli 进入redis 客户端, 输入config set requirepass XXX,其中XXX是你要设置的密码。此时会出现 "OK";

(2)之后返回bin目录下,输入 redis-cli -h 127.0.0.1 -p 6379 -a XXX, 就相当于以密码形式登录了。此后也不会再有身份验证失败问题。

(3)可以使用config get requirepass 查看密码

1.2.2 启动Redis

bash 复制代码
[yiibai@ubuntu:~]$ redis-server
[2988] 07 Feb 17:09:42.485 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[2988] 07 Feb 17:09:42.488 # Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.
[2988] 07 Feb 17:09:42.490 # Warning: 32 bit instance detected but no memory lim
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.8.4 (00000000/0) 32 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 2988
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[2988] 07 Feb 17:09:42.581 # Server started, Redis version 2.8.4
[2988] 07 Feb 17:09:42.582 # WARNING overcommit_memory is set to 0! Background s                                                                                        ' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_m
[2988] 07 Feb 17:09:42.582 * The server is now ready to accept connections on po

1.2.3 检查Redis是否正在工作

bash 复制代码
[yiibai@ubuntu:~]$ redis-cli

这将打开一个redis提示,如下所示 -

bash 复制代码
redis 127.0.0.1:6379>

在上面的提示中,127.0.0.1是计算机的IP地址,6379是运行Redis服务器的端口。 现在键入以下PING命令。

bash 复制代码
redis 127.0.0.1:6379> ping PONG

这表明Redis已成功在您的计算机上安装了。

1.3 在Ubuntu上安装Redis桌面管理

要在Ubuntu上安装Redis桌面管理器,可从 http://redisdesktop.com/download 下载该软件包,安装即可。

打开下载的软件包并安装。

Redis桌面管理器将提供用于管理Redis的键和数据的UI。

参考链接

Redis使用详细教程 - wangyuyu - 博客园

Redhat5.8 环境下编译安装 Redis 并将其注册为系统服务

Redis快速入门 -Redis教程

相关推荐
七宝大爷1 天前
多GPU并行计算互联架构解析:NVLink的诞生与SLI CrossFire的落幕
架构·nvlink·sli
忙碌5441 天前
AI大模型时代下的全栈技术架构:从深度学习到云原生部署实战
人工智能·深度学习·架构
熊文豪1 天前
openEuler 云原生实战:部署高性能 Redis 集群与压测分析
数据库·redis·云原生·openeuler
阿里云云原生1 天前
阿里云微服务引擎 MSE 及 API 网关 2025 年 10 月产品动态
阿里云·微服务·云原生·云计算
喜欢吃豆1 天前
GraphRAG 技术教程:从核心概念到高级架构
人工智能·架构·大模型
虚伪的空想家1 天前
华为A800I A2 arm64架构鲲鹏920cpu的ubuntu22.04 tls配置直通的grub配置
ubuntu·华为·架构·虚拟化·kvm·npu·国产化适配
Tadas-Gao1 天前
MySQL存储架构解析:从数据无序到索引艺术的演进
数据库·分布式·mysql·微服务·云原生·架构
CV_J1 天前
编写微服务api
微服务·云原生·架构
brzhang1 天前
我觉得可以试试 TOON —— 一个为 LLM 而生的极致压缩数据格式
前端·后端·架构
xrkhy1 天前
canal1.1.8+mysql8.0+jdk17+redis的使用
android·redis·adb