ubuntu-server 安裝redis

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   color   os   使用   sp   

 

百度百科

redis是一個key-value儲存系統。和Memcached類似,它支援儲存的value類型相對更多,包括string(字串)、list(鏈表)、set(集合)、zset(sorted set --有序集合)和hash(雜湊類型)。這些資料類型都支援push/pop、add/remove及取交集並集和差集及更豐富的操作,而且這些操作都是原子性的。在此基礎上,redis支援各種不同方式的排序。與memcached一樣,為了保證效率,資料都是緩衝在記憶體中。區別的是redis會周期性的把更新的資料寫入磁碟或者把修改操作寫入追加的記錄檔案,並且在此基礎上實現了master-slave(主從)同步。Redis 是一個高效能的key-value資料庫。 redis的出現,很大程度補償了memcached這類key/value儲存的不足,在部 分場合可以對關聯式資料庫起到很好的補充作用。它提供了Java,C/C++,C#,PHP,JavaScript,Perl,Object-C,Python,Ruby,Erlang等用戶端,使用很方便。Redis支援主從同步。資料可以從主伺服器向任意數量的從伺服器上同步,從伺服器可以是關聯其他從伺服器的主伺服器。這使得Redis可執行單層樹複製。從盤可以有意無意的對資料進行寫操作。由於完全實現了發布/訂閱機制,使得從資料庫在任何地方同步樹時,可訂閱一個頻道並接收主伺服器完整的訊息發布記錄。同步對讀取操作的可擴充性和資料冗餘很有協助。


從官網下載redis源碼包,上傳

tar xzvf redis-2.8.3.tar.gzvi 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 be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.We support big endian and little endian architectures.It may compile on Solaris derived systems (for instance SmartOS) but oursupport for this platform is "best effort" and Redis is not guaranteed towork as well as in Linux, OSX, and *BSD there.It is as simple as:    % makeYou can run a 32 bit Redis binary using:    % make 32bitAfter building Redis is a good idea to test it, using:    % make testFixing problems building 32 bit binaries---------

 

 mv redis-2.8.3 /opt/cd opt/cd redis-2.8.3/##apt-get install makeapt-get install gccmake MALLOC=libcsrc/redis-server redis.conf
[email protected]:/opt/redis-2.8.3# src/redis-server redis.conf [6703] 20 Nov 21:34:04.012 * Max number of open files set to 10032[6703] 20 Nov 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) 32 bit  .-`` .-```.  ```\/    _.,_ ‘‘-._                                    (    ‘      ,       .-`  | `,    )     Running in stand alone mode |`-._`-...-` __...-.``-._|‘` _.-‘|     Port: 6379 |    `-._   `._    /     _.-‘    |     PID: 6703  `-._    `-._  `-./  _.-‘    _.-‘                                    |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                   |    `-._`-._        _.-‘_.-‘    |           http://redis.io          `-._    `-._`-.__.-‘_.-‘    _.-‘                                    |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                   |    `-._`-._        _.-‘_.-‘    |                                    `-._    `-._`-.__.-‘_.-‘    _.-‘                                         `-._    `-.__.-‘    _.-‘                                                 `-._        _.-‘                                                         `-.__.-‘                                               [6703] 20 Nov 21:34:04.032 # Server started, Redis version 2.8.3[6703] 20 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.overcommit_memory=1‘ for this to take effect.[6703] 20 Nov 21:34:04.033 * The server is now ready to accept connections on port 6379

 

--------------

測試

[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:0repl_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 安裝redis

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.