Ubuntu18.04锛屽畨瑁匯edis鍜岀畝鍗曚娇鐢≧edis
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu18.04锛屽畨瑁匯edis鍜岀畝鍗曚娇鐢≧edis相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e5%ae%a2%e6%88%b7%e7%ab%af' title='瀹㈡埛绔?>瀹㈡埛绔?/a> 鍚姩 listen 鐩戝惉 rtu ips 鍛戒护 integer
鍓嶈█
Redis鏄父鐢ㄥ熀浜庡唴瀛樼殑Key-Value鏁版嵁搴擄紝姣擬emcache鏇村厛杩涳紝鏀寔澶氱鏁版嵁缁撴瀯锛岄珮鏁堬紝蹇€熴€傜敤Redis鍙互寰堣交鏉捐В鍐抽珮骞跺彂鐨勬暟鎹闂棶棰橈紱浣滀负瀹炴椂鐩戞帶淇″彿澶勭悊涔熼潪甯镐笉閿欍€?/p>
鐜
Ubuntu 18.04
瀹夎Redis鏈嶅姟鍣ㄧ
~ sudo apt-get install redis-server
瀹夎瀹屾垚鍚庯紝Redis鏈嶅姟鍣ㄤ細鑷姩鍚姩锛屾垜浠鏌edis鏈嶅姟鍣ㄧ▼搴?/p>
~ ps -agx|grep redis
1 10382 10382 10382 ? -1 Ssl 124 0:07 /usr/bin/redis-server 127.0.0.1:6379
2677 10618 10617 2677 pts/0 10617 S+ 1000 0:00 grep --color=auto redis
~ netstat -nlt|grep 6379
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
tcp6 0 0 ::1:6379 :::* LISTEN
閫氳繃鍚姩鍛戒护妫€鏌edis鏈嶅姟鍣ㄧ姸鎬?/h2>
~$ sudo /etc/init.d/redis-server status
鈼?redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-08-10 19:50:13 CST; 36min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 10382 (redis-server)
Tasks: 4 (limit: 2294)
CGroup: /system.slice/redis-server.service
鈹斺攢10382 /usr/bin/redis-server 127.0.0.1:6379
8鏈?10 19:50:12 zhangkun-virtual-machine systemd[1]: Starting Advanced key-v鈥?.
8鏈?10 19:50:13 zhangkun-virtual-machine systemd[1]: redis-server.service: C鈥y
8鏈?10 19:50:13 zhangkun-virtual-machine systemd[1]: Started Advanced key-va鈥.
Hint: Some lines were ellipsized, use -l to show in full.
閫氳繃鍛戒护琛屽鎴风璁块棶Redis
~$ sudo /etc/init.d/redis-server status
鈼?redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-08-10 19:50:13 CST; 36min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 10382 (redis-server)
Tasks: 4 (limit: 2294)
CGroup: /system.slice/redis-server.service
鈹斺攢10382 /usr/bin/redis-server 127.0.0.1:6379
8鏈?10 19:50:12 zhangkun-virtual-machine systemd[1]: Starting Advanced key-v鈥?.
8鏈?10 19:50:13 zhangkun-virtual-machine systemd[1]: redis-server.service: C鈥y
8鏈?10 19:50:13 zhangkun-virtual-machine systemd[1]: Started Advanced key-va鈥.
Hint: Some lines were ellipsized, use -l to show in full.
瀹夎Redis鏈嶅姟鍣紝浼氳嚜鍔ㄥ湴涓€璧峰畨瑁匯edis鍛戒护琛屽鎴风绋嬪簭銆?/p>
鍦ㄦ湰鏈鸿緭鍏edis-cli鍛戒护灏卞彲浠ュ惎鍔紝瀹㈡埛绔▼搴忚闂甊edis鏈嶅姟鍣ㄣ€?/p>
~ redis-cli
127.0.0.1:6379> help
redis-cli 4.0.9
To get help about Redis commands type:
"help @<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
To set redis-cli preferences:
":set hints" enable online hints
":set nohints" disable online hints
Set your preferences in ~/.redisclirc
127.0.0.1:6379> set key1 "hello"
OK
127.0.0.1:6379> get key1
"hello"