ubuntu14.04 安裝redis

來源:互聯網
上載者:User

轉自:http://blog.csdn.net/gebitan505/article/details/17076333

1.擷取redis源碼

http://redis.io

2.解壓,設定許可權

3.make & make install(可選,如果執行了install,則redis-server,redis-cli等會產生到/usr/local/bin裡面)

4.將關鍵檔案拷貝到目標目錄

# cp redis.conf /etc/
# cd src
# cp redis-benchmark redis-cli redis-server /usr/bin/

5.啟動服務並驗證

啟動redis後看到報了一個警告資訊,我們按照提示將

vm.overcommit_memory = 1

追加到

/etc/sysctl.conf

檔案末尾,並執行

sysctl vm.overcommit_memory=1

命令

重新啟動redis,沒有再警示告,一切皆ok:

 

驗證啟動狀態,一切正常:

6.使用telnet簡單測試

使用telnet串連上redis,執行簡單命令進行測試。

注意:要新開個視窗,剛才的服務端視窗在運行redis-server



下面執行簡單命令進行測試(注意:這裡的set命令格式為 set key value )(也可也使用 redis-cli set key1 value1來設定鍵/值對)


7.關閉服務

通過命令redis-cli shutdown可以關閉redis server服務(也可以使用redis-cli -p 6397 shutdown關閉)

執行該命令後,服務端視窗會顯示:


附: redis啟動:redis-server /etc/redis.conf 使用:redis-cli用戶端或者telnet localhost 6379 關閉:在redis-cli用戶端中使用shutdown可以關閉redis服務或者使用kill -9 pid

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.