Redis Learning Lesson One: Installing Linux Redis

Source: Internet
Author: User
Tags redis server

For distributed caches, only memcached was used in the previous company project, and it was easy to use, with ready-made C # versions of the components.

There are a lot of companies using Redis today, so we're going to look at Redis.

Redis's official address: Http://redis.io

Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. From March 15, 2010 onwards, the development work of Redis is hosted by VMware. Since May 2013, the development of Redis has been sponsored by pivotal.

Redis is a key-value storage system. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), Zset (sorted set-ordered collection), and hash (hash type). These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. Based on this, Redis supports sorting in a variety of different ways. As with memcached, data is cached in memory to ensure efficiency.  The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis. Redis is a high-performance Key-value database. The emergence of Redis, to a large extent, compensates for the lack of memcached such key/value storage, in some cases can be a good complement to the relational database.  It provides clients such as Java,c/c++,c#,php,javascript,perl,object-c,python,ruby,erlang, which is convenient to use. Redis supports master-slave synchronization. Data can be synchronized from the primary server to any number of slave servers, from the server to the primary server that is associated with other slave servers. This enables Redis to perform single-layer tree replication. You can write to the data intentionally or unintentionally. Because of the full implementation of the publish/subscribe mechanism, you can subscribe to a channel and receive a complete message release record from the master server when the tree is synchronized anywhere from the database. Synchronization is helpful for the scalability and data redundancy of read operations. Environment: Company resource constraints, find a work machine, installed VMware, virtual a ubantu (Wu ban map) Linux system. (1). Configure IP, modify file/etc/network/interfaces:

>gedit/etc/network/interfaces

Content:

Auto Eth0

Iface eth0 inet Static

Address 192.168.32.216

Netmask 255.255.255.0

Gateway 192.168.32.2

(2). Modify the file/etc/resolv.conf

>gedit/etc/resolv.conf

Content:

NameServer 192.168.32.2

(3) Execute the following command to make the configuration effective

>sudo/etc/init.d/networking restart

Checks whether the configuration was successful by performing ifconfig.

(4) Installing Redis

Download the file redis-3.0.2.tar.gz from the Redis website and put the file under the virtual machine directory/home/anny/tools/.

Execute the following command:

Tar zxvf redis-3.0.2.tar.gz
CD REDIS-3.0.2/SRC
Make

To move the files required by Redis to the directory/usr/local/redis, the command is as follows:

Mkdir-p/usr/local/redis/bin
Mkdir-p/usr/local/redis/etc
Mv/home/anny/redis-3.0.2/redis.conf/usr/local/redis/etc
Cd/home/anny/redis-3.0.2/src
MV mkreleasehdr.sh Redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server/usr/local/redis/bin

If you want Redis server to run in the background, you can modify the Redis profile redis.conf and change "Daemonize no" to "daemonize yes".

The./redis-server/usr/local/redis/etc/redis.conf checks whether Redis (the default port for Redis is 6379) runs successfully in the background with the following command: PS-EF | grep Redis
NETSTAT-TUNPL | grep 6379 Running the Redis client program:./REDIS-CLI close Redis Server with the following command:
Pkill Redis-server

Redis Learning Lesson One: Installing Linux Redis

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.