memcached 以及 php新客户端memcached 装配(参考)
memcached 以及 php新客户端memcached 安装(参考)
2010-02-23 11:05web2.0和web1.0不一样,web1.0以内容为中心,所以web1.0做负载只需缓存内容就可以了,使用反向代理缓存页面就可以解决大部分问题了。而web2.0鼓励用户交互,内容都是动 态的,只做反向代理命的话中率低,而且对数据库进行频繁的写,对数据库压力大。所以,web2.0对 web1.0更需要使用内存缓存。 memcached高性能的,分布式的内存对象缓存系统,在动态应用中减少数据库负载,提升访问速度。memcached已经被广泛应用在各种软件中,例如,nginx、mysql 一、服务端安装 使用weget下载libevent和memcached libevent: http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz memcached: http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz 1.先安装libevent tar zxvf libevent-1.4.9-stable.tar.gz cd libevent-1.4.9-stable ./configure make make install tar zxvf libevent-1.4.9-stable.tar.gz cd libevent-1.4.9-stable ./configure make make install 2.安装memcached tar zxvf memcached-1.2.6.tar.gz cd memcached-1.2.6 ./configure --enable-threads make make install tar zxvf memcached-1.2.6.tar.gz cd memcached-1.2.6 ./configure --enable-threads make make install 注:如果启动时出现“memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory”之类的信息,表示memcached找不到libevent的位置 所以,请先使用whereis libevent得到位置,然后连接到memcached所寻找的路径 [root@localhost tools]# whereis libevent libevent: /usr/local/lib/libevent.la /usr/local/lib/libevent.so /usr/local/lib/libevent.a [root@localhost tools]# LD_DEBUG=libs memcached -v 2>&1 > /dev/null | less [root@localhost tools]# ln -s /usr/local/lib/libevent-1.4.so.2 /lib64/ 二、php安装对memcached的支持 php有两个版本的memcached客户端 1.memcached 这个是新版的客户端基于libmemcached,所以必须要安装libmemcached 先安装libmemcached 下载地址:http://download.tangent.org/libmemcached-0.26.tar.gz [root@localhost tools]# tar zxvf libmemcached-0.26.tar.gz [root@localhost tools]# cd libmemcached-0.26 [root@localhost libmemcached-0.26]# ./configure --prefix=/usr/local/libmemcached/ --with-libmemcached-dir=/usr/local/libmemcached/ [root@localhost libmemcached-0.26]# make [root@localhost libmemcached-0.26]# make install [root@localhost tools]# tar zxvf libmemcached-0.26.tar.gz [root@localhost tools]# cd libmemcached-0.26 [root@localhost libmemcached-0.26]# ./configure --prefix=/usr/local/libmemcached/ --with-libmemcached-dir=/usr/local/libmemcached/ [root@localhost libmemcached-0.26]# make [root@localhost libmemcached-0.26]# make install 安装php memcached及最新客户端 下载地址:http://pecl.php.net/get/memcached [root@localhost tools]# tar zxvf memcached-0.1.4.tgz [root@localhost tools]# cd memcached-0.1.4 [root@localhost memcached-0.1.4]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ [root@localhost memcached-0.1.4]# make [root@localhost memcached-0.1.4]# make install [root@localhost tools]# tar zxvf memcached-0.1.4.tgz [root@localhost tools]# cd memcached-0.1.4 [root@localhost memcached-0.1.4]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ [root@localhost memcached-0.1.4]# make [root@localhost memcached-0.1.4]# make install 修改php.ini添加extension = "memcached.so"就可以了。 1. checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located 请先用whereis libmemcached找到路径,然后添加选项--with-libmemcached-dir=libmemcached路径 2.memcache 下载地址:http://pecl.php.net/get/memcache [root@localhost tools]# tar zxvf memcache-3.0.3.tgz [root@localhost tools]# cd memcache-3.0.3 [root@localhost tools]# /usr/local/php/bin/phpize [root@localhost tools]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@localhost tools]# make [root@localhost tools]# make install [root@localhost tools]# tar zxvf memcache-3.0.3.tgz [root@localhost tools]# cd memcache-3.0.3 [root@localhost tools]# /usr/local/php/bin/phpize [root@localhost tools]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@localhost tools]# make [root@localhost tools]# make install 修改php.ini添加extension = "memcache.so"就可以了。 提示:如果php找不到so文件,请设置extension_dir。 ps:这篇东西在草稿箱里呆很久了,最后还是决定把一篇分多篇发吧,这样感觉快多了。 来源:http://willko.iteye.com/blog/332993NetSeek (2009-9-10 11:16:40)memcached 的客户端 libmemcached, 在处理value超过8k的数据时, 速度会直线下降, 在 http://lists.tangent.org/piperma ... ovember/000484.html, 可以找到答案, 原因是libmemcached的buf太小了, 找到源文 件memcached_constants.h, 修改#define MEMCACHED_MAX_BUFFER 8196, 改成合适的大小, 重新编译, 安装, 就可以了. libmemcached是C客户端库的接口到memcached服务器。它被设计为轻的内存使用情况,线程安全,并提供充分获得服务器端的方法。它还采用多种 命令行工具: memcat , memflush , memrm , memstat ,并memslap (负载代)。图书馆一直在设计,让不同的散列方法对密钥,分割的钥匙 ,并使用统一的散列分配。 许可: BSD许可证(修订) 变化: 修正递减的散列关键。修正的断言,是抓不好memset ( )调用的host_reset ( ) 。修正的一个问题,清除阻塞的I / O已经堆叠。增补memstat 。一种新的API冲水。 memcached简单的使用教程 这是工程应用性质的文章:memcached是数据快速存取的工具,wikipedia和facebook就用了它提高速度。具体情况可以wiki. c/c++里面使用memcached本来是很简单的事情,但就是没有人说,非要我去读libmemcache的实例代码才行,manpage也没有说清楚(但还不得不看 )。如果要使用memcached,步骤如下: 1 安装memcached 你可以去官网上下载,也可以sudo apt-get install memcached 2 测试你刚才的安装, 比如运行 memcached -d -m 64 -l 127.0.0.1 -p 12300 -d表示后台, -m 64表示使用64MB内存,-l 127.0.0.1 -p 12300 表示监听127.0.0.1:12300端口 没有任何消息就是运行成功 3 安装libmemcached 这个就不要apt了,因为没有精确的libmemcached包,乖乖去官网下载吧。这个东西还需要libevent,这个没法apt,libevent安装的时候最好 装到/usr/lib里面,不然libmemcached还不能运行。 4 测试libmemcached 找一个文件比如test,然后运行memcp test --servers=127.0.0.1:12300 这样就把test拷贝到memcached管理的内存里面了。 memcat test --servers=127.0.0.1:12300 看看是不是刚才的那个文件。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

