第二节 单机版本redis部署

1. 部署环境

  • 操作系统:centos7.X
  • CPU: 2H
  • 内存:4G
  • IP: 192.168.100.102
  • 部署版本: redis-7.0.15.tar.gz
  • 基础环境: gcc下载

2. 上传Redis安装包

text 复制代码
[root@localhost opt]# ll
总用量 2932
drwxrwxr-x. 8 root root    4096 1月   9 19:51 redis-7.0.15
-rw-r--r--. 1 root root 2994329 6月  14 00:15 redis-7.0.15.tar.gz
[root@localhost opt]# 

3. 编译

text 复制代码
make
text 复制代码
    INSTALL redis-sentinel
    CC redis-cli.o
    CC redisassert.o
    CC cli_common.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: 离开目录"/opt/redis-7.0.15/src"

4. 安装

如果编译成功,在src目录中发现几个 Redis 二进制文件,包括:

redis-server:Redis 服务

redis-cli是与 Redis 通信的命令行界面使用程序。

text 复制代码
make install
text 复制代码
[root@localhost redis-7.0.15]# make install
cd src && make install
which: no python3 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录"/opt/redis-7.0.15/src"
    CC Makefile.dep
make[1]: 离开目录"/opt/redis-7.0.15/src"
which: no python3 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录"/opt/redis-7.0.15/src"

Hint: It's a good idea to run 'make test' ;)

    INSTALL redis-server
    INSTALL redis-benchmark
    INSTALL redis-cli
make[1]: 离开目录"/opt/redis-7.0.15/src"

4. 内核参数设置

4.1 vm.overcommit_memory

Redis建议把这个值设置为1, 是为了让fork操作能够在低内存下也执行成功。默认是0

/etc/sysctl.conf配置文件中修改,修改完成后sysctl -p永久生效

bash 复制代码
vm.overcommit_memory = 1
4.2 net.core.somaxconn

/etc/sysctl.conf配置文件中修改添加以下内容,修改完成后sysctl -p永久生效

bash 复制代码
net.ipv4.tcp_max_syn_backlog = 1024
net.core.somaxconn = 1024

5. 启动

进入src目录下

bash 复制代码
./redis-server ../redis.conf
bash 复制代码
[root@localhost src]# ./redis-server ../redis.conf 
7121:C 14 Jun 2024 01:20:06.257 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7121:C 14 Jun 2024 01:20:06.257 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=7121, just started
7121:C 14 Jun 2024 01:20:06.257 # Configuration loaded
7121:M 14 Jun 2024 01:20:06.257 * Increased maximum number of open files to 10032 (it was originally set to 1024).
7121:M 14 Jun 2024 01:20:06.257 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 7.0.15 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 7121
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

7121:M 14 Jun 2024 01:20:06.258 # Server initialized
7121:M 14 Jun 2024 01:20:06.259 * Loading RDB produced by version 7.0.15
7121:M 14 Jun 2024 01:20:06.259 * RDB age 270 seconds
7121:M 14 Jun 2024 01:20:06.259 * RDB memory usage when created 0.82 Mb
7121:M 14 Jun 2024 01:20:06.259 * Done loading RDB, keys loaded: 0, keys expired: 0.
7121:M 14 Jun 2024 01:20:06.259 * DB loaded from disk: 0.000 seconds
7121:M 14 Jun 2024 01:20:06.259 * Ready to accept connections
相关推荐
tedcloud12321 小时前
DBX部署教程:打造支持AI SQL助手的数据库管理环境
数据库·人工智能·sql
野生技术架构师21 小时前
我有个大胆的想法,用 PostgreSQL 代替 Redis
数据库·redis·postgresql
cfm_291421 小时前
Redis ZSet 有序集合详解
数据库·redis·缓存
瀚高PG实验室21 小时前
V4.5.6.1授予普通用户监控类系统表及视图的查询权限
数据库·瀚高数据库
BullSmall1 天前
模板库与抽取实例:企业数据同步最佳实践
数据库
云策数链1 天前
用友U8数据库核心表结构与业务关联解析(附常用查询SQL)
数据库·sql·erp·用友·云策数链
徒手猫1 天前
MySQL 窗口函数完全指南
数据库·mysql
betazhou1 天前
电科金仓数据库V9 MySQL兼容版本搭建一主一从体验
数据库·mysql·oracle·主从·高可用·kingbase·v9 mysql兼容版本
python在学ing1 天前
Django框架学习笔记:从零基础到项目实战
数据库·python·django·sqlite
duoduo_sing1 天前
数据库备份终极方案:从脚本手动到自动化热备+异地同步实战
运维·数据库·自动化·用友