Install redis on Ubuntu

Source: Internet
Author: User
Tags download redis dotfiles install redis redis tutorial value store
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, redis supports more value types, including string, list, and set), zset (sorted set -- ordered set), and hashs (hash type ). These data types support push/pop, Add/Remove, Intersection Set and difference set, and more abundant operations, and these operations are atomic. On this basis, redis supports sorting in different ways. Like memcached, data is cached in the memory to ensure efficiency. The difference is that redis periodically writes the updated data to the disk or writes the modification operation to the append record file, and on this basis implements master-slave (master-slave) synchronization. Redis is a high-performance Key-value database. The emergence of redis largely compensates for the shortage of key/value storage such as memcached, and can play a good complementary role in relational databases in some cases. It provides python, Ruby, Erlang, and PHP clients for ease of use.

1. Download redis

1) File Download

Redis official, download the latest version of 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 in the directory:/etc/redis/6379. conf.

2.2 redis logs

Default redis Log Path:/var/log/redis_62.16.log

Default redis database file path:/var/lib/redis/6379/dump. RDB

2.3 redis commands

Default redis command directory:/usr/local/bin/

Homer2 @ Ubuntu:/opt/redis-2.6.13 $ LS-L/usr/local/bin/
Total 8440
-Rwxrwxr-x 1 homer2 homer2 2224542 Jul 3 redis-Benchmark
-Rwxrwxr-x 1 homer2 homer2 30547 Jul 3 redis-check-Aof
-Rwxrwxr-x 1 homer2 homer2 63515 Jul 3 redis-check-dump
-Rwxrwxr-x 1 homer2 homer2 2326503 Jul 3 redis-cli
-Rwxrwxr-x 1 homer2 homer2 3985830 Jul 3 redis-Server

2.4 start redis

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


3,New 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 the user and Log Path
Before starting redis for the first time, we recommend that you create a separate user for redis and create a new data and log folder.
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 default user of the current system (for example:Homer), You need to modify sudo chown.Homer. Redis/var/lib/redis


3.3 set Automatic startup and automatic shutdown
update-rc.d redis-server defaults

3.4 start redis:
/etc/init.d/redis-server start

6. Start the Client Connection

$ redis-cli redis> set foo bar OK redis> get foo "bar"

7. Disable redis

Redis-cli Shutdown

Reference recommendations:

Official redis

Redis tutorial (official)

Install and start redis in Ubuntu

Install redis in Ubuntu and configure startup

Install redis in Linux (recommended)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.