Updated on:
1. enable virtual machines. Path: G: \ virtual machines \ VMware. memcached configure securecrt: CJB. memcached 192.168.160.1292, download Program . # Cd/home/apps # wget http://www.monkey.org /~ Provos/libevent-1.4.13-stable.tar.gz # wget http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz3?compiler check. # Install gcc-V4. 1) install libevent. # Tar-zxvf libevent-1.4.13-stable.tar.gz // Decompress the package first # Cd libevent-1.4.13-stable // Switch to the libevent directory #./Configure -- prefix =/usr/ // Specify the installation path to the/usr/directory # Make // Compile # Make install // Install # Ls/usr/lib | grep libevent // Verify the installation. 2) install memcached. # Cd/home/apps # Tar-zxvf memcached-1.4.0.tar.gz # Cd memcached-1.4.0 #./Configure -- prefix =/usr/local/memcached -- With-libevent =/usr/ # Make # Make install # Ls-Al/usr/local/memcached/bin // Verify installation 5. Enable memcache1) and disable the firewall. # Permanently effective. It will not be enabled after restart: chkconfig iptables on Disabled: chkconfig iptables off # It will take effect immediately. After restart, it will be enabled: Service iptables start disabled: service iptables stop # modify the/etc/sysconfig/iptables file, add-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 11211-J accept 2) start the memcache server. #/Usr/local/memcached/bin/memcached-D-M 100-u root-l 192.168.160.129-P 11211-C 256-P/tmp/memcached. the PID-D option is to start a daemon process.-M is the amount of memory allocated to memcache. The unit is mb. Here I am 100 mb.-U is the user who runs memcache, here I am root and-l is the IP address of the server listening. If there are multiple IP addresses, I have specified the IP address 192.168.36.200 for the server, and-P is the port for setting the memcache listening, I set port 11211 here, preferably port 1024 or above. Here we use the always 11-C option as the maximum number of concurrent connections running. The default value is 1024. I set port 256 here, set according to the load of your server. -P is the PID file for saving memcache. Here I save it in/tmp/memcached. PID, 3) and end the memcache process. # Kill CAT/tmp/memcached. pid6. monitor whether the startup is successful. cmdc: \> Telnet 192.168.160.129 11211 directly hitting stats command 7. Set the Telnet access limit for memcache. Set the Telnet access limit, common concepts that enable memcached to access memcache only on transit hosts. memcached allocates memory in advance. The memory allocation method of memcached is called allocator. First, there are three concepts: 1 slab 2 Page 3 Chunk: Generally, a memcahced process divides itself into several slabs in advance, and each slab has several pages, there are multiple chunks under each page. If we think of these three chunks as objects, this is a one-to-many relationship. Generally speaking, the number of slab instances is limited to a few, dozens, or dozens. This is related to the memory configured by the process. The default page size for each slab is 1 MB. That is to say, if an slab occupies 100 MB of memory, the number of pages owned by this slab is by default, chunk is the final place where data is stored. 9. Common memcache commands 1). query STATUS Command: stats: Name type meaning -------------------------------- PID 32u process ID of this server processuptime 32u number of seconds this server has been runningtime 32u current UNIX time according to the serverversion String version string of this serverpointer_size 32 default size of pointers on the host OS (generally 32 or 64) rusage_user 32u: 32u accumulated user time for this process (seconds: microseconds) rusage_system 32u: 32u accumulated system time for this process (seconds: microseconds) curr_items 32u current number of items stored by the servertotal_items 32u Total number of items stored by this server ever since it startedbytes 64u current number of bytes used by this server to store itemscurr_connections 32u number of open connectionstotal_connections 32u total number of connections opened since the server started runningconnection_structures 32u Number of connection structures allocated by the server‑_get 64u cumulative number of retrieval requestscmd_set 64u cumulative number of storage requestsget_hits 64u number of keys that have been requested and found presentget_misses 64u number of items that have been requested and not foundevictions 64u Number of valid items removed from cache to free memory for new items bytes_read 64u total number of bytes read by this server from networkbytes_written 64u total number of bytes sent by this server to networklimit_maxbytes 32u number of bytes this server is allowed to use for storage. threads 32u Number of worker threads requested. (See Doc/threads.txt) 2) query version number version3), exit command quit4), display information of each slab, including chunk size, number, usage, etc.: stats slabs5) display the number of items in each slab and the age of the oldest item (the number of seconds before the last visit): stats items6), display memory allocation: stats malloc5) clear cache data (in fact, all cache data is marked as expired): flush_all reference: # memcachedhttp: // memcached.org/http://code.jellycan.com/memcached/#memcachedinstallation and basic use (Windows) Guest Linux installation http://kb.cnblogs.com/a/1501326/
1. enable virtual machines.
Path: G: \ virtual machines \ VMware. memcached
Configure securecrt: CJB. memcached 192.168.160.129
2. Download the program.
# Cd/home/apps # wget http://www.monkey.org /~ Provos/libevent-1.4.13-stable.tar.gz
# Wget http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz
3. compiler check. # Gcc-V
4. installation.
1) install libevent.
# Tar-zxvf libevent-1.4.13-stable.tar.gz // Decompress the package first
# Cd libevent-1.4.13-stable // Switch to the libevent directory
#./Configure -- prefix =/usr/ // Specify the installation path to the/usr/directory
# Make // Compile
# Make install // Install
# Ls/usr/lib | grep libevent // Verify Installation
2) install memcached
# Cd/home/apps
# Tar-zxvf memcached-1.4.0.tar.gz
# Cd memcached-1.4.0
#./Configure -- prefix =/usr/local/memcached -- With-libevent =/usr/
# Make # Make install
# Ls-Al/usr/local/memcached/bin // Verify Installation
5. Enable memcache1) and disable the firewall.
# It takes effect permanently and will not be restored after restart
Enable: chkconfig iptables on
Close: chkconfig iptables off
# Takes effect immediately and recovers after restart
Enable: Service iptables start
Disable: Service iptables stop
# Modify the/etc/sysconfig/iptables file,
Add-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 11211-J accept
2) Start the memcache server.
#/Usr/local/memcached/bin/memcached-D-M 100-u root-l 192.168.160.129-P 11211-C 256-P/tmp/memcached. PID
-D option is to start a daemon,
-M indicates the amount of memory allocated to memcache. The unit is mb. Here is 100 MB,
-U is the user who runs memcache. Here I am root,
-L is the IP address of the listening server. If there are multiple IP addresses, I have specified the IP address 192.168.36.200,
-P is the port for memcache listening. I have set port 11211 here, preferably port 1024 or above. Here we use the limit 11-c option to set the maximum number of concurrent connections. The default value is 1024, I set 256 here based on the load of your server.
-P is the PID file for saving memcache. Here I am saving it in/tmp/memcached. PID
3) Terminate the memcache process.
# Kill CAT/tmp/memcached. PID
6. Check whether the startup is successful
CMD
C: \> Telnet 192.168.160.129 11211
Directly tap the stats command
7. Set memcache Telnet access restrictions
Restrict Telnet access so that it can only be accessed on a transit machine.
8. Common memcache concepts
Memcached allocates memory in advance. memcached allocates memory in a way called allocator. First, there are three concepts: 1 slab 2 Page 3 chunk, generally, a memcahced process divides itself into several slabs. Each slab has several pages, and each page has multiple chunks, if we think of the three Doon objects as objects, this is a one-to-many relationship. Generally speaking, the number of slab instances is limited to a few, dozens, or dozens. This is related to the memory configured by the process. The default page size for each slab is 1 MB. That is to say, if an slab occupies 100 MB of memory, the number of pages owned by this slab is by default, and Chunk is the final place where we have to store data.
9. Common memcache commands
1) query STATUS Command: stats:
2) query the version number
3) Exit the quit command.
3) Clear cache data (in fact, Mark All cached data as expired): flush_all
References:
# Memcached
Http://memcached.org/http://code.jellycan.com/memcached/
# Install and use memcached (Windows)
Http://www.cnblogs.com/netflu/archive/2010/03/12/1684305.html
# Brief steps for installing memcache
Http://kb.cnblogs.com/a/1575049/
# Memcached Linux installation instructions
Http://kb.cnblogs.com/a/1501326/
Recipe guests all over the world!