mac memcached_如何在Mac OS上安装Memcached Server

mac memcached

Memcached is an open-source high performance distributed memory object caching system. It is one of the most widely used cache mechanism used by some of the biggest websites like WordPress.com and LiveJournal.com.

Memcached是一个开源的高性能分布式内存对象缓存系统。 它是WordPress.com和LiveJournal.com等一些大型网站使用的最广泛使用的缓存机制之一。

It is also used by VBulletin software, for faster performance, that is one of the best software for Forums. It’s easy to install and there are so many client programs available on the Internet in different languages.

VBulletin软件也使用它来提高性能,这是论坛最好的软件之一。 它很容易安装,并且互联网上有许多可用不同语言的客户端程序。

Read: Memcached Java Client

阅读Memcached Java客户端

在Mac OS上安装Memcached (Install Memcached on Mac OS)

Memcached is a memory based caching mechanism and build using C language. To install memcached server on Mac OS, we need C library. Here I am assuming that C library is already present in the system. If it’s not, then you can download C compiler and install it or install XCode that installs GCC compiler with it.

Memcached是基于内存的缓存机制,并使用C语言进行构建。 要在Mac OS上安装memcached服务器,我们需要C库。 在这里,我假设系统中已经存在C库。 如果不是,则可以下载并编译C编译器,也可以安装XCode来安装GCC编译器

After that, you need to install the lib events library.

之后,您需要安装lib事件库。

Steps are;

步骤是;

$ curl -OL https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz

$ tar -xvf libevent-2.1.8-stable.tar.gz 

$ cd libevent-2.1.8-stable

$ ./configure --prefix=/usr/local

$ make

$ sudo make install

Once libevents is installed then you can install Memcached server.

一旦安装了libevents,就可以安装Memcached服务器。

Steps are;

步骤是;

$ curl -O https://memcached.org/files/memcached-1.5.0.tar.gz

$ tar -xvf memcached-1.5.0.tar.gz 

$ cd memcached-1.5.0

$ ./configure --prefix=/usr/local

$ make

$ sudo make install
Password:
$

Now Memcached server is installed in your system. If the libevent library is not installed, configure command will give the following error.

现在,您的系统中已安装Memcached服务器。 如果未安装libevent库,则configure命令将出现以下错误。

$ ./configure --prefix=/usr/local
...
checking for libevent directory... configure: error: libevent is required.  You can get it from https://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

pankaj:memcached-1.5.0 pankaj$

Memcached服务器在不同的端口上 (Memcached Server on Different Port)

By default, memcached server runs on TCP port 11211 and listens on UDP port 11211 and you can run multiple instances of memcached server from one installation.

默认情况下,memcached服务器在TCP端口11211上运行,并在UDP端口11211上侦听,并且您可以从一个安装中运行多个memcached服务器实例。

$memcached -d

Above command will start the Memcached server on TCP port 11211 and listens on UDP port 11211 as a daemon process.

上面的命令将在TCP端口11211上启动Memcached服务器,并在UDP端口11211上侦听作为守护进程。

$memcached -p 11111 -U 11111 -d

Above command will start the Memcached server on TCP port 11111 and listens on UDP port 11111 as a daemon process.

上面的命令将在TCP端口11111上启动Memcached服务器,并在UDP端口11111上侦听作为守护进程。

使用Telnet测试Memcached服务器 (Test Memcached Server using Telnet)

Next step is to use memcached telnet commands to test that it’s working fine.

下一步是使用memcached telnet命令测试它是否正常运行。

In some of the Linux systems, you also need to add the libevent library location in the path.

在某些Linux系统中,还需要在路径中添加libevent库的位置。

If you get following error in starting memcached server:

如果在启动memcached服务器时出现以下错误:

./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

./memcached:加载共享库时出错:libevent-1.4.so.2:无法打开共享库文件:没有这样的文件或目录

Then add following configuration in user profile (for example, .bash_profile or .profile)

然后在用户配置文件中添加以下配置(例如.bash_profile或.profile)

$export LD_LIBRARY_PATH= /usr/local/lib

Or, provide it’s path using --with-libevent option in configure command.

或者,在configure命令中使用--with-libevent选项提供其路径。

I have used the above steps to install Memcached server on Mac OS. If you face any issues, let me know. I will try to resolve them.

我已按照上述步骤在Mac OS上安装Memcached服务器。 如果您遇到任何问题,请告诉我。 我将尝试解决它们。

Happy Caching…

快乐缓存...

Further Reading: Install Memcached on CentOS and PHP integration

进一步阅读: 在CentOS和PHP集成上安装Memcached

References:

参考文献:

翻译自: https://www.journaldev.com/1/install-memcached-mac

mac memcached

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值