Redis combat (a) Redis Introduction and installation environment (Windows)

Redis mentioned, I am sure you have heard, and should have more or less been used in a project, perhaps you think Redis use up quite a simple way, but if someone asks you the following questions (such as colleagues or interview officer), you can answer again?

  1. What is Redis?
  2. Redis what kinds of data structures may be stored?
  3. There are several Redis persistence mechanism? What are their strengths and weaknesses?
  4. Which scenario requires the use Redis?
  5. What is the cache avalanche, how to avoid?
  6. What is the cache penetration, how to avoid?

If you can answer up, congratulations to you, that you have some knowledge of Redis, if not answer, it does not matter, this series of blog Redis will conduct a series of talks, welcomed the attention!

The so-called advance preparation of its profits, as we have to learn Redis, first of all we at least have to know what and how to install Redis Redis environment, which is the main content of this blog.

1. Redis Introduction

Redis What is it?

Redis is an open source (BSD license) is stored in memory data structures, as a database, cache and message broker. It supports such as a string, a hash, a list, a set of ordered set of data structures and the like. - Redis official website

Redis is an open source use ANSI C language, network support, memory can also be based on the persistence of high-performance key-value database. -- Baidu Encyclopedia

Redis is a BSD open source license issued in accordance with high-performance key-value storage systems, often referred to as a data structure server. - other users

Redis is a remote memory database, it is not only strong performance, but also has replication features and unique data model to solve the problems born. Redis provides five different types of data structures, a variety of problems can be naturally mapped to these data structures. - "Redis real"

Redis is a very fast non-relational database, which may store a mapping between the key (key) and five different types of values (value) (mapping), may be the key in the memory of the hard disk to store persistent data , replication can be used to extend the read performance characteristics may also be used to expand the fragment client write performance. - "Redis real"

2. Redis environment installation (Windows)

Description: Redis official did not provide Windows version of Redis, do not recommend using the Windows version of Redis in a production environment, the company's production environment Redis is where I am currently deployed on Linux servers.

Although Redis is not officially supported versions of Windows, but Microsoft Microsoft Open Tech Group offers a Windows version of Redis, Download: https://github.com/microsoftarchive/redis/releases

Extract the downloaded file to the directory you like, here is my E: \ Tools \ Redis-x64-3.0.504, as follows:

Double-click the image above marked in red redis-server.exe to start the Redis service:

Cmd can also open a window, switch to the Redis directory, then execute the following command to start:

redis-server.exe redis.windows.conf

With these two ways open, the need to ensure cmd window remains open, closed after the client can not connect, if the server is restarted, the need to open the Redis server again, in order to solve this problem, we can install Redis as a Windows service:

cd E:\Tools\Redis-x64-3.0.504

redis-server --service-install redis.windows.conf

You can start directly at the interface / stop the service, you can also execute cmd command to start / stop / uninstall the service:

Uninstall the service:

redis-server --service-uninstall

Start the service:

redis-server --service-start

Out of service:

redis-server --service-stop

3. Redis Hello World example

Open cmd window, open a simple client to use the next Redis:

redis-cli.exe -h 127.0.0.1 -p 6379

Provided a key-value cache, wherein the key is hello, value for the hello world !:

set hello "hello world!"

Get key to the value of hello:

get hello

4. Redis Desktop Manager using

虽然我们可以通过命令的方式来查看Redis存储的数据,但毕竟不太友好,这里推荐个比较流行的工具:Redis Desktop Manager。

官网地址:https://redisdesktop.com/

官网现在的版本2019.1需要先赞助付费才能使用。

不过我们仍然可以下载之前不付费的版本,下载地址:https://github.com/uglide/RedisDesktopManager/releases/tag/0.8.8

安装过程比较简单,这里不再赘述,安装完成后,连接本机Redis服务端:

连接成功后,可以看到之前设置的值:

后续文章会讲解Linux环境安装Redis的方式,Redis的5种数据结构,持久化机制等,敬请期待……

5. 参考

Redis的安装和部署(windows )

Windows下使用Redis(一)安装使用

Guess you like

Origin www.cnblogs.com/zwwhnly/p/10984488.html