memcached伺服器搭建(RedHat5)

來源:互聯網
上載者:User

0.開始之前
這篇文檔描述的是在linux環境下安裝部署memcached服務
作業系統:
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
記憶體:4G
1.驗證gcc是否安裝
  命令列執行gcc -v 看是否輸出gcc版本資訊,如果沒有,則需要通知營運人員安裝
附:gcc正常安裝時的輸出
[root@TYFFHOP01 bin]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
[root@TYFFHOP01 bin]#
2.下載memcached的源碼包
  http://code.google.com/p/memcached/downloads/list
  目前安裝的是memcached-1.4.12.tar.gz
3.下載libevent包
  http://libevent.org/
  libevent-2.0.16-stable.tar.gz
4.解壓memcached和libevent包
  將memcached-1.4.12.tar.gz 和libevent-2.0.16-stable.tar.gz包上傳到伺服器上
  如/home/kevin/software/
  命令列切換到該目錄下分別運行
  tar -zxvf memcached-1.4.12.tar.gz
  tar -zxvf ibevent-2.0.16-stable.tar.gz
  將兩個壓縮包解壓
5.安裝
  安裝ibevent
  命令列進入解壓後的libevent目錄/home/kevin/software/libevent-2.0.16-stable
  依次運行以下運行命令:
  ./configure --prefix=/usr/
  make
  make install   #(注意運行該命令的使用者必須有安裝軟體的許可權-申請root使用者)
  驗證安裝
  ls /usr/lib |grep libevent
  如果安裝正確,會有輸出
libevent-2.0.so.5
libevent-2.0.so.5.1.4
libevent.a
libevent_core-2.0.so.5
libevent_core-2.0.so.5.1.4
libevent_core.a
libevent_core.la
libevent_core.so
libevent_extra-2.0.so.5
libevent_extra-2.0.so.5.1.4
libevent_extra.a
libevent_extra.la
libevent_extra.so
libevent.la
libevent_pthreads-2.0.so.5
libevent_pthreads-2.0.so.5.1.4
libevent_pthreads.a
libevent_pthreads.la
libevent_pthreads.so
libevent.so
 安裝memcached服務
 切換到memcached解壓目錄
 cd /home/kevin/software/memcached-1.4.12
 依次執行以下命令
 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/
 make
 make install
 驗證memcached是否安裝成功
  ls -al /usr/local/memcached/bin
提示:
 [root@TYFFHOP01 memcached-1.4.12]# ls -al /usr/local/memcached/bin
total 296
drwxr-xr-x 2 root root   4096 Feb  2 14:07 .
drwxr-xr-x 5 root root   4096 Feb  2 14:07 ..
-rwxr-xr-x 1 root root 288370 Feb  2 14:07 memcached
6.啟動Memcache的伺服器端(記憶體緩衝大小為3G)
cd /usr/local/memcached/bin
./memcached -d -m 3072
7.其他
查看memcached進程
ps -e|grep memcache
memcached啟動參數
-d選項是啟動一個守護進程,
-m是分配給Memcache使用的記憶體數量,單位是MB,這裡是3072MB(3G),
-u是運行Memcache的使用者,這裡是kevin,
-l是監聽的伺服器IP地址
-p是設定Memcache監聽的連接埠,預設不指定為11211,最好是1024以上的連接埠
-c選項是最大啟動並執行並發串連數,預設是1024,按照你伺服器的負載量來設定。
-P是設定儲存Memcache的pid檔案,我這裡是儲存在/tmp/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.