Refer:
Http://www.linuxidc.com/Linux/2010-08/28100.htm
Http://www.linuxidc.com/Linux/2010-04/25543.htm
Http://www.cr173.com/html/15392_1.html
This chapter focuses on installation. Click here for a test ticket
Test the memcached service on Ubuntu and windows
Many large load sites around the world use memcache as a cache service to share the pressure on database servers.
Memcache is the project name and memcached is the service name. It makes a lot of new contacts feel inexplicable. I personally think it is more correct to use the former.
Like database development, memcache is divided into two parts: memcache server and client. The memcache server runs as a Service. The creation, storage, and deletion of all data caches are actually completed here. Client, here we refer to extensions that can be called by PHP, C, and Java applications.
Installation on Ubuntu:
Sudo apt-Get installmemcached
After the installation, memcached will be automatically started. Listen on port 11211 and check the command PS-Ef | grep memcached.
After installing the memcache server, we need to specify the parameter to start the service:
Memcached-D-M 128-p 11111-u Root
Here we need to describe the memcached service startup parameters:
-P listening port
-L connected IP address. The default value is local
-D start: Start the memcached service.
-D restart: restart the memcached service.
-D stop | Shutdown the running memcached Service
-D install the memcached Service
-D uninstall memcached Service
-U runs as the identity (only valid when running as root)
-MB maximum memory usage, in MB. The default value is 64 MB.
-An error is returned when M memory is used up, instead of deleting items.
-C: Maximum number of simultaneous connections. The default value is 1024.
-F block size growth factor. The default value is 1.25-n. The minimum allocation space is 48 for key + value + flags.
-H Show Help
Remember to modify the parameters:
/Etc/memcached. conf andsearch-L 127.0.0.1And replace it-L 0.0.0.0
(Installation details ---------------------------------------------------------------------------------------------------------------------------)
Http://programming.iteye.com/blog/1483257
If the system cannot find the memcache installation package
Update Software Source
You can use any source image in the following list to add a line to your/etc/APT/sources. list file as follows:
Deb http://security.ubuntu.com/ubuntu hard-security main universe
Reinstallation
- Sudo apt-Get update ---- update source operation
- Sudo apt-Get install memcache
Check whether the installation is successful.
-----
After the installation is successful, memcache starts itself. Check the process
PS-Aux
A record is found.
/Usr/bin/memcached-M 64-P 11211-u nobody-l 127.0.0.1
Memcached port 11211 user nobody address 127.0.0.1 is displayed to connect to the memcached server.
Telnet fig 11211
Enter
Stats
The parameters of the current memcached are displayed ..
- SysAdmin @ Ubuntu:/etc/apt $ Telnet fig 11211
- Trying 127.0.0.1...
- Connected to 127.0.0.1.
- Escape Character is '^]'.
- Stats
- Stat PID 3065
- Statuptime 170
- Stat time 1334121278
- Stat version 1.4.7
- Stat libevent 2.0.12-stable
- Stat pointer_size 64
- Stat rusage_user 0.004000
- Stat rusage_system 0.000000
- Stat curr_connections 5
- Stat total_connections 7
- Stat connection_structures 6
- Stat performance_get 0
- Stat performance_set 0
- Stat 1__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 140
- Stat bytes_written 856
- Stat limit_maxbytes 67108864
- Stat accepting_conns 1
- Stat listen_disabled_num 0
- Stat threads 4
- Stat conn_yields 0
- Stat bytes 0
- Stat curr_items 0
- Stat total_items 0
- Stat evictions 0
- Stat reclaimed 0
- End
Manually start memcached
- Memcached-D-M 128-l 127.0.0.1-P 11211-u Root
Start memcache with a root user allocated a maximum of 2 gm memory
- Memcached-D-M 128-l 127.0.0.1-P 11212-u Root
Start another memcache instance on port 11212.
Bytes --------------------------------------------------------------------------------------------------------
Installation on windwos:
1. Extract to the specified directory, such as: C: \ memcached \ memcached-win32-1.4.4-14.
2. Open the command window with cmd, go to the decompressed directory, and enter unzip memcached.exe-D install ".
3. Open the control panel and open the service. You can see that memcached is already available. If it is not started, start it manually.
4. You can also modify the startup parameters in the registry.
"D: \ memcached-1.2.6-win32-bin \ memcached.exe"-D runservice-l 127.0.0.1-M 1024-C 2048
5. Perform the Telnet 127.0.0.1 11211 test and start to display nothing. Press enter and enter the command stats to view the statistics, as shown in figure