redis之在Linux下简单安装

写在前面

不管是基于开发,学习目的,经常需要安装一个简单的Redis环境,本文一起看下在Linux环境下如何安装。

1:安装

  • 下载
wget http://download.redis.io/releases/redis-4.0.2.tar.gz
  • 解压
tar -zxvf redis-4.0.2.tar.gz
  • make
cd redis-4.0.2
make
  • install
    安装redis server可执行文件以及其他的一些可执行文件,如客户端连接工具redis-cli,aof日志工具redis-check-aof,压测工具redis-benchmark,如下:
[root@localhost redis-4.0.2]# make PREFIX=/root/study/redis5/redis4-bin install
cd src && make install
make[1]: Entering directory `/root/study/redis5/redis-4.0.2/src'
    CC Makefile.dep
make[1]: Leaving directory `/root/study/redis5/redis-4.0.2/src'
make[1]: Entering directory `/root/study/redis5/redis-4.0.2/src'

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

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: Leaving directory `/root/study/redis5/redis-4.0.2/src'
[root@localhost redis-4.0.2]# cd /root/study/redis5/redis4-bin
[root@localhost redis4-bin]# cd bin/
[root@localhost bin]# ll
total 21780
-rwxr-xr-x. 1 root root 2451936 Nov  8 17:39 redis-benchmark
-rwxr-xr-x. 1 root root 5742728 Nov  8 17:39 redis-check-aof
-rwxr-xr-x. 1 root root 5742728 Nov  8 17:39 redis-check-rdb
-rwxr-xr-x. 1 root root 2606168 Nov  8 17:39 redis-cli
lrwxrwxrwx. 1 root root      12 Nov  8 17:39 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5742728 Nov  8 17:39 redis-server

拷贝配置文件redis.conf

[root@localhost bin]# pwd
/root/study/redis5/redis4-bin/bin
[root@localhost bin]# cp /root/study/redis5/redis-4.0.2/redis.conf .

2:启动测试

  • 启动
[root@localhost bin]# pwd
/root/study/redis5/redis4-bin/bin
[root@localhost bin]# ./redis-server redis.conf 
9118:C 08 Nov 17:49:41.569 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9118:C 08 Nov 17:49:41.569 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=9118, just started
9118:C 08 Nov 17:49:41.569 # Configuration loaded
9118:M 08 Nov 17:49:41.570 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.2 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 9118
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

...
9118:M 08 Nov 17:49:41.573 * Ready to accept connections
  • 连接测试
[root@localhost redis5]# cd redis4-bin/
[root@localhost redis4-bin]# ./bin/redis-cli 
127.0.0.1:6379> MODULE list
(empty list or set)
127.0.0.1:6379> set name jack
OK
127.0.0.1:6379> get name
"jack"

redis 主从配置从节点redis.conf配置属性
在这里插入图片描述

写在后面

参考文章列表:

linux下安装redis(超详细,每一步命令都有命令截图及运行截图)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值