重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
安装memcache
创新互联建站是一家专注于网站建设、成都网站制作与策划设计,郑州网站建设哪家好?创新互联建站做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:郑州等地区。郑州做网站价格咨询:13518219792[root@node120 ~]# yum info memcached
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.opencas.cn
* epel: mirror.premi.st
* extras: mirrors.nwsuaf.edu.cn
* updates: mirrors.nwsuaf.edu.cn
可安装的软件包
Name : memcached
Arch : x86_64
Version : 1.4.4
Release : 3.el6
Size : 68 k
Repo : base
Summary : High Performance, Distributed Memory Object Cache
URL : http://www.memcached.org/
License : BSD
Description : memcached is a high-performance, distributed memory object caching
: system, generic in nature, but intended for use in speeding up dynamic
: web applications by alleviating database load.
[root@node120 ~]# yum install -y memcached
[root@node120 ~]# rpm -q memcached
memcached-1.4.4-3.el6.x86_64
[root@node120 ~]# rpm -ql memcached
/etc/rc.d/init.d/memcached
/etc/sysconfig/memcached
/usr/bin/memcached
/usr/bin/memcached-tool
/usr/share/doc/memcached-1.4.4
/usr/share/doc/memcached-1.4.4/AUTHORS
/usr/share/doc/memcached-1.4.4/CONTRIBUTORS
/usr/share/doc/memcached-1.4.4/COPYING
/usr/share/doc/memcached-1.4.4/ChangeLog
/usr/share/doc/memcached-1.4.4/NEWS
/usr/share/doc/memcached-1.4.4/README
/usr/share/doc/memcached-1.4.4/protocol.txt
/usr/share/doc/memcached-1.4.4/readme.txt
/usr/share/doc/memcached-1.4.4/threads.txt
/usr/share/man/man1/memcached.1.gz
/var/run/memcached
查看配置文件
[root@node120 ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
[root@node120 ~]# man memcached---------查看使用用法
[root@node120 ~]# memcached -f 1.25 -u memcached -vv---------(-f 增长因子;-u 用户)
slab class 1: chunk size 96 perslab 10922
slab class 2: chunk size 120 perslab 8738
slab class 3: chunk size 152 perslab 6898
slab class 4: chunk size 192 perslab 5461
slab class 5: chunk size 240 perslab 4369
slab class 6: chunk size 304 perslab 3449
slab class 7: chunk size 384 perslab 2730
slab class 8: chunk size 480 perslab 2184
slab class 9: chunk size 600 perslab 1747
slab class 10: chunk size 752 perslab 1394
slab class 11: chunk size 944 perslab 1110
slab class 12: chunk size 1184 perslab 885
slab class 13: chunk size 1480 perslab 708
slab class 14: chunk size 1856 perslab 564
slab class 15: chunk size 2320 perslab 451
slab class 16: chunk size 2904 perslab 361
slab class 17: chunk size 3632 perslab 288
slab class 18: chunk size 4544 perslab 230
slab class 19: chunk size 5680 perslab 184
slab class 20: chunk size 7104 perslab 147
slab class 21: chunk size 8880 perslab 118
slab class 22: chunk size 11104 perslab 94
slab class 23: chunk size 13880 perslab 75
slab class 24: chunk size 17352 perslab 60
slab class 25: chunk size 21696 perslab 48
slab class 26: chunk size 27120 perslab 38
slab class 27: chunk size 33904 perslab 30
slab class 28: chunk size 42384 perslab 24
slab class 29: chunk size 52984 perslab 19
slab class 30: chunk size 66232 perslab 15
slab class 31: chunk size 82792 perslab 12
slab class 32: chunk size 103496 perslab 10
slab class 33: chunk size 129376 perslab 8
slab class 34: chunk size 161720 perslab 6
slab class 35: chunk size 202152 perslab 5
slab class 36: chunk size 252696 perslab 4
slab class 37: chunk size 315872 perslab 3
slab class 38: chunk size 394840 perslab 2
slab class 39: chunk size 493552 perslab 2
slab class 40: chunk size 616944 perslab 1
slab class 41: chunk size 771184 perslab 1
slab class 42: chunk size 1048576 perslab 1
启动
[root@node120 ~]# service memcached start
正在启动 memcached: [确定]
[root@node120 ~]# ss -tunl
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 *:11211 *:*
udp UNCONN 0 0 *:631 *:*
udp UNCONN 0 0 192.168.112.120:123 *:*
udp UNCONN 0 0 127.0.0.1:123 *:*
udp UNCONN 0 0 *:123 *:*
udp UNCONN 0 0 :::11211 :::*
udp UNCONN 0 0 fe80::20c:29ff:fed2:5bd:123 :::*
udp UNCONN 0 0 ::1:123 :::*
udp UNCONN 0 0 :::123 :::*
tcp LISTEN 0 128 :::11211 :::*
tcp LISTEN 0 128 *:11211 *:*
tcp LISTEN 0 128 :::22 :::*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 128 127.0.0.1:631 *:*
tcp LISTEN 0 128 ::1:631 :::*
tcp LISTEN 0 100 ::1:25 :::*
tcp LISTEN 0 100 127.0.0.1:25 *:*
tcp LISTEN 0 128 127.0.0.1:6010 *:*
tcp LISTEN 0 128 ::1:6010 :::*
tcp LISTEN 0 128 127.0.0.1:6011 *:*
tcp LISTEN 0 128 ::1:6011 :::*
[root@node120 ~]# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
stats
STAT pid 24034
STAT uptime 792
STAT time 1451025193
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 0.016997
STAT rusage_system 0.043993
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 7
STAT bytes_written 0
STAT limit_maxbytes 67108864
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
set mykey 0 30 11
hello hey1w
STORED
get mykey
VALUE mykey 0 11
hello hey1w
END
set testkey 0 120 1
1
STORED
incr testkey 1
2
incr test 3
NOT_FOUND
incr testkey 3
5
decr testkey 2
3
get testkey
VALUE testkey 0 1
3
END
get mykey
END
安装PHP
[root@node120 ~]# yum install php php-devel -y
[root@node120 ~]# yum groupinstall "Development Tools" "Server Platform Development" -y
[root@node120 ~]# ls
anaconda-ks.cfg vmware-tools-distrib 文档
epel-release-latest-6.noarch.rpm 公共的 下载
install.log 模板 音乐
install.log.syslog 视频 桌面
memcache-2.2.7.tgz 图片
[root@node120 ~]# tar -xf memcache-2.2.7.tgz
[root@node120 ~]# cd memcache-2.2.7
[root@node120 memcache-2.2.7]# ls
config9.m4 memcache.php
config.m4 memcache_queue.c
config.w32 memcache_queue.h
CREDITS memcache_session.c
example.php memcache_standard_hash.c
memcache.c php_memcache.h
memcache_consistent_hash.c README
memcache.dsp
安装PHP扩展
[root@node120 ~]# tar -xf memcache-2.2.7.tgz
[root@node120 ~]# cd memcache-2.2.7
[root@node120 memcache-2.2.7]# ls
config9.m4 memcache.php
config.m4 memcache_queue.c
config.w32 memcache_queue.h
CREDITS memcache_session.c
example.php memcache_standard_hash.c
memcache.c php_memcache.h
memcache_consistent_hash.c README
memcache.dsp
[root@node120 memcache-2.2.7]# phpize----是有php-devel提供
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@node120 memcache-2.2.7]# ls
acinclude.m4 ltmain.sh
aclocal.m4 Makefile.global
autom4te.cache memcache.c
build memcache_consistent_hash.c
config9.m4 memcache.dsp
config.guess memcache.php
config.h.in memcache_queue.c
config.m4 memcache_queue.h
config.sub memcache_session.c
configure memcache_standard_hash.c
configure.in missing
config.w32 mkinstalldirs
CREDITS php_memcache.h
example.php README
install-sh run-tests.php
[root@node120 memcache-2.2.7]# which php-config
/usr/bin/php-config
[root@node120 memcache-2.2.7]# ./configure --with-php-config=/usr/bin/php-config
[root@node120 memcache-2.2.7]# make && make install
[root@node120 memcache-2.2.7]# ls /usr/lib64/php/modules/
curl.so fileinfo.so json.so memcache.so phar.so zip.so
[root@node120 memcache-2.2.7]# vim /etc/php.ini
918 ; syntax:
919 ;
920 ; extension=modulename.extension
921 extension=memcache.so
922
923 ; For example
[root@node120 memcache-2.2.7]# service httpd restart
停止 httpd: [失败]
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for node120.zye.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[确定
[root@node120 memcache-2.2.7]# vim /var/www/html/index.php
phpinfo ();
?>
添加test.php
[root@node120 memcache-2.2.7]# vim /var/www/html/test.php
1
2 $mem = new Memcache;
3 $mem->connect("127.0.0.1", 11211) or die("Could not conn ect");
4
5 $version = $mem->getVersion();
6 echo "Server's version: ".$version."
\n";
7
8 $mem->set('hellokey', 'Hello World', 0, 600) or die("Fail ed to save data at the memcached server");
9 echo "Store data in the cache (data will expire in 600 se conds)
\n";
10
11 $get_result = $mem->get('hellokey');
12 echo "$get_result is from memcached server.";
13 ?>
[root@node120 memcache-2.2.7]# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
get hellokey
VALUE hellokey 0 11
Hello World
END
quit
memcache拥有php的管理界面
[root@node120 memcache-2.2.7]# yum list all \*phpM\*
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.skyshe.cn
* epel: mirror.premi.st
* extras: ftp.sjtu.edu.cn
* updates: mirrors.skyshe.cn
可安装的软件包
php-PHPMailer.noarch 5.2.2-1.el6 epel
php-channel-phpmd.noarch 1.3-3.el6 epel
php-phpmd-PHP-PMD.noarch 1.4.0-1.el6 epel
phpMemcachedAdmin.noarch 1.2.2-5.svn262.el6 epel
phpMyAdmin.noarch 4.0.10.11-1.el6 epe
[root@node120 memcache-2.2.7]# yum install phpMemcachedAdmin -y
[root@node120 memcache-2.2.7]# rpm -ql phpMemcachedAdmin
etc/httpd/conf.d/phpMemcachedAdmin.conf
/etc/phpMemcachedAdmin
/etc/phpMemcachedAdmin/Memcache.php
/usr/share/doc/phpMemcachedAdmin-1.2.2
/usr/share/doc/phpMemcachedAdmin-1.2.2/LICENSE
/usr/share/phpMemcachedAdmin
/usr/share/phpMemcachedAdmin/Library
/usr/share/phpMemcachedAdmin/Library/Command
/usr/share/phpMemcachedAdmin/Library/Command/Factory.php
/usr/share/phpMemcachedAdmin/Library/Command/Interface.php
/usr/share/phpMemcachedAdmin/Library/Command/Memcache.php
/usr/share/phpMemcachedAdmin/Library/Command/Memcached.php
/usr/share/phpMemcachedAdmin/Library/Command/Server.php
/usr/share/phpMemcachedAdmin/Library/Configuration
/usr/share/phpMemcachedAdmin/Library/Configuration/Loader.php
/usr/share/phpMemcachedAdmin/Library/Data
/usr/share/phpMemcachedAdmin/Library/Data/Analysis.php
/usr/share/phpMemcachedAdmin/Library/Data/Error.php
/usr/share/phpMemcachedAdmin/Library/Data/Version.php
/usr/share/phpMemcachedAdmin/Library/HTML
/usr/share/phpMemcachedAdmin/Library/HTML/Components.php
/usr/share/phpMemcachedAdmin/Library/Loader.php
/usr/share/phpMemcachedAdmin/Public
/usr/share/phpMemcachedAdmin/Public/Images
/usr/share/phpMemcachedAdmin/Public/Images/635855.png
/usr/share/phpMemcachedAdmin/Public/Images/b5463f.png
/usr/share/phpMemcachedAdmin/Public/Scripts
/usr/share/phpMemcachedAdmin/Public/Scripts/Script.js
/usr/share/phpMemcachedAdmin/Public/Styles
/usr/share/phpMemcachedAdmin/Public/Styles/Style.css
/usr/share/phpMemcachedAdmin/View
/usr/share/phpMemcachedAdmin/View/Commands
/usr/share/phpMemcachedAdmin/View/Commands/Commands.tpl
/usr/share/phpMemcachedAdmin/View/Configure
/usr/share/phpMemcachedAdmin/View/Configure/Configure.tpl
/usr/share/phpMemcachedAdmin/View/Footer.tpl
/usr/share/phpMemcachedAdmin/View/Header.tpl
/usr/share/phpMemcachedAdmin/View/LiveStats
/usr/share/phpMemcachedAdmin/View/LiveStats/Frame.tpl
/usr/share/phpMemcachedAdmin/View/LiveStats/Stats.tpl
/usr/share/phpMemcachedAdmin/View/Stats
/usr/share/phpMemcachedAdmin/View/Stats/Error.tpl
/usr/share/phpMemcachedAdmin/View/Stats/Items.tpl
/usr/share/phpMemcachedAdmin/View/Stats/Slabs.tpl
/usr/share/phpMemcachedAdmin/View/Stats/Stats.tpl
/usr/share/phpMemcachedAdmin/commands.php
/usr/share/phpMemcachedAdmin/configure.php
/usr/share/phpMemcachedAdmin/index.php
/usr/share/phpMemcachedAdmin/stats.php
/var/lib/phpMemcachedAdmin
/var/lib/phpMemcachedAdmin/Temp
[root@node120 memcache-2.2.7]# vim /etc/httpd/conf.d/phpMemcachedAdmin.conf
1 # phpMemcachedAdmin - Graphic stand-alone administration for memcached to monitor and debug purpose
2 #
3 # Allows only localhost by default
4
5 Alias /phpMemcachedAdmin /usr/share/phpMemcachedAdmin
6 Alias /phpmemcachedadmin /usr/share/phpMemcachedAdmin
7
8
9
10 # Apache 2.4
11
12 Require local
13
14
15
16 # Apache 2.2
17 Order Deny,Allow
18 Allow from All
19
20
[root@node120 memcache-2.2.7]# service httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using node120.zye.com for ServerName
[确定
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。