当前位置:首页 > 行业动态 > 正文

安装memcached(安装未知应用权限在哪)(memcached 安装)

安装memcached,需在服务器上配置应用权限。

什么是memcached?

Memcached(内存缓存)是一个高性能的分布式内存对象缓存系统,它可以将数据存储在内存中,并通过键值对的形式进行存储,Memcached的主要作用是减轻数据库的负载,提高数据的访问速度,它可以应用于各种场景,如网站缓存、日志缓存等。

为什么需要安装memcached?

1、提高数据访问速度:由于memcached将数据存储在内存中,因此访问速度比传统的磁盘存储方式要快很多,对于高并发、大数据量的场景,使用memcached可以显著提高系统的性能。

2、减轻数据库压力:当用户请求数据时,如果数据库中有对应的数据,可以直接从memcached中获取,而不需要查询数据库,这样可以减少数据库的负载,提高系统的稳定性。

3、实现分布式缓存:memcached支持多台服务器之间的缓存共享,可以将缓存分布在多个节点上,提高系统的可扩展性。

4、降低成本:使用memcached可以减少对传统数据库的投资,降低系统的运维成本。

如何安装memcached?

以Ubuntu系统为例,可以通过以下步骤安装memcached:

安装memcached(安装未知应用权限在哪)(memcached 安装)

1、更新软件包列表:

sudo apt-get update 

2、安装依赖库:

sudo apt-get install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev 

3、下载memcached源码:

wget https://github.com/memcached/memcached/archive/release-1.6.5.tar.gz 

4、解压源码包:

安装memcached(安装未知应用权限在哪)(memcached 安装)

tar xvf release-1.6.5.tar.gz 

5、进入解压后的目录:

cd memcached-release-1.6.5 

6、编译并安装memcached:

./configure --prefix=/usr/local/memcached --enable-static=yes --with-libcurl=yes --with-zlib=yes --with-openssl=yes --without-libevent --without-libuv --without-nlmsghdr --without-syslog --without-mysql --without-odbc --without-sasl --without-authz_token --without-unbound --without-ugm --disable-threaded-malloc --with-threads=posix --with-filestore=yes --with-hash-family=murmur2 --with-smallbuild=no --with-pic=no --with-cc=gcc48 --with-ld=gcc48 --with-apxs=no --with-icu=no --with-debug=no --with-optimizations=none --with-polling=no --with-binary=yes --enable-ipv6=yes --enable-stats=yes --enable-compat2008test=yes --enable-compat32bittest=yes --enable-compat40bittest=yes --enable-compat43bittest=yes --enable-compat52bittest=yes --enable-compat60bittest=yes --enable-compat70bittest=yes --enable-compat72bittest=yes --enable-compat73bittest=yes --enable-compat74bittest=yes --enable-compat75bittest=yes --enable-compat76bittest=yes --enable-compat77bittest=yes --enable-compat78bittest=yes --enable-compat79bittest=yes --enable-compat80bittest=yes --enable-compat81bittest=yes --enable-compat82bittest=yes --enable-compat83bittest=yes --enable-compat84bittest=yes --enable-compat85bittest=yes --enable-compat86bittest=yes --enable-compat87bittest=yes --enable-compat88bittest=yes --enable-compat89bittest=yes --enable-compat90bittest=yes --enable-compat91bittest=yes --enable-compat92bittest=yes --enable-compat93bittest=yes --enable-compat94bittest=yes --enable-compat95bittest=yes --enable-compat96bittest=yes --enable-compat97bittest=yes --with-jemalloc=no; make; sudo make install; cd ../bin; sudo make install; sudo ldconfig; cd ../doc; sudo make install; cd ../man; sudo make install; cd ../src; sudo make install; cd ../utils; sudo make install; cd ../include; sudo make install; cd ../libs; sudo make install; cd ../mod_perl; sudo make install; cd ../cmake; sudo make install; cd ../autogen; sudo make install; cd ../tests; sudo make install; cd ../examples; sudo make install; cd ../contrib; sudo make install; sudo ldconfig; echo 'export MEMCACHED_HOME=$(dirname $(which memcached))' >> ~/.bashrc; source ~/.bashrc; memcached -V 

4、启动memcached服务:

sudo systemctl start memcached 

5、设置开机自启动:

安装memcached(安装未知应用权限在哪)(memcached 安装)

sudo systemctl enable memcached 

相关问题与解答

1、如何查看已安装的软件包?

答:可以使用dpkg -l命令查看已安装的软件包。dpkg -l | grep memcached

2、如何卸载memcached?

答:可以使用sudo apt-get remove memcached命令卸载memcached,然后执行sudo apt-get autoremove命令清除无用的依赖包,最后执行sudo apt-get autoclean命令清理配置文件和临时文件。