In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to install and use Memcache on the Linux server". In the daily operation, I believe that many people have doubts about how to install and use Memcache on the Linux server. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to install and use Memcache on the Linux server". Next, please follow the editor to study!
The server side is mainly to install the memcache server side, and the latest version is memcached-1.3.0.
Download: http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz
In addition, Memcache uses the libevent library for Socket processing, so you also need to install the latest version of libevent,libevent is libevent-1.3. (if your system already has libevent installed, you don't have to install it.)
Official website: http://www.monkey.org/~provos/libevent/
Download: http://www.monkey.org/~provos/libevent-1.3.tar.gz
Download these two things directly with the wget command. After downloading the source file.
1. Install libevent first. When configuring this thing, you need to specify an installation path, that is,. / configure-prefix=/usr; and then make; and then make install
two。 To install memcached, you just need to specify the installation path of libevent, that is,. / configure-with-libevent=/usr;, then make; and then make install.
This completes the installation of the Memcache server under Linux. The detailed methods are as follows:
1. Download memcached and libevent respectively and put them in the / tmp directory:
The code is as follows:
# cd / tmp
# wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz
two。 Install libevent first:
The code is as follows:
# tar zxvf libevent-1.2.tar.gz
# cd libevent-1.2
#. / configure-prefix=/usr
# make
# make install
3. Test whether libevent is installed successfully:
The code is as follows:
# ls-al / usr/lib | grep libevent
Lrwxrwxrwx 1 root root 21 11? 12 17:38 libevent-1.2.so.1-> libevent-1.2.so.1.0.3
-rwxr-xr-x 1 root root 263546 11 hours? 12 17:38 libevent-1.2.so.1.0.3
-rw-r-r- 1 root root 454156 11 hours? 12 17:38 libevent.a
-rwxr-xr-x 1 root root 811 11 11? 12 17:38 libevent.la
Lrwxrwxrwx 1 root root 21 11? 12 17:38 libevent.so-> libevent-1.2.so.1.0.3
It's not bad. It's all installed.
4. To install memcached, you need to specify the installation location of libevent in the installation:
The code is as follows:
# cd / tmp
# tar zxvf memcached-1.2.0.tar.gz
# cd memcached-1.2.0
#. / configure-with-libevent=/usr
# make
# make install
If there is an error in the middle, please check the error message carefully and configure or add the corresponding library or path according to the error message.
Memcached will be placed in / usr/local/bin/memcached after the installation is completed.
5. Test if memcached is installed successfully:
The code is as follows:
# ls-al/ usr/local/bin/mem*
-rwxr-xr-x 1 root root 137986 11 hours? 12 17:39 / usr/local/bin/memcached
-rwxr-xr-x 1 root root 140179 11 hours? 12 17:39 / usr/local/bin/memcached-debug
Basic use
View the current number of memcache connections:
The code is as follows:
[root@mem1 ~] # netstat-n | grep: 11211 | wc-l
15752
View the number of connections allowed by default:
The code is as follows:
[root@mem1 ~] # cat / etc/rc.local
#! / bin/sh
#
# This script will be executed * after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
Touch / var/lock/subsys/local
/ usr/local/bin/memcached-d-m 15360-u root-l 172.20.1.54-p 11211-c 40960
/ usr/local/bin/memcached-d-m 512-u root-l 172.20.1.54-p 11212-c 10000
The default number of connections for port 11211 set here is 40960
When you find information on the Internet, Memcache also has its own viewing tool:
How to view the memcache server-side version:. / memcached-h
The running status of memcache can be easily displayed with the stats command.
First connect to memcache with a command such as telnet 127.0.0.1 11211, and then type stats directly to get the current memcache status.
These states are described as follows:
At this point, the study on "how to install and use Memcache on the Linux server" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.