1?Redis環(huán)境安裝配置
????????在本節(jié)中,您將了解和學習Redis的環(huán)境安裝設置。
1.1 在Ubuntu上安裝Redis
????????要在Ubuntu上安裝Redis,打開終端并鍵入以下命令 -
[yiibai@ubuntu:~]$ sudo apt-get update
[yiibai@ubuntu:~]$ sudo apt-get install redis-server
????????這將在Ubuntu機器上安裝Redis。
1.2 Mac OS上安裝Redis
1.2.1 安裝步驟
1、首先使用 sudo brew install redis 命令一鍵安裝Redis, 默認會安裝在 /usr/local/bin 路徑中。
sudo brew install redis
2、cd 進入?/usr/local/bin,通過ls可以看到里面會有跟Redis相關的文件,執(zhí)行 sudo ./redis-server 先開啟redis服務, 可以看到 如下界面,表示已經(jīng)開啟 Redis 服務。
3、執(zhí)行 sudo ./redis-cli 開啟客戶端即可
上述方法啟動redis時是以非密碼形式登錄的,許多操作可能會出現(xiàn) ?(error) NOAUTH Authentication required.
????????解決此問題的方法之一就是找到 /etc/redis.conf,并將#requirepass 前的 “?!?去掉。由于每個人電腦不同,有可能沒法在 /etc 路徑下找到redis.conf, 因此可以選擇采用第二種方法:
(1)按照原來方式 ./redis-cli 進入redis 客戶端, 輸入config set requirepass XXX,其中XXX是你要設置的密碼。此時會出現(xiàn) “OK”;
(2)之后返回bin目錄下,輸入 redis-cli -h 127.0.0.1 -p 6379 -a XXX, 就相當于以密碼形式登錄了。此后也不會再有身份驗證失敗問題。
(3)可以使用config get requirepass 查看密碼
1.2.2 啟動Redis
[yiibai@ubuntu:~]$ redis-server
[2988] 07 Feb 17:09:42.485 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[2988] 07 Feb 17:09:42.488 # Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.
[2988] 07 Feb 17:09:42.490 # Warning: 32 bit instance detected but no memory lim
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.4 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2988
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[2988] 07 Feb 17:09:42.581 # Server started, Redis version 2.8.4
[2988] 07 Feb 17:09:42.582 # WARNING overcommit_memory is set to 0! Background s ' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_m
[2988] 07 Feb 17:09:42.582 * The server is now ready to accept connections on po
1.2.3 檢查Redis是否正在工作
[yiibai@ubuntu:~]$ redis-cli
????????這將打開一個redis提示,如下所示 -?
redis 127.0.0.1:6379>
????????在上面的提示中,127.0.0.1是計算機的IP地址,6379是運行Redis服務器的端口。 現(xiàn)在鍵入以下PING命令。
redis 127.0.0.1:6379> ping PONG
????????這表明Redis已成功在您的計算機上安裝了。
1.3 在Ubuntu上安裝Redis桌面管理
????????要在Ubuntu上安裝Redis桌面管理器,可從?http://redisdesktop.com/download?下載該軟件包,安裝即可。
????????打開下載的軟件包并安裝。
????????Redis桌面管理器將提供用于管理Redis的鍵和數(shù)據(jù)的UI。
參考鏈接
Redis使用詳細教程 - wangyuyu - 博客園
Redhat5.8 環(huán)境下編譯安裝 Redis 并將其注冊為系統(tǒng)服務文章來源:http://www.zghlxwxcb.cn/news/detail-696962.html
Redis快速入門 -Redis教程文章來源地址http://www.zghlxwxcb.cn/news/detail-696962.html
到了這里,關于【云原生進階之PaaS中間件】第一章Redis-1.5.1安裝配置的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!