The reasons why mysql cannot connect to localhost are that the mysql service is not started, the mysql port is occupied, and there is a problem with the MySQL configuration file. Detailed introduction: 1. In Windows systems, you can open the service manager by entering "services.msc" at the command prompt, then find the mysql service and ensure that its status is "Running". In Linux systems, you can use the "services.msc" command to check and control the service status; 2. You can use the open command and so on.

1. Taking CentOS as an example, after logging in, modify /etc/passwd and /etc/shadow, change the root starting on the first line to a new user name (such as admin), and save through wq! after modification. 2. After modifying and saving, it will take effect after restarting the server. You can check the permissions of the file and see that the account column has changed to admin, as follows: Note: The default user with the highest administrative authority in Linux is root, uid is 0. Only uid is recognized in the system, so as long as uid is 0, the system is regarded as the highest administrative user. However, there may be certain problems with applications. Some software uses the root user by default, so if you have limited understanding of software applications,

0x01 Background of the article Recently, the storage of a business system of the author's company is approaching the limit, and the server will soon be unable to run. Because the business system A contains multiple subsystems A1, A2, A3... An, the middle of these subsystems Due to design reasons, the stored files are all stored in the same parent directory. The only difference is that the names of files and folders generated by different subsystems all start with the name of the subsystem. For example, the files generated by the A1 subsystem are all named A1xxxxxx, and the file names generated by the A2 subsystem are all A2xxxxx. Now we need to delete the historical files of some of these subsystems to free up server space. Dozens of terabytes of data are stored together. Manual deletion will definitely not show up. We can only use program automation.

Both root and alias can be defined in the location module, and are used to specify the real path of the requested resource, for example: location/i/{root/data/w3;} requests http://foofish.net/i/top.gif When this address is used, the corresponding real resource in the server is the /data/w3/i/top.gif file. Note: The real path is the value specified by root plus the value specified by location. And alias is just like its name. The path specified by alias is the alias of location. No matter how the value of location is written, the real path of the resource is the path specified by alias, such as

Solution: 1. Check the running status of the server and make sure it is listening on the correct port; 2. Try to temporarily disable the firewall or security software, and then try to access localhost again; 3. Check the hosts file of the operating system to ensure that localhost is resolved correctly ; 4. Try to restart the network adapter or reconfigure the network connection; 5. Try to change the port used by the local server, or close other programs that occupy the same port; 6. Try to manually add the corresponding IP address and domain name in the hosts file, etc.

linux localhost means "computer host name". The host name is used to identify an independent computer on the network; the root in "root@localhost" represents the currently logged-in user. In Linux, the administrator account is root, and the user is root. Log in to the Linux machine as a user.

The benefits of rooting your phone: 1. You can back up the system; 2. You can use advanced programs; 3. You can modify and delete system programs; 4. You can install programs on the SD card; 5. You can modify system fonts, etc. Disadvantages: 1. After the mobile phone is rooted, it is easy to be invaded by Trojan viruses; 2. System damage may occur due to incompleteness and software compatibility issues; 3. After the mobile phone is rooted, the software mistakenly deletes system files, causing system errors; 4. There is a risk that user privacy will be leaked after rooting the phone, etc.
