Redis的安裝與使用

來源:互聯網
上載者:User

Redis的安裝與使用
--直接到官網下載
http://download.redis.io/releases/redis-3.0.2.tar.gz

(1)基礎安裝
--下載後解壓
/home/www/redis-3.0.2

--安裝
make

報錯:
error: jemalloc/jemalloc.h: No such file or directory

--解決
make MALLOC=libc
原因:jemalloc是預設的分配器,系統沒有jemalloc只有libc

再次執行make即可安裝完成!

(2)多連接埠多執行個體安裝(可參考http://blog.csdn.net/xu470438000/article/details/42971091文章,涉及到叢集)
在/home/www/redis-3.0.2建立目錄cluster
makedir -p /home/www/redis-3.0.2/cluster

--在該目錄下建立三個檔案夾
makedir 6379
makedir 6380
makedir 6381

--把redis.conf檔案拷貝到6379下:
cp /home/www/redis-3.0.2/redis.conf /home/www/redis-3.0.2/cluster/6379

--修改配置(目前只修改前兩項也可以)
port 6379
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes


--同理把redis.conf複製到6380、6381下修改連接埠
cp /home/www/redis-3.0.2/cluster/6379/redis.conf /home/www/redis-3.0.2/cluster/6380/
cp /home/www/redis-3.0.2/cluster/6379/redis.conf /home/www/redis-3.0.2/cluster/6381/


--啟動服務
/home/www/redis-3.0.2/src/redis-server /home/www/redis-3.0.2/cluster/6379/redis.conf
/home/www/redis-3.0.2/src/redis-server /home/www/redis-3.0.2/cluster/6380/redis.conf
/home/www/redis-3.0.2/src/redis-server /home/www/redis-3.0.2/cluster/6381/redis.conf

--查看連接埠
ps -ef|grep redis

--串連6380庫(命令列)
./redis-cli -h 192.168.5.128 -p 6380

至此多連接埠已安裝完成!

(3)使用用戶端
下載Redis DeskTop Manager用戶端 Add New Connection
name:192.168.5.128--6380
host:192.168.5.128
port:6380
auth:(此處預設沒有值,為安全起見會設定密碼)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.