In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the "brief introduction of NoSQL database and redis persistent data service" related knowledge, in the actual case operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Introduction to Nosql database
It is a kind of non-relational database service, which can solve the concurrency ability of conventional database, such as the bottleneck of IO and performance of traditional database. It is also a supplement of relational database, with high efficiency and high performance.
Focus on redis, memcached, ttserver of key-value query
Resolve the following issues:
1) High concurrent read and write requirements for databases
2) big data's efficient storage and access requirements
3) requirements for high scalability and high availability
Application Environment of Nosql Database
1) the data model is relatively simple
2) A more flexible IT system is needed
3) higher performance requirements for the database.
4) High degree of data consistency is not required
5) for a given KEY, it is easier to map complex values.
Classification and characteristics of Nosql Software
1) key-value key-value storage database (redis, memcached)
For content caching, suitable for loading and expanding large datasets
A data type is a series of key-value pairs
It has the function of quick query, but the stored data is less structured.
Poor support for transactions, and cannot be rolled back when a database failure occurs
2) column Storage Database (HBase)
For distributed file systems
Store the same column of data together in a column cluster
Fast search speed, strong scalability, and easier distributed expansion
The function is relatively limited
3) File-oriented database (mongoDB)
There are many applications for WEB.
The data type is a series of key-value pairs
Query performance is not high, there is no unified query syntax
4) graphic database (Graph)
There are many social network applications.
It is not easy to make a distributed cluster scheme.
Introduction of commonly used Nosql databases
1) memcached
Is an open source high-performance caching system with distributed memory objects
Features:
1. Simple installation and deployment
2. Support high concurrency and high performance
3. Distributed can be realized through program or load balancing.
4. For memory cache only, restart service data is lost
Official website: http://memcached.org
2) memcacheDB
Is an open source project developed by Sina based on memcached, with transaction recovery function.
Features:
1. High concurrent read and write
2. Efficient storage
3. Highly available data storage
Official website: http://memcachedb.org/benchmark.html
How to choose Nosql Database in production Environment
1. For the most conventional caching applications, memcached is the most suitable.
2. Persistent storage solution memcacheDB
3. Memcached is used for small data with less than 20 million data.
4. Redis can be used for large amounts of data.
Redis persistent data service
REmote DIctionary server (redis) is a persistent database storage system based on key-value key-value pairs, which supports more data storage types, including strings, lists, collections, etc.
Is a persistent cache service that periodically writes updated data to disk and appends modification records to files. It also supports master-slave synchronization mode. It is an open source log and key-value database based on C language that supports network and memory persistence.
The characteristics of redis persistent Service
Key-value key-value type storage system
Support reliable data storage
Single-process single-threaded high performance server
Recovery is slow.
Stand-alone qps (second concurrency) can reach 10W
Suitable for high-speed read and write access to small data
Advantages and disadvantages of redis storage system:
Data can be stored persistently
Support a read and write frequency of 10W per second
Support for rich data types
All operations are atomic.
Support off-machine master-slave replication
High memory management overhead (less than 3max 5 of physical memory)
There are great differences in the delay of different commands.
Official website: http://www.redis.io
Introduction to redis persistence
Redis stores data in memory and achieves persistent storage through snapshots and logs. The former has high performance and there will be data loss, while the latter is the opposite.
Redis application scenario
The problem of MYSQL+memcached website architecture: if there is a large amount of data, you need to disassemble the table and expand the capacity. Data consistency is a problem.
1) * Application scenario is memory service
2) as an alternative to memcached
3) businesses with certain requirements for data consistency but not high
4) businesses that need more data types to support
5) businesses requiring master-slave synchronization and load balancing
Installation of redis
For master-slave synchronous configuration, failover can be achieved, data persistence is disabled on the master, and the memory should be large enough for configuration from the top.
Wget http://download.redis.io/releases/redis-2.8.24.tar.gz [root@redis-m tools] # tar zxf redis-2.8.24.tar.gz [root@redis-m tools] # cd redis-2.8.24 [root@redis-m redis-2.8.24] # make [root@redis-m redis-2.8.24] # make PREFIX=/application/redis-2.8.24 install [root@redis-m redis-2.8.24 ] # ln-s / application/redis-2.8.24 / application/redis [root@redis-m tools] # tree / application/redis / application/redis `--bin |-- redis-benchmark # performance testing tool |-- redis-check-aof # detect update log |-- redis-check-dump # check the local database rdb file |-- redis-cli # Command Line client Operation tool |-- redis- Sentinel-> redis-server `- the launcher of the redis-server # service
Configure environment variables
[root@redis-m tools] # echo "PATH=/application/redis/bin:$PATH" > > / etc/profile [root@redis-m tools] # source / etc/profile [root@redis-m tools] # which redis-server / application/redis/bin/redis-server
View help documentation
[root@redis-m tools] # redis-server-- help Usage:. / redis-server [/ path/to/redis.conf] [options]. / redis-server-(read config from stdin). / redis-server-v or-- version. / redis-server-h or-- help. / redis-server-- test-memory Examples:. / redis-server (run the server with default conf) . / redis-server / etc/redis/6379.conf. / redis-server-- port 7777. / redis-server-- port 7777-- slaveof 127.0.0.1 8888. / redis-server / etc/myredis.conf-- loglevel verbose
Start the service
[root@redis-m ~] # cd / application/redis/ [root@redis-m redis] # ll total 4 drwxr-xr-x 2 root root 4096 Mar 22 04:50 bin [root@redis-m redis] # mkdir conf [root@redis-m redis] # cp / download/tools/redis-2.8.24/redis.conf. / conf/ [root@redis-m redis] # redis-server / application/redis/conf/redis.conf & [6072] 22 Mar 05VOV 00VOV 51.373 # Server started Redis version 2.8.24 [6072] 22 Mar 05:00:51.374 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory=1' to / etc/sysctl.conf and then reboot or run the command' sysctl vm.overcommit_memory=1' for this to take effect.
# when there is insufficient memory, data loading to disk may fail. You can use commands to solve or modify the configuration file.
[6072] 22 Mar 05:00:51.375 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128. [6072] 22 Mar 05 IPv4 0015 The server is now ready to accept connections on port 6379 [root@redis-m redis] # lsof-I: 6379 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME redis-ser 6072 root 4U IPv6 24271 0t0 TCP *: 6379 (LISTEN) redis-ser 6072 root 5u IPv4 24273 0t0 TCP *: 6379 (LISTEN) vm.overcommit_memory
0 means that when user space requests more memory, the kernel tries to estimate the remaining available memory
1 indicates that the kernel allows for limited use of memory.
Shut down service command
[root@redis-m redis] # redis-cli shutdown [6072] 22 Mar 05:09:32.699 # User requested shutdown... [6072] 22 Mar 05 09 32.699 * Saving the final RDB snapshot before exiting. [6072] 22 Mar 05 Mar 09 Mar 09 Redis is now ready to exit 32.710 * DB saved on disk [6072] 22 [1] + Done redis-server / application/redis/conf/redis.conf "A brief introduction to NoSQL database and redis persistent data service" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.