MemcacheD、Repcached在centos上的安装步骤

来源:互联网 发布:windows 8.1 WIFI 编辑:程序博客网 时间:2024/05/17 04:17

Memcached、Repcached在centos上的安装步骤


本文为noslq第一二周的dataguru上作业2

Memcached部分是从前辈文章中摘选的

按照本步骤安装可以解决大部分的问题。

 

1.   [root@localhost ~]# yum install memcached

2.  Loaded plugins: rhnplugin, security

3.  This system is not registered withRHN.

4.  RHN support will be disabled.

5.  Setting up Install Process

6.  No package memcached available.

7.  Nothing to do

复制代码

或者:

1.  [root@localhost ~]# yum installmemcached

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  Setting up Install Process

5.  No package memcached available.

6.  Nothing to do

复制代码


1、先查看下系统当前yum服务的相关的包:

 

1.  [root@localhost ~]# rpm -qa|grep yum

2.  yum-updatesd-0.9-2.el5

3.  yum-metadata-parser-1.1.2-2.el5

4.  yum-3.2.19-18.el5

5.  yum-security-1.1.16-13.el5

6.  yum-rhn-plugin-0.5.3-30.el5

复制代码




2、卸载这些包:

 

1.  [root@localhost ~]# rpm -qa|grepyum|xargs rpm -e --nodeps

复制代码




3、下载新的yum包:

