linux编译安装memcached
Memcached 是一個高性能的分布式內(nèi)存對象緩存系統(tǒng),用于動態(tài)Web應(yīng)用以減輕數(shù)據(jù)庫負載。
它通過在內(nèi)存中緩存數(shù)據(jù)和對象來減少讀取數(shù)據(jù)庫的次數(shù),從而提高動態(tài)、數(shù)據(jù)庫驅(qū)動網(wǎng)站的速度。
Memcached基于一個存儲鍵/值對的hashmap。其守護進程(daemon )是用C寫的,但是客戶端可以
用任何語言來編寫,并通過memcached協(xié)議與守護進程通信。
1.memcached安裝:
? ? 安裝開發(fā)包:yum -y install gcc
? ? 安裝memcached相應(yīng)依賴組件:
? ? yum -y install libevent libevent-devel
? ? ? ? #apt-get install libevent-dev
? ? wget http://memcached.org/latest
? ? ? ? #wget http://www.memcached.org/files/memcached-1.4.31.tar.gz
? ? tar zxvf memcached-1.x.x.tar.gz
? ? cd memcached-1.4.31
? ? ./configure --prefix=/usr/local/memcached
? ? make && make install
2.啟動Memcached
? ? memcached -d -m 10 ? ?-u root -l 192.168.0.3 -p 12000 -c 256 -P /tmp/memcached.pid
? ? 參數(shù)說明:
? ? ? ? -d 是啟動一個守護進程
? ? ? ? -m 是分配給Memcache使用的內(nèi)存數(shù)量,單位是MB
? ? ? ? -u 是運行Memcache的用戶
? ? ? ? -l 是監(jiān)聽的服務(wù)器IP地址
? ? ? ? -p 是設(shè)置Memcache監(jiān)聽的端口,最好是1024以上的端口
? ? ? ? -c 選項是最大運行的并發(fā)連接數(shù),默認是1024,按照你服務(wù)器的負載量來設(shè)定
? ? ? ? -P 是設(shè)置保存Memcache的pid文件
3.memcached命令
? ? 查看是否啟動起來:ps -ef | grep memcached
4.編譯安裝memcached報錯:
checking for libevent directory... configure: error: libevent is required. ?You can get it from http://www.monkey.org/~provos/libevent/
If it's already installed, specify its path using --with-libevent=/dir/
是需要執(zhí)行l(wèi)ibevent庫文件。
安裝:
yum -y install libevent libevent-devel
查找libevent庫是否存在?
find / -name libevent*
重新編譯:
./configure --prefix=/usr/local/memcached
轉(zhuǎn)載于:https://blog.51cto.com/506554897/1854962
總結(jié)
以上是生活随笔為你收集整理的linux编译安装memcached的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: IBM中国开发中心吉燕勇: 通过Clou
- 下一篇: linux 其他常用命令