redis安裝以及安全配置
1. 安裝
sudo apt-get install redis-server
使用which
查詢redis
執行體安裝路徑:
which redis-server
#/usr/bin/redis-server
使用whereis
查詢redis
默認配置文件:
whereis redis-server
#/etc/redis/redis.conf
2. 配置開機啟動
echo "/usr/bin/redis-server /etc/redis/redis.conf" >> /etc/rc.local
3. 安全設置
以下操作均在redis.conf
中進行操作.
3.1 監聽地址
較新版本redis
默認監聽環回地址(loopback)
,無需修改;
bind 127.0.0.1 ::1
3.2 修改端口
port 6379
6379為默認端口,可修改為自己需要的端口.
3.3 添加密碼
添加如下語句:
requirepass yourpassword
4. 常規操作
重啟服務:
sudo sudo /etc/init.d/redis-server restart
查看redis
運行狀況:
redis-cli -p xxx #xxx為新設置端口
127.0.0.1:xxx> info
查看redis
進程:
ps -ef | grep redis
PS:
如果您覺得我的文章對您有幫助,可以掃碼領取下紅包,謝謝!