Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and configuration of Mencached cluster

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Overview of Mencached basic deployment Mamcached

Memcached is a distributed caching system developed by LiveJournal's Brad Fitzpatrick, but used by many websites. This is a set of open source software released under BSD license license.

Memcached lacks authentication and security control, which means that the memcached server should be placed behind the firewall.

Memcached's API uses a 32-bit cyclic redundancy check (CRC-32) to calculate the key values and spread the data across different machines. When the table is full, the new data will be replaced with the LRU mechanism. Because memcached is usually used only as a caching system, applications that use memcached need additional code to update data in memcached when writing back to slower systems, such as back-end databases.

Lab preparation name role address centos7-1 server 192.168.142.66centos7-2 client 192.168.142.77 experiment step memcached server

Install the environment package

[root@localhost libevent-2.1.8-stable] # yum install gcc gcc-c++ make-y

Install the Libevent software ontology

[root@localhost memcached] # tar zxf libevent-2.1.8-stable.tar.gz-C / opt/ [root@localhost memcached] # cd / opt/libevent-2.1.8-stable/// configuration and compilation installation [root@localhost libevent-2.1.8-stable] # / configure\-- prefix=/usr/local/libevent [root@localhost libevent-2.1.8-stable] # make & & make install

Configure, install Memcached

[root@localhost memcached] # tar zxf memcached-1.5.6.tar.gz-C / opt/ [root@localhost memcached] # cd / opt/memcached-1.5.6/ [root@localhost memcached-1.5.6] #. / configure\-- prefix=/usr/local/memached\-- with-libevent=/usr/local/libevent/ [root@localhost memcached-1.5.6] # make & & make install// establish a soft link [root@localhost memcached-1.5.6 ] # ln-s / usr/local/memached/bin/* / usr/local/bin/

Start the service

[root@localhost memcached-1.5.6] # memcached- d-m 32m-p 11211-u root// "- d": run as daemon (running in the background) / / "- m": specify the maximum amount of memory used / / "- p": specify port / / "- u": specify user [root@localhost memcached-1.5.6] # netstat-atnp | grep 11211tcp 000.0.0.0 : 11211 0.0.0.0 LISTEN 12591/memcached tcp6 0: 11211:: * LISTEN 12591/memcached [root@localhost memcached-1.5.6] # systemctl stop firewalld.service [root@localhost memcached-1.5.6] # setenforce 0

Install Telent to connect to Memcached

[root@localhost memcached-1.5.6] # yum install telnet-yamp / connect memcached [root@localhost memcached-1.5.6] # telnet 192.168.142.66 11211Trying 192.168.142.66...Connected to 192.168.142.66.Escape character is'^]'. Client

Install the LAMP schema

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python is a group of open source software commonly used to build dynamic websites or servers, which are independent programs themselves, but because they are often used together, they have a higher and higher degree of compatibility and form a powerful Web application platform. With the vigorous development of open source trend, open source LAMP has formed a tripod with J2EE and .net commercial software, and the project developed by this software has a low investment cost, so it has attracted the attention of the whole IT community. In terms of website traffic, more than 70% of the visit traffic is provided by LAMP, and LAMP is the most powerful website solution.

Lift the right in the database

[root@localhost ~] # mysql-uroot-pmysql > create database sky;mysql > grant all on sky.* to 'skyuser'@'%' identified by' 123123 destroy MySQL > flush privileges

Test whether the PHP tool can connect to the database

```php+HTML

[root@localhost htdocs] # vim / usr/local/httpd/htdocs/index.php

* * installation, Configure the memcache client * * ```java [root @ localhost memcached] # tar zxf memcache-2.2.7.tgz-C / opt/ [root@localhost memcached] # cd / opt/memcache-2.2.7/ [root@localhost memcache-2.2.7] # / usr/local/php5/bin/phpize / / generate a startup script [root@localhost memcache-2.2.7] # / configure\-enable-memcache\-- with-php-config=/usr/ for memcache Local/php5/bin/php-config// compilation & install [root@localhost memcache-2.2.7] # make & & make install

Modify the configuration file of PHP

[root@localhost memcache-2.2.7] # vim / usr/local/php5/php.ini//736 add extension_dir = "/ usr/local/php5/lib/php/extensions/no-debug-zts-20131226/" extension = memcache.so after the line

Set up a test page

```php+HTML

[root@localhost memcache-2.2.7] # vim / usr/local/httpd/htdocs/index.php

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report