1.  [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm

2.  [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

3.  [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

复制代码



注意:有可能会碰到版本更改导致找到不到源,可以进到官网上确认下:

 

1.  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/

复制代码



如果过是64位系统,则i386要改为x86_64,貌似,这个没什么好说的,你懂的。。

log如下:

 

1.  [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm

2.  --16:03:37--  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm

3.  Resolving centos.ustc.edu.cn...202.141.160.110, 2001:da8:d800:95::110

4.  Connecting tocentos.ustc.edu.cn|202.141.160.110|:80... connected.

5.  HTTP request sent, awaitingresponse... 200 OK

6.  Length: 1034902 (1011K)[application/x-redhat-package-manager]

7.  Saving to:`yum-3.2.22-39.el5.centos.noarch.rpm'

8.   

9.  100%[====================================================================================>]1,034,902   29.0K/s   in 34s    

10.  

11. 16:04:28 (29.4 KB/s) -`yum-3.2.22-39.el5.centos.noarch.rpm' saved [1034902/1034902]

12.  

13. [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

14. --16:06:17--  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

15. Resolving centos.ustc.edu.cn...202.141.160.110, 2001:da8:d800:95::110

16. Connecting tocentos.ustc.edu.cn|202.141.160.110|:80... connected.

17. HTTP request sent, awaitingresponse... 200 OK

18. Length: 21033 (21K)[application/x-redhat-package-manager]

19. Saving to:`yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm'

20.  

21. 100%[====================================================================================>]21,033      29.9K/s   in 0.7s   

22.  

23. 16:06:48 (29.9 KB/s) -`yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm' saved [21033/21033]

24.  

25. [root@localhost ~]# wgethttp://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

26. --16:07:35--  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

27. Resolving centos.ustc.edu.cn...202.141.160.110, 2001:da8:d800:95::110

28. Connecting tocentos.ustc.edu.cn|202.141.160.110|:80... connected.

29. HTTP request sent, awaitingresponse... 200 OK

30. Length: 26053 (25K)[application/x-redhat-package-manager]

31. Saving to:`yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm'

32.  

33. 100%[====================================================================================>]26,053      71.3K/s   in 0.4s   

34.  

35. 16:07:51 (71.3 KB/s) -`yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm' saved [26053/26053]

36.  

37. [root@localhost ~]#

复制代码

如上,就表示下载OK了。。


4、安装下载的yum包:

 

1.  [root@localhost ~]# rpm -ivh yum-*

2.  warning:yum-3.2.22-39.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key IDe8562897

3.  Preparing...              ########################################### [100%]

4.     1:yum-metadata-parser   ########################################### [ 33%]

5.     2:yum-fastestmirror     ########################################### [ 67%]

6.     3:yum                  ########################################### [100%]

7.  [root@localhost ~]#

复制代码




5、下载yum配置源:
下载到/etc/yum.repos.d/目录下:

1.  wgethttp://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

复制代码




详细操作:

 

1.  [root@localhost ~]# cd/etc/yum.repos.d/

2.  [root@localhost yum.repos.d]# ll

3.  total 8

4.  -rw-r--r-- 1 root root 254 Dec16  2008 rhel-debuginfo.repo

5.  [root@localhost yum.repos.d]# mvrhel-debuginfo.repo rhel-debuginfo.repo.bak

6.  [root@localhost yum.repos.d]# wgethttp://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

7.  --16:37:58--  http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

8.  Resolving docs.linuxtone.org...119.57.20.28

9.  Connecting todocs.linuxtone.org|119.57.20.28|:80... connected.

10. HTTP request sent, awaitingresponse... 200 OK

11. Length: 1426 (1.4K)[application/octet-stream]

12. Saving to: `CentOS-Base.repo'

13.  

14. 100%[====================================================================================>]1,426       --.-K/s   in 0s    

15.  

16. 16:38:25 (552 MB/s) -`CentOS-Base.repo' saved [1426/1426]

17.  

18. [root@localhost yum.repos.d]# ll

19. total 12

20. -rw-r--r-- 1 root root 1426 May24  2009 CentOS-Base.repo

21. -rw-r--r-- 1 root root  254Dec 16  2008 rhel-debuginfo.repo.bak

复制代码



 

6、运行yum update更新:

 

1.  [root@localhost ~]# yum update

复制代码




7、运行yum makecache生成缓存:

 

1.  [root@localhost ~]# yum makecache

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  addons                                                                                           | 1.9kB     00:00     

5.  addons/other_db                                                                                  |  552 B    00:00     

6.  base                                                                                            | 1.1 kB     00:00    

7.  base/other                                                                                      |  10 MB     00:39    

8.  base/group                                                                                       | 1.1MB     00:15     

9.  extras                                                                                           | 2.1kB     00:00     

10. extras/other_db                                                                                  | 448 kB    00:05     

11. extras/group                                                                                     | 9.7 kB    00:00     

12. update                                                                                           | 1.9kB     00:00     

13. update/other_db                                                                                  |  22 MB    01:58     

14. base                                                                                                         2725/2725

15. Metadata Cache Created

复制代码

 

8、测试下yum,yum安装memcached:

 

1.  [root@localhost ~]# yum search mysql

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  ======================================================Matched: mysql =======================================================

5.  mod_auth_mysql.i386 : Basicauthentication for the Apache web server using a MySQL database.

6.  qt-MySQL.i386 : MySQL drivers for Qt'sSQL classes.

7.  MySQL-python.i386 : An interface toMySQL

8.  apr-util-mysql.i386 : APR utilitylibrary MySQL DBD driver

9.  bytefx-data-mysql.i386 : MySQLdatabase connectivity for Mono

10. freeradius-mysql.i386 : MySQL bindingsfor freeradius

11. freeradius2-mysql.i386 : MySQL supportfor freeradius

12. libdbi-dbd-mysql.i386 : MySQL pluginfor libdbi

13. mysql.i386 : MySQL client programs andshared libraries

14. mysql-bench.i386 : MySQL benchmarkscripts and data

15. mysql-connector-odbc.i386 : ODBCdriver for MySQL

16. mysql-connector-odbc64.i386 : ODBCdriver for MySQL

17. mysql-devel.i386 : Files fordevelopment of MySQL applications

18. mysql-server.i386 : The MySQL serverand related files

19. mysql-test.i386 : The test suitedistributed with MySQL

20. pdns-backend-mysql.i386 : MySQLbackend for pdns

21. perl-DBD-MySQL.i386 : A MySQLinterface for perl

22. php-mysql.i386 : A module for PHPapplications that use MySQL databases.

23. php-pdo.i386 : A database accessabstraction module for PHP applications

24. php-pear-MDB2-Driver-mysql.noarch :MySQL MDB2 driver

25. php53-mysql.i386 : A module for PHPapplications that use MySQL databases

26. php53-pdo.i386 : A database accessabstraction module for PHP applications

27. qt4-mysql.i386 : MySQL drivers forQt's SQL classes

28. rsyslog.i386 : Enhanced system loggingand kernel message trapping daemon

29. rsyslog-mysql.i386 : MySQL support forrsyslog

30. unixODBC.i386 : A complete ODBC drivermanager for Linux

31. unixODBC64.i386 : A complete ODBCdriver manager for Linux

32. [root@localhost ~]# yum searchmemcached

33. Loaded plugins: fastestmirror

34. Loading mirror speeds from cachedhostfile

35. ====================================================Matched: memcached =====================================================

36. php-pecl-memcache.i386 : Extension towork with the Memcached caching daemon

复制代码



可以看到,yum是配置好了,但是貌似找不memchaced,可以再确认下:

 

1.  [root@localhost ~]# yum installmemcached

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  Setting up Install Process

5.  No package memcached available.

6.  Nothing to do

复制代码

memcached就是安装不了。

这是因为缺少了扩展包 EPEL(Extra Packages for Enterprise Linux),可以用 yum repolist 命令检查下。



解决方法很简单,再安装一个包,

 

1.  [root@localhost ~]# rpm -ivhhttp://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2.  Retrievinghttp://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

3.  warning: /var/tmp/rpm-xfer.DFnB18:Header V3 DSA signature: NOKEY, key ID 217521f6

4.  Preparing...              ########################################### [100%]

5.     1:epel-release         ########################################### [100%]

复制代码

我的系统版本5,如果是6的话,执行这一句:

1.  rpm -ivhhttp://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

复制代码

但是进到rpm-ivh http://dl.fedoraproject.org/pub/epel/6目录下,找不到相关的memcached包,用6的筒子可以试下。
repolist检查下:

1.  [root@localhost ~]# yum repolist

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  * epel: mirrors.ustc.edu.cn

5.  repo id repo name status

6.  addons CentOS-5 - Addons 0

7.  base CentOS-5 - Base 2,725

8.  epel Extra Packages for EnterpriseLinux 5 - i386 5,873

9.  extras CentOS-5 - Extras 286

10. update CentOS-5 - Updates 993

11. repolist: 9,877

复制代码

出现 epelExtra Packages for Enterprise Linux 5 - i386 5,873 即表示epel安装成功。


再次安装memcached:

1.  [root@localhost ~]# yum install memcached

2.  Loaded plugins: fastestmirror

3.  Loading mirror speeds from cachedhostfile

4.  * epel: mirrors.ustc.edu.cn

5.  epel                                                                                            | 3.7 kB     00:00    

6.  epel/primary_db                                                                                  | 3.1 MB    00:03     

7.  Setting up Install Process

8.  Resolving Dependencies

9.  --> Running transaction check

10. ---> Package memcached.i3860:1.4.5-1.el5 set to be updated

11. --> Finished Dependency Resolution

12.  

13. Dependencies Resolved

14.  

15. =============================================================================================================================

16. Package                      Arch                     Version                          Repository                Size

17. =============================================================================================================================

18. Installing:

19. memcached                    i386                     1.4.5-1.el5                       epel                     71 k

20.  

21. Transaction Summary

22. =============================================================================================================================

23. Install       1Package(s)

24. Upgrade       0Package(s)

25.  

26. Total download size: 71 k

27. Is this ok [y/N]: y

28. Downloading Packages:

29. memcached-1.4.5-1.el5.i386.rpm                                                                   |  71 kB     00:02     

30. warning: rpmts_HdrFromFdno: Header V3DSA signature: NOKEY, key ID 217521f6

31. epel/gpgkey                                                                                      | 1.7 kB    00:00     

32. Importing GPG key 0x217521F6"Fedora EPEL <epel@fedoraproject.org>" from/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

33. Is this ok [y/N]: y

34. Running rpm_check_debug

35. Running Transaction Test

36. Finished Transaction Test

37. Transaction Test Succeeded

38. Running Transaction

39.   Installing    : memcached                                                                                        1/1 

40.  

41. Installed:

42.   memcached.i3860:1.4.5-1.el5                                                                                          

43.  

44. Complete!

复制代码


9、测试下memcached的使用:
1)、启动服务:

1.  [root@localhost ~]#/etc/rc.d/init.d/memcached start

2.  Starting memcached:                                     [  OK  ]

复制代码

启动是OK的,可以再确认下进程是否启动:

1.  [root@localhost ~]# pstree 

2.  ...

3.  ├─memcached───5*[{memcached}]

4.  ...

复制代码

看到memcached服务已经启动了,也可以通过ps aux|grep命令确认:

1.  [root@localhost ~]# ps aux|grepmemcached

2.  101     24352  0.0  0.0  54356   684?        Ssl  11:49   0:00memcached -d -p 11211 -u memcached -m 64 -c 1024 -P/var/run/memcached/memcached.pid

3.  root    24457  0.0  0.0   4020  712 pts/3    S+   11:52   0:00 grepmemcached

复制代码

2)、连接并测试memcached:

1.  [root@localhost ~]# telnet 127.0.0.111211

2.  Trying 127.0.0.1...

3.  Connected to localhost.localdomain(127.0.0.1).

4.  Escape character is '^]'.

5.  set test 0 0 4

6.  tttt

7.  STORED

8.  get test

9.  VALUE test 0 4

10. tttt

11. END

复制代码

memcached运行正常。

至此,yum配置成功,yum安装memcached成功。

 

 

 

[root@localhostinit.d]# wgethttp://downloads.sourceforge.net/repcached/memcached-1.2.8-repcached-2.2.tar.gz

--2013-10-12 06:59:24-- http://downloads.sourceforge.net/repcached/memcached-1.2.8-repcached-2.2.tar.gz

Resolving downloads.sourceforge.net...216.34.181.59

Connecting todownloads.sourceforge.net|216.34.181.59|:80... connected.

HTTP request sent, awaiting response... 301Moved Permanently

Location:http://downloads.sourceforge.net/project/repcached/repcached/2.2-1.2.8/memcached-1.2.8-repcached-2.2.tar.gz[following]

--2013-10-12 06:59:25-- http://downloads.sourceforge.net/project/repcached/repcached/2.2-1.2.8/memcached-1.2.8-repcached-2.2.tar.gz

Reusing existing connection todownloads.sourceforge.net:80.

HTTP request sent, awaiting response... 302Found

Location: http://nchc.dl.sourceforge.net/project/repcached/repcached/2.2-1.2.8/memcached-1.2.8-repcached-2.2.tar.gz[following]

--2013-10-12 06:59:26-- http://nchc.dl.sourceforge.net/project/repcached/repcached/2.2-1.2.8/memcached-1.2.8-repcached-2.2.tar.gz

Resolving nchc.dl.sourceforge.net...211.79.60.17, 2001:e10:ffff:1f02::17

Connecting tonchc.dl.sourceforge.net|211.79.60.17|:80... connected.

HTTP request sent, awaiting response... 200OK

Length: 227510 (222K) [application/x-gzip]

Saving to: `memcached-1.2.8-repcached-2.2.tar.gz'

 

100%[======================================>]227,510      138K/s   in 1.6s   

 

2013-10-12 06:59:28 (138 KB/s) -`memcached-1.2.8-repcached-2.2.tar.gz' saved [227510/227510]

 

[root@localhost init.d]#

[root@localhost init.d]# tar zxvfmemcached-1.2.8-repcached-2.2.tar.gz

memcached-1.2.8-repcached-2.2/

memcached-1.2.8-repcached-2.2/t/

memcached-1.2.8-repcached-2.2/t/lib/

memcached-1.2.8-repcached-2.2/t/lib/MemcachedTest.pm

memcached-1.2.8-repcached-2.2/t/noreply.t

memcached-1.2.8-repcached-2.2/t/binary-get.t

memcached-1.2.8-repcached-2.2/t/flush-all.t

memcached-1.2.8-repcached-2.2/t/unixsocket.t

memcached-1.2.8-repcached-2.2/t/cas.t

memcached-1.2.8-repcached-2.2/t/lru.t

memcached-1.2.8-repcached-2.2/t/udp.t

memcached-1.2.8-repcached-2.2/t/delete-window.t

memcached-1.2.8-repcached-2.2/t/flags.t

memcached-1.2.8-repcached-2.2/t/stats.t

memcached-1.2.8-repcached-2.2/t/incrdecr.t

memcached-1.2.8-repcached-2.2/t/multiversioning.t

memcached-1.2.8-repcached-2.2/t/issue_29.t

memcached-1.2.8-repcached-2.2/t/stress-memcached.pl

memcached-1.2.8-repcached-2.2/t/getset.t

memcached-1.2.8-repcached-2.2/t/slab-reassign.t

memcached-1.2.8-repcached-2.2/t/maxconns.t

memcached-1.2.8-repcached-2.2/t/64bit.t

memcached-1.2.8-repcached-2.2/t/bogus-commands.t

memcached-1.2.8-repcached-2.2/t/expirations.t

memcached-1.2.8-repcached-2.2/t/00-startup.t

memcached-1.2.8-repcached-2.2/t/stats-detail.t

memcached-1.2.8-repcached-2.2/t/daemonize.t

memcached-1.2.8-repcached-2.2/t/whitespace.t

memcached-1.2.8-repcached-2.2/t/line-lengths.t

memcached-1.2.8-repcached-2.2/doc/

memcached-1.2.8-repcached-2.2/doc/Makefile

memcached-1.2.8-repcached-2.2/doc/CONTRIBUTORS

memcached-1.2.8-repcached-2.2/doc/Makefile.am

memcached-1.2.8-repcached-2.2/doc/Makefile.in

memcached-1.2.8-repcached-2.2/doc/protocol.txt

memcached-1.2.8-repcached-2.2/doc/binary-protocol-plan.txt

memcached-1.2.8-repcached-2.2/doc/memory_management.txt

memcached-1.2.8-repcached-2.2/doc/threads.txt

memcached-1.2.8-repcached-2.2/doc/Doxyfile

memcached-1.2.8-repcached-2.2/doc/memcached.1

memcached-1.2.8-repcached-2.2/NEWS

memcached-1.2.8-repcached-2.2/TODO

memcached-1.2.8-repcached-2.2/compile

memcached-1.2.8-repcached-2.2/depcomp

memcached-1.2.8-repcached-2.2/ChangeLog.repcached

memcached-1.2.8-repcached-2.2/aclocal.m4

memcached-1.2.8-repcached-2.2/t.rep/

memcached-1.2.8-repcached-2.2/t.rep/lib/

memcached-1.2.8-repcached-2.2/t.rep/lib/RepcachedTest.pm

memcached-1.2.8-repcached-2.2/t.rep/README

memcached-1.2.8-repcached-2.2/t.rep/21-set-exptime.t

memcached-1.2.8-repcached-2.2/t.rep/22-add-exptime.t

memcached-1.2.8-repcached-2.2/t.rep/23-replace-exptime.t

memcached-1.2.8-repcached-2.2/t.rep/11-set.t

memcached-1.2.8-repcached-2.2/t.rep/61-append-prepend.t

memcached-1.2.8-repcached-2.2/t.rep/62-cas.t

memcached-1.2.8-repcached-2.2/t.rep/12-add.t

memcached-1.2.8-repcached-2.2/t.rep/32-delete-deferred.t

memcached-1.2.8-repcached-2.2/t.rep/13-replace.t

memcached-1.2.8-repcached-2.2/t.rep/51-flush-all.t

memcached-1.2.8-repcached-2.2/t.rep/00-startup.t

memcached-1.2.8-repcached-2.2/t.rep/41-incrdecr.t

memcached-1.2.8-repcached-2.2/t.rep/31-delete.t

memcached-1.2.8-repcached-2.2/README

memcached-1.2.8-repcached-2.2/configure

memcached-1.2.8-repcached-2.2/scripts/

memcached-1.2.8-repcached-2.2/scripts/start-memcached

memcached-1.2.8-repcached-2.2/scripts/memcached-init

memcached-1.2.8-repcached-2.2/scripts/memcached-tool

memcached-1.2.8-repcached-2.2/scripts/memcached.sysv

memcached-1.2.8-repcached-2.2/configure.ac

memcached-1.2.8-repcached-2.2/slabs.c

memcached-1.2.8-repcached-2.2/slabs.h

memcached-1.2.8-repcached-2.2/config.guess

memcached-1.2.8-repcached-2.2/install-sh

memcached-1.2.8-repcached-2.2/config.sub

memcached-1.2.8-repcached-2.2/missing

memcached-1.2.8-repcached-2.2/stats.c

memcached-1.2.8-repcached-2.2/stats.h

memcached-1.2.8-repcached-2.2/Makefile.am

memcached-1.2.8-repcached-2.2/Makefile.in

memcached-1.2.8-repcached-2.2/replication.c

memcached-1.2.8-repcached-2.2/replication.h

memcached-1.2.8-repcached-2.2/config.h.in

memcached-1.2.8-repcached-2.2/memcached.spec

memcached-1.2.8-repcached-2.2/AUTHORS

memcached-1.2.8-repcached-2.2/thread.c

memcached-1.2.8-repcached-2.2/AUTHORS.repcached

memcached-1.2.8-repcached-2.2/assoc.c

memcached-1.2.8-repcached-2.2/assoc.h

memcached-1.2.8-repcached-2.2/memcached_dtrace.d

memcached-1.2.8-repcached-2.2/memcached_dtrace.h

memcached-1.2.8-repcached-2.2/ChangeLog

memcached-1.2.8-repcached-2.2/COPYING

memcached-1.2.8-repcached-2.2/daemon.c

memcached-1.2.8-repcached-2.2/memcached.c

memcached-1.2.8-repcached-2.2/memcached.h

memcached-1.2.8-repcached-2.2/items.c

memcached-1.2.8-repcached-2.2/items.h

[root@localhost init.d]# ls mem*

memcached memcached-1.2.8-repcached-2.2.tar.gz

 

memcached-1.2.8-repcached-2.2:

aclocal.m4           config.h.in   items.c             missing        stats.h

assoc.c              config.sub    items.h             NEWS           t

assoc.h              configure     Makefile.am         README         thread.c

AUTHORS              configure.ac  Makefile.in         replication.c  TODO

AUTHORS.repcached    COPYING       memcached.c         replication.h  t.rep

ChangeLog            daemon.c      memcached_dtrace.d  scripts

ChangeLog.repcached  depcomp      memcached_dtrace.h  slabs.c

compile              doc           memcached.h         slabs.h

config.guess         install-sh    memcached.spec      stats.c

[root@localhost init.d]# cd memcached-1.2.8-repcached-2.2

[root@localhostmemcached-1.2.8-repcached-2.2]# yum install libevent-devel

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

 *base: mirror.neu.edu.cn

 *epel: mirrors.neusoft.edu.cn

 *extras: mirror.neu.edu.cn

 *updates: mirror.neu.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package libevent-devel.i3860:1.4.13-1 set to be updated

--> Processing Dependency:libevent-1.4.so.2 for package: libevent-devel

--> Processing Dependency:libevent_extra-1.4.so.2 for package: libevent-devel

--> Processing Dependency:libevent_core-1.4.so.2 for package: libevent-devel

---> Package libevent-devel.x86_640:1.4.13-1 set to be updated

--> Running transaction check

---> Package libevent.i386 0:1.4.13-1set to be updated

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package                 Arch            Version            Repository     Size

================================================================================

Installing:

 libevent-devel          i386            1.4.13-1           base          373 k

 libevent-devel          x86_64          1.4.13-1           base          384 k

Installing for dependencies:

 libevent                i386            1.4.13-1           base          112 k

 

Transaction Summary

================================================================================

Install       3 Package(s)

Upgrade       0 Package(s)

 

Total download size: 869 k

Is this ok [y/N]: y

Downloading Packages:

(1/3): libevent-1.4.13-1.i386.rpm                        | 112 kB     00:00    

(2/3):libevent-devel-1.4.13-1.i386.rpm                  | 373 kB     00:00    

(3/3):libevent-devel-1.4.13-1.x86_64.rpm                | 384 kB     00:00    

--------------------------------------------------------------------------------

Total                                           383kB/s | 869 kB     00:02    

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

 Installing     : libevent                                                1/3

 Installing     :libevent-devel                                           2/3

 Installing     :libevent-devel                                           3/3

 

Installed:

  libevent-devel.i386 0:1.4.13-1        libevent-devel.x86_64 0:1.4.13-1      

 

Dependency Installed:

 libevent.i386 0:1.4.13-1                                                     

 

Complete!

[root@localhostmemcached-1.2.8-repcached-2.2]#

[root@localhostmemcached-1.2.8-repcached-2.2]#

[root@localhostmemcached-1.2.8-repcached-2.2]#

[root@localhostmemcached-1.2.8-repcached-2.2]#

[root@localhostmemcached-1.2.8-repcached-2.2]# ./configure --enable-replication--program-transform-name=s/memcached/repcached/

checking build system type...x86_64-unknown-linux-gnu

checking host system type...x86_64-unknown-linux-gnu

checking target system type...x86_64-unknown-linux-gnu

checking for a BSD-compatible install.../usr/bin/install -c

checking whether build environment issane... yes

checking for a thread-safe mkdir -p.../bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking for C compiler default output filename... a.out

checking whether the C compiler works...yes

checking whether we are cross compiling...no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU Ccompiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISOC89... none needed

checking for style of include used bymake... GNU

checking dependency style of gcc... gcc3

checking whether gcc and cc understand -cand -o together... yes

checking for a BSD-compatible install... /usr/bin/install-c

checking for libevent directory... (system)

checking for library containing socket...none required

checking for library containinggethostbyname... none required

checking for library containing mallinfo...none required

checking for daemon... yes

checking how to run the C preprocessor...gcc -E

checking for grep that handles long linesand -e... /bin/grep

checking for egrep... /bin/grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking for stdbool.h that conforms toC99... yes

checking for _Bool... yes

checking for an ANSI C-conforming const...yes

checking malloc.h usability... yes

checking malloc.h presence... yes

checking for malloc.h... yes

checking for struct mallinfo.arena... yes

checking for socklen_t... yes

checking for endianness... little

checking for mlockall... yes

checking for getpagesizes... no

checking for memcntl... no

configure: creating ./config.status

config.status: creating Makefile

config.status: creating doc/Makefile

config.status: creating config.h

config.status: executing depfiles commands

[root@localhostmemcached-1.2.8-repcached-2.2]# make

make all-recursive

make[1]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

Making all in doc

make[2]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[2]: Nothing to be done for `all'.

make[2]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[2]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-memcached.o -MD -MP -MF.deps/memcached-memcached.Tpo -c -o memcached-memcached.o `test -f'memcached.c' || echo './'`memcached.c

mv -f .deps/memcached-memcached.Tpo.deps/memcached-memcached.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-slabs.o -MD -MP -MF .deps/memcached-slabs.Tpo -c -omemcached-slabs.o `test -f 'slabs.c' || echo './'`slabs.c

mv -f .deps/memcached-slabs.Tpo.deps/memcached-slabs.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-items.o -MD -MP -MF .deps/memcached-items.Tpo -c -omemcached-items.o `test -f 'items.c' || echo './'`items.c

mv -f .deps/memcached-items.Tpo.deps/memcached-items.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-assoc.o -MD-MP -MF .deps/memcached-assoc.Tpo -c -o memcached-assoc.o `test -f 'assoc.c' ||echo './'`assoc.c

mv -f .deps/memcached-assoc.Tpo.deps/memcached-assoc.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-thread.o -MD -MP -MF .deps/memcached-thread.Tpo -c-o memcached-thread.o `test -f 'thread.c' || echo './'`thread.c

mv -f .deps/memcached-thread.Tpo.deps/memcached-thread.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-stats.o -MD -MP -MF .deps/memcached-stats.Tpo -c -omemcached-stats.o `test -f 'stats.c' || echo './'`stats.c

mv -f .deps/memcached-stats.Tpo.deps/memcached-stats.Po

gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -g -O2 -MT memcached-replication.o -MD -MP -MF.deps/memcached-replication.Tpo -c -o memcached-replication.o `test -f'replication.c' || echo './'`replication.c

mv -f .deps/memcached-replication.Tpo.deps/memcached-replication.Po

gcc -g -O2   -o memcachedmemcached-memcached.o memcached-slabs.o memcached-items.o memcached-assoc.omemcached-thread.o memcached-stats.o memcached-replication.o  -levent

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT memcached.o -MD -MP -MF.deps/memcached.Tpo -c -o memcached.o memcached.c

mv -f .deps/memcached.Tpo.deps/memcached.Po

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT slabs.o -MD -MP -MF.deps/slabs.Tpo -c -o slabs.o slabs.c

mv -f .deps/slabs.Tpo .deps/slabs.Po

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT items.o -MD -MP -MF.deps/items.Tpo -c -o items.o items.c

mv -f .deps/items.Tpo .deps/items.Po

gcc -DHAVE_CONFIG_H -I.     -g-O2 -MT assoc.o -MD -MP -MF .deps/assoc.Tpo -c -o assoc.o assoc.c

mv -f .deps/assoc.Tpo .deps/assoc.Po

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT thread.o -MD -MP -MF.deps/thread.Tpo -c -o thread.o thread.c

mv -f .deps/thread.Tpo .deps/thread.Po

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT stats.o -MD -MP -MF.deps/stats.Tpo -c -o stats.o stats.c

mv -f .deps/stats.Tpo .deps/stats.Po

gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT replication.o -MD -MP -MF.deps/replication.Tpo -c -o replication.o replication.c

mv -f .deps/replication.Tpo.deps/replication.Po

gcc -g -O2   -o memcached-debugmemcached.o slabs.o items.o assoc.o thread.o stats.o replication.o  -levent

make[2]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

make[1]: Leaving directory `/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

[root@localhostmemcached-1.2.8-repcached-2.2]#

[root@localhostmemcached-1.2.8-repcached-2.2]# make install

Making install in doc

make[1]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[2]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[2]: Nothing to be done for`install-exec-am'.

test -z"/usr/local/share/man/man1" || /bin/mkdir -p"/usr/local/share/man/man1"

 /usr/bin/install -c -m 644 './memcached.1''/usr/local/share/man/man1/repcached.1'

make[2]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[1]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2/doc'

make[1]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

make[2]: Entering directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

test -z "/usr/local/bin" ||/bin/mkdir -p "/usr/local/bin"

 /usr/bin/install -c 'memcached' '/usr/local/bin/repcached'

 /usr/bin/install -c 'memcached-debug' '/usr/local/bin/repcached-debug'

make[2]: Nothing to be done for`install-data-am'.

make[2]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

make[1]: Leaving directory`/etc/rc.d/init.d/memcached-1.2.8-repcached-2.2'

[root@localhost memcached-1.2.8-repcached-2.2]#cd /usr/local/bin/repcached

-bash: cd: /usr/local/bin/repcached: Not adirectory

[root@localhostmemcached-1.2.8-repcached-2.2]# cd /usr/local/bin

[root@localhost bin]# repcached -p 11211 -v

can't run as root without the -u switch

[root@localhost bin]# sh repcached -p 11211-v

repcached: repcached: cannot execute binaryfile

[root@localhost bin]#

[root@localhost bin]#

[root@localhost bin]#

[root@localhost bin]# killall memcached

[root@localhost bin]# ps | grep memcached

[root@localhost bin]# ps aux | grep memcache

root     7648  0.0  0.0 61188   748 pts/1    S+  07:06   0:00 grep memcache

 [root@localhostbin]# adduser sxl

 [root@localhostbin]# passwd sxl

Changing password for user sxl.

New UNIX password:

BAD PASSWORD: it does not contain enoughDIFFERENT characters

Retype new UNIX password:

passwd: all authentication tokens updatedsuccessfully.

[root@localhost bin]# su - sxl

[sxl@localhost ~]$ /usr/local/bin/repcached -p 11211 -v

replication: listen

[sxl@localhost ~]$ ps -ef | grep repcached

sxl      7700  7676  0 07:18 pts/1    00:00:00 grep repcached

[sxl@localhost ~]$ /usr/local/bin/repcached-p 11211 -x localhost -d -v

replication: connect (peer=127.0.0.1:11212)

replication: marugoto copying

replication: close

replication: listen

[sxl@localhost ~]$ telnet localhost 11211

Trying 127.0.0.1...

Connected to localhost.localdomain(127.0.0.1).

Escape character is '^]'.

set haha 0 0 5

wahaha

CLIENT_ERROR bad data chunk

ERROR

quit

//注意这里有一个wahaha超过了5长度

end

quit

Connection closed by foreign host.

[sxl@localhost ~]$ /usr/local/bin/repcached-p 11212 -x localhost -d -v

replication: connect (peer=127.0.0.1:11212)

replication: accept

replication: marugoto copying

[sxl@localhost ~]$ replication: start

 

[sxl@localhost ~]$

[sxl@localhost ~]$ ps aux | grep repcached

sxl      7708  0.0  0.1 18380  2288 ?        Ss  07:19   0:00/usr/local/bin/repcached -p 11211 -x localhost -d -v

sxl      7746  0.0  0.0 17300   732 ?        Ss  07:22   0:00/usr/local/bin/repcached -p 11212 -x localhost -d -v

sxl      7748  0.0  0.0 61188   752 pts/1    S+  07:22   0:00 grep repcached

[sxl@localhost ~]$ telnet localhost 11211

Trying 127.0.0.1...

Connected to localhost.localdomain(127.0.0.1).

Escape character is '^]'.

set haha 0 0 5

wahah

STORED

get haha

VALUE haha 0 5

wahah

END

quit

Connection closed by foreign host.

[sxl@localhost ~]$ telnet localhost 11212

Trying 127.0.0.1...

Connected to localhost.localdomain(127.0.0.1).

Escape character is '^]'.

get haha 

VALUE haha 0 5

wahah

END

quit

Connection closed by foreign host.

[sxl@localhost ~]$

原创粉丝点击