Linux和Windows平台memcached server的安装
来源:互联网 发布:自动排班软件那个好 编辑:程序博客网 时间:2024/05/22 00:37
Linux平台
http://code.google.com/p/memcached/wiki/NewStart?tm=6
Windows平台
下载地址:
http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip
以下from:
http://www.codeforest.net/how-to-install-memcached-on-windows-machine
Copy下来以防网址失效
After some research I found that there is a Win32 binary version of memcached availablehere.
So go there and download win32 binary version to your computer. When downloaded, extract the file to folder memcahced on your C partition.
You should get only one file named memcached.exe. Now we need to install this as a service, as memCached is daemon and should be run only as service.
To install Memcached as a service, follow these steps (please change all forward slashes to backslashes):
- If you’re running Vista, you should set memcached.exe to Run as administrator
- Install the service using the command:
1
c:/memcached/memcached.exe -d install
from the command prompt
- Start the server from the Services or by running one of the following commands:
1
c:/memcached/memcached.exe -d start
or
1
net start "memcached Server"
That is it, now your memcached server is installed and is listening to port 11211. There is one more thing left to do. By default, server is set to 64Mb memory limit, which is too small. To correct, go to Registry Editor and find key
1
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/memcached Server .
Change the ImagePath entry to:
1
“C:/memcached/memcached.exe” -d runservice -m 512
This way you will use 512 Mb memory limit for your server.
If you are using WAMP, then just turn on php_memcache extension in it. Now we are ready to go testing.
The simplest test is to write something to memcache that will expire in 30 seconds, and then try to retrieve the value from cache.
So write this into your test file:
01
<?php
02
$memcache
=
new
Memcache;
// instantiating memcache extension class
03
$memcache
->connect(
"localhost"
,11211);
// try 127.0.0.1 instead of localhost
04
// if it is not working
05
06
echo
"Server's version: "
.
$memcache
->getVersion() .
"<br />\n"
;
07
08
// we will create an array which will be stored in cache serialized
09
$testArray
=
array
(
'horse'
,
'cow'
,
'pig'
);
10
$tmp
= serialize(
$testArray
);
11
12
$memcache
->add(
"key"
,
$tmp
, 30);
13
14
echo
"Data from the cache:<br />\n"
;
15
print_r(unserialize(
$memcache
->get(
"key"
)));
16
?>
If everything went ok, you should see your array written out of memcache. Now you can use this powerful caching mechanism to develop really fast PHP applications. If you need to know more, go toPHP manual Memcached page
Memcached的基本设置
-p 监听的端口-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用,单位MB。默认64MB
-M 内存耗尽时返回错误,而不是删除项
-c 最大同时连接数,默认是1024
-f 块大小增长因子,默认是1.25
-n 最小分配空间,key+value+flags默认是48
-h 显示帮助
参考:
http://splinedancer.com/memcached-win32/
http://code.google.com/p/memcached/wiki/PlatformWindows
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/
- Linux和Windows平台memcached server的安装
- windows和linux环境下memcached的安装
- windows/Linux 下安装和使用memcached
- memcached windows/linux 安装和启动
- windows及linux平台下安装配置memcached
- windows及linux的memcached安装
- 如何在Windows平台下安装Memcached
- Memcached(1)------windows平台下安装
- Linux下memcached的安装和配置
- Windows和Linux环境下Memcached安装与配置
- Windows和Linux环境下Memcached安装与配置
- Windows和Linux环境下Memcached安装与配置(转)
- Windows和Linux环境下Memcached安装与配置
- Memcached关于在Windows和Linux上的安装操作步骤
- windows安装Memcached和Memcache
- Windows Server 2008安装Memcached笔记
- Windows Server 2008安装Memcached笔记
- Windows系统安装Memcached server软件
- C03-Java同步实践加强班第4周上机任务
- 灵活定点格式
- 英语练习My HomeTown
- 解析char *p与char p[] 区别
- Java中为什么内部类对外部类局部变量有引用时,外部类局部变量一定要有final?
- Linux和Windows平台memcached server的安装
- ExtJs xtype 一览表
- [转]error - Operation is not valid due to the current state of the object.
- 【索引】AOAPC I: Beginning Algorithm Contests (Rujia Liu)
- DrawPrimitive()
- centos定制
- Forms表单验证 使用经验及验证流程分析
- redmine安装过程
- Ubuntu 10.4 下安装gSOAP安装过程和问题解决