openEuler安装Redis

本文档详细介绍了如何在openEuler操作系统上安装Redis6.2.7,包括从官网下载软件包,上传到虚拟机,解压并移动到指定目录,进行编译和安装,以及验证安装结果。此外,还涉及了Redis配置文件的修改,如允许远程访问和设置后台启动。在验证过程中,服务器成功启动并监听6379端口,但警告了overcommit_memory设置可能导致的问题。
摘要由CSDN通过智能技术生成

1.软件包下载上传

下载:https://redis.io/download
上传:上传tar包至虚拟机

[root@localhost download]# tar -C /opt/software/ -zxvf redis-6.2.7.tar.gz # -C指定解压目录
[root@localhost software]# mv redis-6.2.7 redis
[root@localhost software]# cd redis

2.Redis的安装

# 编译
# 编译的基础是虚拟机必须配备GCC环境
[root@localhost redis]# make

# 安装
[root@localhost redis]# make PREFIX=/opt/software/redis install

3.安装结果验证

[root@localhost redis]# bin/redis-server ./redis.conf 
9660:C 10 May 2022 15:55:49.651 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9660:C 10 May 2022 15:55:49.651 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=9660, just started
9660:C 10 May 2022 15:55:49.651 # Configuration loaded
9660:M 10 May 2022 15:55:49.651 * Increased maximum number of open files to 10032 (it was originally set to 1024).
9660:M 10 May 2022 15:55:49.651 * monotonic clock: POSIX clock_gettime
9660:M 10 May 2022 15:55:49.652 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 9660
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

9660:M 10 May 2022 15:55:49.652 # Server initialized
9660:M 10 May 2022 15:55:49.652 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
9660:M 10 May 2022 15:55:49.652 * Loading RDB produced by version 6.2.7
9660:M 10 May 2022 15:55:49.652 * RDB age 128 seconds
9660:M 10 May 2022 15:55:49.652 * RDB memory usage when created 0.77 Mb
9660:M 10 May 2022 15:55:49.652 # Done loading RDB, keys loaded: 0, keys expired: 0.
9660:M 10 May 2022 15:55:49.652 * DB loaded from disk: 0.000 seconds
9660:M 10 May 2022 15:55:49.652 * Ready to accept connections
^C9660:signal-handler (1652169397) Received SIGINT scheduling shutdown...
9660:M 10 May 2022 15:56:37.758 # User requested shutdown...
9660:M 10 May 2022 15:56:37.759 * Saving the final RDB snapshot before exiting.
9660:M 10 May 2022 15:56:37.761 * DB saved on disk
9660:M 10 May 2022 15:56:37.761 * Removing the pid file

4.修改配置文件

# 修改Redis配置文件
[root@localhost redis]# vim redis.conf

# 配置远程访问
将bind 127.0.0.1 -::1此行注释 # 如果不注释,相当于配置了固定ip,配置完之后,只有指定ip可连接redis,其他ip不能
将protected-mode 由yes改为no # 与bind配合使用,一起注释

# 配置后台启动
将daemonize 由no改为yes
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值