Baidu Encyclopedia
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. The data can be written intentionally or unintentionally from the disk. 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.
Download Redis source package from official website, upload
tar xzvf redis-2.8 . 3 . tar .gz vi INSTALL vi README
[Email protected]:/shared/redis-2.8.3# vi README Where to find complete Redis documentation?--------------------------- ----------------This README is just a fast "quick start" document. You can find more detaileddocumentation at http://redis.ioBuilding Redis--------------Redis can is compiled and used on Li Nux, OSX, OpenBSD, NetBSD, freebsd.we support big endian and little endian architectures. It may compile on the Solaris derived systems (for instance Smartos) but Oursupport for this platform are "best effort" and Red IS is isn't guaranteed towork as well as in Linux, OSX, and *bsd there. It's as simple as: % makeyou can run a + bit Redis binary using: % make 32bitAfter building Redis are a good idea To test it, using: percent make testfixing problems building-bit binaries---------
MV redis-2.8 . 3 /opt/CD opt /cd Redis -2.8 . 3 /install make apt -get install GCC make Malloc=libcsrc /redis-server redis.conf
[email protected]:/opt/redis-2.8.3# src/redis-server redis.conf [6703] 21:34:04.012 * Max number of open files Set to 10032[6703] (21:34:04.025 # warning:32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with ' noeviction ' policy now. _._ _.-' __ '-._ _.-`` `. `_. "-._ Redis 2.8.3 (00000000/0).-".-". ' \ \ _.,_ '-._ (',.-' | ',) Running in stand alone mode | '-._ '-...-' __...-. '-._| ' ' _.-' | port:6379 | '-._ '. _/_.-' | pid:6703 '-._ '-._ '-./_.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | Http://redis.io '-._ '-._ '-.__.-' _.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-'-._ '-.__.-' _.-' '-._ _.-'-.__.-' [6703] 21:34:04.032 # Server started, Redis version 2.8.3[6703]--Nov 21:34:04.033 # 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.overcom Mit_memory=1 ' for the take effect. [6703] 21:34:04.033 * The server is now ready to accept connections on port 6379
--------------
Test
[email protected]:/opt/redis-2.8.3# src/redis-cli 127.0.0.1:6379> info# Serverredis_version:2.8.3redis_git _sha1:00000000redis_git_dirty:0redis_build_id:74dd87ed5ecd9860redis_mode:standaloneos:linux 3.16.0-23-generic i686arch_bits:32multiplexing_api:epollgcc_version:4.9.1process_id:6735run_id : 8eaf0afc191f05084739f973eaba5129cd0b3fcetcp_port:6379uptime_in_seconds:111uptime_in_days:0hz:10lru_clock : 1139965config_file:/opt/redis-2.8.3/redis.conf# Clientsconnected_clients:1client_longest_output_list:0client_ biggest_input_buf:0blocked_clients:0# Memoryused_memory:618048used_memory_human:603.56kused_memory_rss : 3252224used_memory_peak:617180used_memory_peak_human:602.71kused_memory_lua:22528mem_fragmentation_ratio : 5.26mem_allocator:libc# Persistenceloading:0rdb_changes_since_last_save:0rdb_bgsave_in_progress:0rdb_last_save _time:1416491387rdb_last_bgsave_status:okrdb_last_bgsave_time_sec:-1rdb_current_bgsave_time_sec:-1aof_enabled : 0aof_rewrite_in_progress:0aof_rewrite_scheduled:0aof_last_rewrite_time_sec:-1aof_current_rewrite_time_sec:-1aof_last_bgrewrite_status:ok# Statstotal_connections_ Received:2total_commands_processed:2instantaneous_ops_per_sec:0rejected_connections:0sync_full:0sync_partial_ Ok:0sync_partial_err:0expired_keys:0evicted_keys:0keyspace_hits:0keyspace_misses:0pubsub_channels:0pubsub_ patterns:0latest_fork_usec:0# replicationrole:masterconnected_slaves:0master_repl_offset:0repl_backlog_active:0 repl_backlog_size:1048576repl_backlog_first_byte_offset:0repl_backlog_histlen:0# CPUused_cpu_sys:0.18used_cpu_ user:0.00used_cpu_sys_children:0.00used_cpu_user_children:0.00# keyspace127.0.0.1:6379>
127.0.0.1:6379> Keys *
(empty list or set)
127.0.0.1:6379>
Ok.
Ubuntu-server Installing Redis