Redis安装

Redis安装

1.下载Redis安装包到/sur/src/下

[root@localhost src]# wget http://download.redis.io/releases/redis-5.0.7.tar.gz
--2020-01-07 05:44:25--  http://download.redis.io/releases/redis-5.0.7.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1984203 (1.9M) [application/x-gzip]
Saving to: ‘redis-5.0.7.tar.gz’

100%[======================================>] 1,984,203   32.7KB/s   in 39s    

2020-01-07 05:45:04 (49.9 KB/s) - ‘redis-5.0.7.tar.gz’ saved [1984203/1984203]

2.安装gcc、gcc-c++编译器

[root@localhost src]# yum -y install gcc gcc-c++

3.解压redis安装包并编译

[root@localhost src]# tar xf redis-5.0.7.tar.gz 
[root@localhost src]# cd redis-5.0.7/
[root@localhost redis-5.0.7]# make && make install

4.启动程序,查看端口号6379:

[root@localhost ~]# mkdir /etc/redis
[root@localhost ~]# cp /usr/src/redis-5.0.7/redis.conf /etc/redis/        //配置文件放到/etc/redis/下
[root@localhost ~]# ls /etc/redis/
redis.conf

[root@localhost ~]# nohup redis-server /etc/redis/redis.conf &     //后台启动
[1] 9503
nohup: ignoring input and appending output to ‘nohup.out’

[root@localhost ~]# ss -natl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128    127.0.0.1:6379                     *:*                  
LISTEN     0      128          *:111                      *:*                  
LISTEN     0      5      192.168.122.1:53                       *:*                  
LISTEN     0      128          *:22                       *:*                  
LISTEN     0      128    127.0.0.1:631                      *:*                  
LISTEN     0      100    127.0.0.1:25                       *:*                  
LISTEN     0      128         :::111                     :::*                  
LISTEN     0      128         :::22                      :::*                  
LISTEN     0      128        ::1:631                     :::*                  
LISTEN     0      100        ::1:25                      :::*                  

5.配置密码认证

[root@localhost ~]# vim /etc/redis/redis.conf       //修改配置文件
# requirepass foobared   //更改前
   bind 127.0.0.1
 
   requirepass peiyf     //更改后
   bind 192.168.100.200

//测试:
[root@localhost ~]# redis-cli  -h 192.168.100.200 -p 6379 
192.168.100.200:6379> keys *
(error) NOAUTH Authentication required.
192.168.100.200:6379> quit
[root@localhost ~]# redis-cli  -h 192.168.100.200 -p 6379 -a peiyf
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.100.200:6379> keys *
(empty list or set)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值