Linux测试环境搭建详细步骤---redis快速部署

redis快速部署

redis是c语言开发的,安装redis需要先将官网下载的源码进行编译,依赖gcc环境

(一)安装gcc-c++ yum install gcc-c++
(二)下载redis wget http:// download.redis.io/releases/redis-3.0.4.tar.gz
(三)解压 tar -zxvf
(四)切换至程序目录,使用make进行编译
(五)make PREFIX=/usr/local/redis install 安装
(六)复制配置文件redis.config到/usr/local/redis/bin/
(七)启动./redis-server redis.conf 启动./redis-cli

详细步骤

(一)安装gcc-c++ yum install gcc-c++

[root@192 local]# yum install gcc-c++

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: ftp.sjtu.edu.cn
软件包 gcc-c++-4.8.5-44.el7.x86_64 已安装并且是最新版本
无须任何处理

(二)下载redis wget http:// download.redis.io/releases/redis-3.0.4.tar.gz

# 创建redis文件夹
[root@192 local]# cd /usr/local
[root@192 local]# mkdir redis
[root@192 local]# cd redis

# 下载redis
[root@192 redis]# wget http://download.redis.io/releases/redis-3.0.4.tar.gz
--2022-10-10 07:00:09--  http://download.redis.io/releases/redis-3.0.4.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 45.60.125.1
正在连接 download.redis.io (download.redis.io)|45.60.125.1|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1364993 (1.3M) [application/octet-stream]
正在保存至: “redis-3.0.4.tar.gz”

100%[==============================================>] 1,364,993   1.25MB/s 用时 1.0s   

2022-10-10 07:00:10 (1.25 MB/s) - 已保存 “redis-3.0.4.tar.gz” [1364993/1364993])

(三)解压redis

[root@192 redis]# ls
redis-3.0.4.tar.gz

[root@192 redis]# tar -zxvf

[root@192 redis]# ls
redis-3.0.4  redis-3.0.4.tar.gz

(四)切换至redis-3.0.4目录,使用make进行编译

[root@192 redis]# cd redis-3.0.4/
[root@192 redis-3.0.4]# make

(五)编译:make PREFIX=/usr/local/redis install 

[root@192 redis-3.0.4]# make PREFIX=/usr/local/redis install
cd src && make install
make[1]: 进入目录“/usr/local/redis/redis-3.0.4/src”

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

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: 离开目录“/usr/local/redis/redis-3.0.4/src”

(六)复制配置文件redis.conf到/usr/local/redis/bin/

[root@192 redis-3.0.4]# cp redis.conf /usr/local/redis/bin/

(七)启动./redis-server redis.conf 启动./redis-cli

[root@192 bin]# ./redis-server redis.conf
12676:M 10 Oct 07:11:21.468 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 12676
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

12676:M 10 Oct 07:11:21.470 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
12676:M 10 Oct 07:11:21.470 # Server started, Redis version 3.0.4
12676:M 10 Oct 07:11:21.470 # 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.
12676:M 10 Oct 07:11:21.470 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
12676:M 10 Oct 07:11:21.470 * The server is now ready to accept connections on port 6379

重新打开一个会话

[root@192 ~]# cd /usr/local/redis/bin
[root@192 bin]# ls
redis-benchmark  redis-check-dump  redis.conf      redis-server
redis-check-aof  redis-cli         redis-sentinel
[root@192 bin]# ./redis-cli
127.0.0.1:6379> 


# 查看是否启动
[root@192 ~]# ps -ef | grep redis
root      12676   2604  0 07:11 pts/1    00:00:00 ./redis-server *:6379
root      12741  12691  0 07:12 pts/2    00:00:00 ./redis-cli
root      12804  12762  0 07:14 pts/3    00:00:00 grep --color=auto redis

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

甘雨降

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值