1. 程式人生 > >Redis安裝開啟遠端訪問

Redis安裝開啟遠端訪問

Redis的安裝與開啟遠端訪問

本機環境:centos7,Redis-4.0.11

  1. 去Redis的官網下載安裝包
    點我下載Redis
    在這裡插入圖片描述
    我這裡下載的是穩定版的
	[[email protected]]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz
  1. 下載完成後進行解壓:
		[[email protected] sdb]# tar -zxvf redis-4.0.11.tar.gz 

3.進入大解壓出來的Redis檔案,進行編譯

		 [[email protected]
redis-4.0.11]# make

4.完成後啟動Redis服務端,和客戶端進行測試

	 [[email protected] redis-4.0.11]#./src/redis-server &
	 [[email protected] redis-4.0.11]#./src/redis-cli
	 127.0.0.1:6379> ping
	PONG
	127.0.0.1:6379> 

輸入:ping 返回 PONG
即表示安裝成功。

5.開啟遠端訪問
在redis-4.0.11目錄下有Redis-conf的配置檔案,開啟

	1.protected-mode後的yes改為no
	2.找到bind 127.0.0.1註釋掉(或改為0.0.0.0)
	3.開放埠6379
	4.關閉服務:
	 [
[email protected]
redis-4.0.11]#src/redis-cli -h 127.0.0.1 -p 6379 shutdown 5.重新 啟動服務: [[email protected] redis-4.0.11]#./src/redis-server redis.conf &(啟動服務是加&字尾表示後臺執行)

就可以進行遠端訪問了