ubutun18.04 install redis

Install redis

root@ubuntu:~# apt-get install redis-server

Reading package lists ... Done
Building dependency tree package
Reading state information ... Done
will install the following software:
libjemalloc1 Redis-Tools
is recommended to install:
Ruby-Redis
following NEW packages will be installed:
libjemalloc1 Redis Redis-Server-Tools
upgraded 0 package, three new packages are installed, 0 to remove the package, there are 301 packages are not upgraded.
634 kB need to download the archive.
It will consume 3,012 kB of extra space after decompression.
You want to continue it? [Y / n] y

Look at the status inquiry

root@ubuntu:~# sudo /etc/init.d/redis-server status
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-06 12:31:02 CST; 1min 40s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 65284 (redis-server)
Tasks: 4 (limit: 3520)
CGroup: /system.slice/redis-server.service
└─65284 /usr/bin/redis-server 127.0.0.1:6379

8月 06 12:31:02 ubuntu systemd[1]: Starting Advanced key-value store...
8月 06 12:31:02 ubuntu systemd[1]: redis-server.service: Can't open PID fi…tory
8月 06 12:31:02 ubuntu systemd[1]: Started Advanced key-value store.
Hint: Some lines were ellipsized, use -l to show in full.

Modify the configuration file

root@ubuntu:~# sudo vi /etc/redis/redis.conf

1. Modify bind 

   The original: bind 127.0.0.1 represents the local loopback address, the service can only be accessed by redis client for this unit, but can not connect via remote

  Review of: speaking or comments this line into 0.0.0.0 ip This will accept all connections from the available network interfaces

2. Modify the protected mode protected mode, allowing only local link

  Amended to: protected mode no

root@ubuntu:~# sudo /etc/init.d/redis-server restart

[ ok ] Restarting redis-server (via systemctl): redis-server.service.

Client Test Log

root@ubuntu:~# redis-cli
127.0.0.1:6379>

carry out

Guess you like

Origin www.cnblogs.com/xiaobaoTribe/p/11309114.html