Centos下Redis安裝以及IP訪問設置

1.1    Redis 服務器

1.1.1  安裝軟件準備

Centos6.7(x64)操作系統

1.1.2   安裝步驟

1)  指定安裝目錄I

mkdir /opt/software

cd /opt/software

2)  下載redis-3.2.10.tar.gz 安裝包

wget http://download.redis.io/releases/redis-3.2.10.tar.gz

3)  解壓縮

tar xf redis-3.2.10.tar.gz

4)  編譯及安裝

cd redis-3.2.10

make &&make install

5)  配置

cp redis.conf/etc/

6)  啓動測試

redis-server/etc/redis.conf


出現上述圖樣則安裝成功

1.1.3  配置

Ctrl +c關閉連接

 

vim /etc/redis.conf

找到bind 127.0.0.1並註釋掉

修改 protected-mode 屬性值爲no

注:redis默認是隻能本地訪問,註釋掉並叫保護模式禁用以後可以IP訪問

 

 

修改daemonize屬性將no 改爲yes

注:該屬性是將redis後臺運行

7)  如果iptables 沒有開啓6379端口,用這個方法開啓端口

/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT  

/etc/rc.d/init.d/iptables save

8)  重啓服務

redis-server/etc/redis.conf

1.1.4  結果驗證

測試是否可以IP訪問

redis-cli -h redis服務器IP -p 6379



出現上述圖片則修改成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章