Redis installation built environment

Introduction:
1, memory-based storage
2, redis persistence strategy
aof
Features:
1, in the form of data files stored
2, whenever the data changes, will record a log, it synchronizes the database

Features:
1, data is stored in memory, the data is easily lost, read and write speed
2, the time change of the memory, there is provided redis.conf about
900 10000
60 1
300 100
. 3, support the cluster Redis

Redis install
server installation
Redis official website: https://redis.io/

Step 1: Install gcc
yum install gcc-c ++ (gcc compiler c, because c redis is written, so let's installation gcc)

 

 

 After then in turn execute the command
Tar -xvf redis-5.0.2.tar.gz (decompression)
cd-Redis 5.0.2 / (into the catalog)
the Make (compile)

 

 

 

When you see this figure when it shows the successful launch it!

However, this is the start or the front reception starts, quit the program if it is terminated or quit.
So this service, you must run the back end;

We modify the configuration file redis.conf
we can first copy of a backup in case redis.conf
Code:

cp redis.conf redis_bak.conf
enter

vi redis.conf
open daemon, do not open it, can not do other operations
#daemonize no change daemonize yes (hold down n to find)
can now enter the server

./src/redis-server redis.conf
install the client installation
2. Visual tools redis-desktop-manager Installation and Configuration
2.1 Double-redis-desktop-manager-0.8.8.384.exe to

Open ports
firewall-cmd --zone = public --add- port = 6379 / tcp --permanent
with new firewall rules
firewall-cmd --reload
firewall list
firewall-cmd --zone = public --list- ports
firewall state
systemctl status firewalld
start the firewall
systemctl start firewalld
turn off the firewall
systemctl STOP firewalld.service
systemctl disable firewalld.service

2.2 Configuring Telnet
input / bind by n find
#bind 127.0.0.1 # Comment this line (line 69)

Then execute / requirepass
# find the following line and remove the comment, and add a password (396 lines)
before #requirepass foobared # modify
requirepass 123456 # modified

Press the ESC key marked: wq Quit

Finally, the implementation of the modified login password
input in the turn arrow

./redis-cli -h 127.0.0.1 -p 6379 -a 123456

 

 

 To test whether the connection is successful

 

Redis Syntax Operation
1. Introduction Redis
Redis is an open source (BSD license), the server memory to store data structures, can be used as a database, cache and agent message queue.
It supports strings, hash tables, lists, sets, ordered set, bitmaps, hyperloglogs data types. Built-in replication, Lua script, LRU recovery, transaction and different levels of persistent disk function,
while providing high availability by Redis Sentinel, provides automatic partitioning by Redis Cluster

Learning URL: HTTPS: //www.w3cschool.cn/redis/
www.redis.cn
www.redis.net.cn

Redis Application: 1. 2. Database Cache

Based on the database stored in memory
Redis
memcache
2. Redis supports five data types
string (string), hash (hash), list (list), set (collection) and zset (sorted set: an ordered collection)

3. Operation redis command (command case insensitive)
redis default database 16, MongoDB is 3: ADMIN / local / Test
redis-CLI terminal # open redis
select index # select the specified database, the default database 16 , mongodb is 3:
ADMIN / local / the Test

# String
set name # save
get name # get
type name # View type
Keys *
del name

 

 

 

 # Hash (Hash), Redis hash field is a string type and the value of the mapping table, hash is particularly suited for storing objects
HSET Key The attR1 attR2 VALUE1 value2
hget Key The attR1
hgetall Key

 

 

 

 # List (List)
LPUSH Key VALUE1 value2 value3
LLEN Key
the lindex Key index
Lrange #stop STOP can Start Key -1, meaning to end

 

 

 

Guess you like

Origin www.cnblogs.com/wupeng/p/11669087.html