Install Redis on Ubuntu

Redis,is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

Redis, is a key-value storage system, similar to memcached, it supports more stored value types, including string (string) , List (linked list), set (collection), zset (sorted set-ordered set) and hashs (hash type). These data types all support push/pop, add/remove, intersection, union and difference, and richer operations, and these operations are all atomic. On this basis, redis supports a variety of different ways of sorting. Like memcached, in order to ensure efficiency, data is cached in memory. The difference is that redis periodically writes updated data to disk or writes modification operations to additional record files, and on this basis, it realizes master-slave (master-slave) synchronization.

Redis is a high-performance key-value database. The emergence of redis has largely compensated for the inadequacy of key/value storage such as memcached, and can play a good supplementary role in relational databases in some cases. It provides Python, Ruby, Erlang, and PHP clients, which is very convenient to use.

1、 Redis download

1 ) Download Document

Redis official download Address, download the latest version redis-2.6.14.tar.gz

2 ) Command line download
cd ~/Downloads/tool-server/``wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz ``tar -zxvf redis-2.6.13.tar.gz``cd redis-2.6.13``make ``sudo make install

2、 Default installation

2.1 redis.conf

The default configuration of redis.conf is installed to the directory: /etc/redis/6379.conf

2.2、 redis log

Redis default log path: /var/log/redis_6379.log

Redis default database file path: /var/lib/redis/6379/dump.rdb

2.3、 redis command

The default directory of the redis command: /usr/local/bin/

homer2@ubuntu:/opt/redis-2.6.13$ ls -l /usr/local/bin/
total 8440

2.4 Start redis

sudo redis-server /etc/redis/6379.conf &

3、 Add redis user

**3.1、 Configure the init script: **wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server ``wget https://github.com/ijonas/dotfiles/raw/ master/etc/redis.conf ``sudo mv redis-server /etc/init.d/redis-server ``sudo chmod +x /etc/init.d/redis-server ``sudo mv redis.conf /etc/ redis.conf

3.2、 Initialize user and log path
Before starting Redis for the first time, it is recommended to create a separate user for Redis and create new data and log folders
sudo useradd redis ``sudo mkdir -p /var/lib/redis ``sudo mkdir -p /var/log/redis ``sudo chown redis.redis /var/lib/redis ``sudo chown redis.redis /var/log/redis

Note: redis is a new user, you can also use the current system default user (for example: homer), you need to modify sudo chown homer.redis /var/lib/redis

**3.3、 Set to automatically start when power is turned on, and automatically close when power off **update-rc.d redis-server defaults

**3.4、 Start Redis: **/etc/init.d/redis-server start

6、 Start client client connection

$ redis-cli

redis> set foo bar

OK

redis> get foo

" bar"

7、 Close redis

redis-cli  shutdown

Reference recommendation:

Redis official

Redis Tutorial (official)

ubuntu install start redis

Install Redis on Ubuntu and configure it to start on boot

Detailed explanation of Redis installation under Linux (recommended)

Recommended Posts

Install Redis on Ubuntu
install vscode on ubuntu18
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install docker on Ubuntu
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
Install mysql on Ubuntu 14.04
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
Install Python3 on Ubuntu 14.04
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
Install Python3 on Ubuntu 16.04
Install KDE on Ubuntu16.04.2
Install Docker on Ubuntu18
Install Python3.7 on Ubuntu
Install flashplayer on Ubuntu
Docker practice (1): install Docker on Ubuntu 16.04
Install ubuntu on virtual machine
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install QQ robot on Ubuntu 16.04
Install Python 3.7 on Ubuntu 18.04 LTS
Install Android Studio on Ubuntu
Install scrapy framework on ubuntu
Install Mysql offline on Ubuntu
Install Oracle Java8 on Ubuntu
Install Odoo 11 stack on Ubuntu 16.04
Install Go locale on Ubuntu16
Install common software on Ubuntu 16.04
Install non-portable QQ on ubuntu
Install Docker on Ubuntu 18.04 offline
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
Install Tenda u12 driver on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
Install and configure MySQL on Ubuntu
Install Chef server workstation on Ubuntu 18.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
Install botan2 encryption library on ubuntu
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
Docker ubuntu: install python-PIL-image environment on 14.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04