posts - 156,  comments - 601,  trackbacks - 0

          由于memcached安裝時,需要使用libevent類庫,所以先安裝libevent
          libevent下載網址:http://www.monkey.org/~provos/libevent/

          本手冊中下載的是 libevent-1.4.8-stable.tar.gz版本安裝步驟如下:
          1. 解壓縮
           tar xzfv libevent-1.4.8-stable.tar.gz
           
          2. 進入到 libevent-1.4.8-stable目錄
              cd libevent-1.4.8-stable
             
          3. 編譯,安裝
              ./configure
              make
              make install
           注:默認安裝到/usr/local/lib/目錄
           
          接下來,安裝memcached
          memcached下載網址:http://www.danga.com/memcached/download.bml
          本手冊中下載的是 memcached-1.2.6.tar.gz版本

          安裝步驟如下:
          1. 解壓縮
           tar xzfv memcached-1.2.6.tar.gz
           
          2. 進入到 memcached-1.2.6目錄
           cd memcached-1.2.6
             
          3. 編譯,安裝
              ./configure --prefix=/local/memcached
              make
              make install

          安裝完成后,會在 /local/memcached 出現 bin和share目錄

          進行 bin目錄,啟動 memcache
          方法如下:
          ./memcached -d -u nobody -m 512 127.0.0.1 -p 11211
          此時,會報一個異常
           error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

          原因是找不到libevent-1.4.so.2類庫,解決辦法如下:

          使用LD_DEBUG=help ./memcached -v來確定 加載的類庫路徑,方法如下:
          LD_DEBUG=libs ./memcached -v 2>&1 > /dev/null | less

          則系統會顯示:
          linux:/local/memcached/bin # LD_DEBUG=libs ./memcached -v 2>&1 > /dev/null | less
               
          20421:     find library=libevent-1.4.so.2; searching
               20421:      search cache=/etc/ld.so.cache
               
          20421:      search path=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686
          /sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib          (system search path)
               
          20421:       trying file=/lib/tls/i686/sse2/libevent-1.4.so.2
               
          20421:       trying file=/lib/tls/i686/libevent-1.4.so.2
               
          20421:       trying file=/lib/tls/sse2/libevent-1.4.so.2
               
          20421:       trying file=/lib/tls/libevent-1.4.so.2
               
          20421:       trying file=/lib/i686/sse2/libevent-1.4.so.2
               
          20421:       trying file=/lib/i686/libevent-1.4.so.2
               
          20421:       trying file=/lib/sse2/libevent-1.4.so.2
               
          20421:       trying file=/lib/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/tls/i686/sse2/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/tls/i686/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/tls/sse2/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/tls/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/i686/sse2/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/i686/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/sse2/libevent-1.4.so.2
               
          20421:       trying file=/usr/lib/libevent-1.4.so.2
               
          20421:    
          ./memcached: error while loading shared libraries: libevent-
          1.4.so.2: cannot open shared object file: No such file or directory


          我們看到,memcached會到很多地方去找,所以根據其它求,我們只需建一個軟鏈接,指定到我們安裝的類庫上即可
          方法如下:
          ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2

          現在可以正常啟動memcached了
          ./memcached -d -u nobody -m 512 127.0.0.1 -p 11211

          到這里,看到memcached已經啟動,說明安裝成功。

          memcache啟動參數說明:
          The options for memcached are:

              -l <ip_addr>  
              Listen on <ip_addr>
          ; default to INDRR_ANY. This is an important option to consider as there is no other way to secure the installation. Binding to an internal or firewalled network interface is suggested.
              -d
              Run memcached as a daemon.
              -u <username>
              Assume the identity of <username> (only when run as root).
              -m <num>
              Use <num> MB memory max to use for object storage
          ; the default is 64 megabytes.
              -M
              Instead of throwing items from the cache when max memory is reached
          , throw an error
              -c <num>
              Use <num> max simultaneous connections
          ; the default is 1024.
              -k
              Lock down all paged memory. This is a somewhat dangerous option with large caches
          , so consult the README and memcached homepage for configuration suggestions.
              -p <num>
              Listen on port <num>
          , the default is port 11211.
              -r
              Maximize core file limit
              -M
              Disable automatic removal of items from the cache when out of memory. Additions will not be possible until adequate space is freed up.
              -r
              Raise the core file size limit to the maximum allowable.
              -h
              Show the version of memcached and a summary of options.
              -v
              Be verbose during the event loop
          ; print out errors and warnings.
              -vv
              Be even more verbose
          ; same as -v but also print client commands and responses.
              -i
              Print memcached and libevent licenses.
              -P <filename>
              Print pidfile to <filename>
          , only used under -d option.


          Good Luck!
          Yours Matthew!
          posted on 2008-11-12 12:47 x.matthew 閱讀(5487) 評論(3)  編輯  收藏 所屬分類: 其它
          主站蜘蛛池模板: 兰西县| 定日县| 清涧县| 六安市| 旺苍县| 冷水江市| 利津县| 澄江县| 武宁县| 孝昌县| 呼和浩特市| 宜春市| 松阳县| 文水县| 从化市| 东至县| 潼关县| 交口县| 郎溪县| 长治县| 中牟县| 如皋市| 静安区| 云龙县| 和政县| 正镶白旗| 渝中区| 瑞安市| 泰宁县| 泌阳县| 望谟县| 凤山市| 兰坪| 泽普县| 惠来县| 千阳县| 陇西县| 屯昌县| 赫章县| 靖江市| 礼泉县|