Redis Ubuntu install and configure Remote Access

First, the software update and installation of warehouse Redis

sudo apt-get install update
sudo apt-get install redis-server

注:若报错找不到安装包则运行 sudo apt-get update

 

After installation check Redis system processes and service status

ps -aux|grep redis

netstat -nlt|grep 6379

Second, enter the Redis database and operating

redis-cli                   # 进入redis数据库
set key1 'hello word'       # 增加一条记录key: 'hello word'
get key1                    # 查看记录

Third, add and verify the password to allow remote access

1.设置访问密码(注释并将foobared修改成你要的密码,如:123456)
sudo vi /etc/redis/redis.conf
# requirepass foobared
requirepass 123456

2.放通外网访问(注释掉redis.conf中的bind)
#bind 127.0.0.1

3.重启redis服务
/etc/init.d/redis-server restart    # 重启服务
/etc/init.d/redis-server start      # 启动服务
/etc/init.d/redis-server stop       # 停止服务

4.查看网络监听127.0.0.1:6379 变成 0 0.0.0.0:6379
netstat -nlt|grep 6379

5.使用密码登录
redis-cli -a 123456

redis-desktop-manager remote connection test

Published 59 original articles · won praise 19 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_43507959/article/details/89042104