Ubuntu16.04.3安装Reids

    Redis是常用基于内存的Key-Value数据库,比Memcache更先进,支持多种数据结构,高效,快速。用Redis可以很轻松解决高并发的数据访问问题;作为实时监控信号处理也非常不错。

环境

Ubuntu16.04.3

安装Redis服务器端

sudo apt-get -y install redis-server

检查Redis服务器系统进程

~ ps -aux|grep redis
redis     4162  0.1  0.0  10676  1420 ?    Ss   23:24   0:00 /usr/bin/redis-server /etc/redis/redis.conf
conan     4172  0.0  0.0  11064   924 pts/0    S+   23:26   0:00 grep --color=auto redis

通过启动命令检查Redis服务器状态

~ netstat -nlt|grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN

查看Reids服务状态

root@iZ2ze1lytcrrmr1shasmx4Z:/home/soft# netstat -nlt | grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN     
root@iZ2ze1lytcrrmr1shasmx4Z:/home/soft# service redis status
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-05-31 21:28:14 CST; 2min 55s ago
 Docs: http://redis.io/documentation,
       man:redis-server(1)
 Main PID: 14438 (redis-server)
   CGroup: /system.slice/redis-server.service
       └─14438 /usr/bin/redis-server 127.0.0.1:6379       

May 31 21:28:14 iZ2ze1lytcrrmr1shasmx4Z systemd[1]: Starting Advanced key-value store...
May 31 21:28:14 iZ2ze1lytcrrmr1shasmx4Z run-parts[14420]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
May 31 21:28:14 iZ2ze1lytcrrmr1shasmx4Z run-parts[14439]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example
May 31 21:28:14 iZ2ze1lytcrrmr1shasmx4Z systemd[1]: Started Advanced key-value store.

通过命令行客户端访问Redis

root@iZ2ze1lytcrrmr1shasmx4Z:/home/soft# redis-cli
127.0.0.1:6379> 

配置远程连接

找到/etc/redis/redis.conf文件,注释bind 127.0.0.1

为了安全设置密码

找到/etc/redis/redis.conf文件
找到requirepass foobared解注释
foodared即为当前密码

重启服务

/etc/init.d/redis-server restart

你可能感兴趣的:(Ubuntu,Redis)