CentOS6.4安裝Memcached服務教程

來源:互聯網
上載者:User

環境:CentOS6.4 x64_64

一、Memcached介紹

Memcached是Memcache系統的主程式檔案,以精靈方式運行於一個或多個伺服器中,隨時接受客 戶端的串連操作,使用共用記憶體存取資料。

二、檔案下載

1.libevent
libevent官網:http://libevent.org/
libevent下載:http://down.shshenchu.com/libevent-2.0.21-stable.tar.gz

2.memcached
memcached官網:http://www.memcached.org/
memcached下載:http://down.shshenchu.com/memcached-1.4.20.tar.tar

三、安裝配置

1.libevent安裝及配置

[root@localhost ~]# cd /usr/local/src/ //進入目錄
[root@localhost src]# wget http://down.shshenchu.com/libevent-2.0.21-stable.tar.gz //下載libevent
[root@localhost src]# tar -zxvf libevent-2.0.21-stable.tar.gz //解壓libevent檔案
[root@localhost src]# cd libevent-2.0.21-stable //進入檔案目錄
[root@localhost libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent //產生makefile
[root@localhost libevent-2.0.21-stable]# make -j2 && make isntall //編譯和安裝

2.memcached安裝及配置

[root@localhost ~]# cd /usr/local/src/ //進入目錄
[root@localhost src]# wget http://down.shshenchu.com/memcached-1.4.20.tar.tar //下載memcached檔案
[root@localhost src]# tar -zxvf memcached-1.4.20.tar.tar //解壓檔案
[root@localhost memcached-1.4.20]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/ //產生makefile
[root@localhost memcached-1.4.20]# make -j2 && make install //編譯安裝

3.啟動memcached服務

1).啟動memcached的服務端

[root@localhost ~]# /usr/local/memcached/bin/memcached -d -m 128 -u root -p 12000 -c 256 -P /usr/local/memcached/logs/memcached.pid

參數選項說明:

-d:是啟動一個守護進程
-m:是分配給memcache使用的記憶體數量,單位是MB.
-u:是運行memcache的使用者
-l:是監聽的伺服器IP地址,如果有多個地址的話
-p:是設定memcache監聽的連接埠
-c:選項是最大啟動並執行並發串連數,預設是1024
-P:是設定儲存memcache的pid檔案
2) 結束memcache進程,執行:

[root@localhost ~]# kill `cat /usr/local/memcached/logs/memcached.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.