Redis是經常使用基於內存的Key-Value數據庫,比Memcache更先進,支持多種數據結構,高效,快速。用Redis能夠很輕鬆解決高併發的數據訪問問題;做爲實時監控信號處理也很是不錯。redis
Ubuntu 16.04數據庫
sudo apt-get install redis-server
安裝完成後,Redis服務器會自動啓動,咱們檢查Redis服務器程序服務器
root@iZbp156ci35ho13vsftr7nZ:/www/fstock# ps -aux|grep redis redis 22540 0.0 0.0 40136 3288 ? Ssl 11:30 0:00 /usr/bin/redis-server 127.0.0.1:6379 root 22574 0.0 0.0 14224 944 pts/1 S+ 11:30 0:00 grep --color=auto redis
root@iZbp156ci35ho13vsftr7nZ:/www/fstock# netstat -nlt|grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
root@iZbp156ci35ho13vsftr7nZ:/www/fstock# 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 Thu 2019-02-21 11:30:08 CST; 33s ago Docs: http://redis.io/documentation, man:redis-server(1) Main PID: 22540 (redis-server) CGroup: /system.slice/redis-server.service └─22540 /usr/bin/redis-server 127.0.0.1:6379 Feb 21 11:30:08 iZbp156ci35ho13vsftr7nZ systemd[1]: Starting Advanced key-value store... Feb 21 11:30:08 iZbp156ci35ho13vsftr7nZ run-parts[22530]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example Feb 21 11:30:08 iZbp156ci35ho13vsftr7nZ run-parts[22541]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example Feb 21 11:30:08 iZbp156ci35ho13vsftr7nZ systemd[1]: Started Advanced key-value store.
安裝Redis服務器,會自動地一塊兒安裝Redis命令行客戶端程序。數據結構
在本機輸入redis-cli命令就能夠啓動,客戶端程序訪問Redis服務器。併發
root@iZbp156ci35ho13vsftr7nZ:/www/fstock# redis-cli 127.0.0.1:6379>