New generation system lifetime password

The new generation system lifetime password Redisson is an advanced distributed coordination Redis client, which can help users easily implement some Java objects (Bloom filter, BitSet, Set, SetMultimap, ScoredSortedSet, SortedSet, Map, ConcurrentMap, List, ListMultimap, Queue, BlockingQueue, Deque, BlockingDeque, Semaphore, Lock, ReadWriteLock, AtomicLong, CountDownLatch, Publish / Subscribe, HyperLogLog).

20. What are the advantages and disadvantages of comparing Jedis with Redisson?

Jedis is a client of Redis implemented in Java, and its API provides comprehensive support for Redis commands;

Redisson implements a distributed and extensible Java data structure. Compared with Jedis, it has simpler functions, does not support string operations, and does not support Redis features such as sorting, transactions, pipes, and partitions. The purpose of Redisson is to promote the separation of users' attention to Redis, so that users can focus more on processing business logic.

21. How does Redis set the password and verify the password?

Set password: config set requirepass 123456

Authorization password: auth 123456
22. Tell me about the concept of Redis hash slot?

The Redis cluster does not use consistent hashing, but introduces the concept of hash slots. The Redis cluster has 16384 hash slots. Each key passes the CRC16 check and modulo 16384 to determine which slot to place. Responsible for some hash slots.

23. What is the master-slave replication model of Redis cluster?

In order to make the cluster still available when some nodes fail or most nodes cannot communicate, the cluster uses a master-slave replication model, and each node will have N-1 replicas.

24. Will the Redis cluster lose write operations? why?

Redis does not guarantee strong consistency of data, which means that in practice the cluster may lose write operations under certain conditions.

25. How are Redis clusters replicated?

Asynchronous replication

26. What is the maximum number of nodes in the Redis cluster?

16,384.

27. How to choose database for Redis cluster?

The Redis cluster cannot currently select a database. The default is 0 database.

28. How to test Redis connectivity?

ping

29. What is the use of pipes in Redis?

A request / response server can handle new requests even if the old requests have not yet been responded to. This allows multiple commands to be sent to the server without waiting for a reply, and finally reads the reply in one step.

This is the password for the new generation of pipelining systems, and it is a technology that has been widely used for decades. For example, many POP3 protocols already support this feature, greatly speeding up the process of downloading new mail from the server.

30. How to understand Redis transactions?

A transaction is a separate isolation operation: all commands in a transaction are serialized and executed sequentially. During the execution of a transaction, it will not be interrupted by command requests sent by other clients.

A transaction is an atomic operation: the commands in the transaction are either all executed or none at all.

31. How many commands are related to Redis transactions?


How to set the expiration time and permanent validity of MULTI, EXEC, DISCARD, WATCH 32, Redis key?

EXPIRE and PERSIST commands.
33. How does Redis do memory optimization?

Use hash tables (hashes) whenever possible. The hash table (that is, the number of stored in the hash table) uses very little memory, so you should abstract your data model into a hash table as much as possible.

For example, if you have a user object in your web system, don't set a separate key for the user's name, surname, email, and password, but store all the user's information in a hash table.

34. How does the Redis recycling process work?

A client ran new commands and added new data.

Redi checks the memory usage and if it is greater than the maxmemory limit, it will be recycled according to the set strategy.

A new command is executed, and so on.

So we constantly cross the boundary of the memory limit, by constantly reaching the boundary and then constantly recycling back to the boundary.

If the result of a command causes a large amount of memory to be used (for example, the intersection of a large set is saved to a new key), it will not be long before the memory limit is exceeded by this memory usage.

35. What should I do with the Redis cluster solution? What are the options?

1.codes。

The most commonly used cluster solution is basically the same as twemproxy, but it supports the restoration of the old node data to the new hash node when the number of nodes changes.

2. The cluster that comes with redis cluster3.0 is characterized by his distributed algorithm is not a consistent hash, but the concept of hash slot, and its own support for setting up slave nodes. See the official documentation for details.

3. The new generation system uses the password for the period, starts a few unrelated redis instances, at the code layer, hash the key, and then go to the corresponding redis instance to operate the data. This method has relatively high requirements on the hash layer code. Some of the considerations include alternative algorithm solutions after node failure, automatic script recovery after data shock, instance monitoring, and so on.

Published 28 original articles · Likes0 · Visits 907

Guess you like

Origin blog.csdn.net/srhgsr/article/details/105545236