In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Memcache cluster
Memcached is a high-performance distributed in-memory object caching system, which is used for dynamic Web applications to reduce database load. By buffering in memory
Save data and objects to reduce the number of times to read the database, thereby improving the speed of dynamic, database-driven websites. Memcached is based on a storage key / value
That's right, hashmap. Its daemon (daemon) is written in C, but the client can be written in any language and through the memcached protocol
Communicate with the daemon.
I. install the software
1. All four are equipped with libevent software.
21 tar zxf libevent-2.0.22-stable.tar.gz 22 cd libevent-2.0.22-stable/ 23. / configure & & make & & make install installs keepalived software (the first two keepalived servers)
(1) installation
16 tar zxf keepalived-1.2.13.tar.gz 17 cd keepalived-1.2.13/18 yum-y install openssl-devel19. / configure-- prefix=/ & & make & & make install compilation and installation (2) modify vim / etc/keepalived/keepalived.conf global_defs {router_id LVS_DEVEL_1}
Vrrp_instance VI_1 {
State MASTER
Interface ens33
Virtual_router_id 51
Priority 100
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
Virtual_ipaddress {
192.168.1.254
}
}
(3) start and view the IP address
3. Install magent software (the first two Magent servers)
22 mkdir / usr/magent create the required folder
23 tar zxf magent-0.6.tar.gz-C / usr/magent/
24 cd / usr/magent/
25 vim ketama.h
27 ln-s / usr/lib64/libevent-2.0.so.5 / usr/lib64/libevent.a
28 ln-s / usr/lib64/libm.so / usr/lib64/libm.a
29 make
30 ln-s / usr/magent/magent / usr/local/bin/
31 magent-u root-n 51200-l 192.168.1.254-p 1200-s 192.168.1.30 purl 11211-b 192.168.1.40 purl 11211
32 netstat-anpt | grep 1200
4. Install memcached software (2 sets after Memcached server)
21 tar zxf memcached-1.4.33.tar.gz
22 cd memcached-1.4.33/
23. / configure-- prefix=/usr/local/memcached-- with-libevent=/usr/local & & make & & make install
25 ln-s / usr/local/memcached/bin/memcached / usr/local/bin/
26 memcached-d-m 512-l 192.168.1.30-p 11211-c 1024-P / usr/local/memcached/memcached.pid-u root
27 netstat-anpt | grep 11211
28 yum-y install telnet
Third, telnet test
Instruction format:
-command name
There are mainly three commands to store data, set, add, replace
The set command is to save a data called key to the server
The add command is to add data to the server, but the server must ensure that the key does not exist and that the data will not be overwritten.
The replace command replaces an existing data. If the data does not exist, it is similar to the set function.
Get View key data
The gets command gets the value (data value) with the CAS token store, or returns null if the key does not exist.
Stats status information of all currently running Memcache servers
The stats directive will only return project status information for the specified parameters.
Version will return version information that begins with VERSION
After the flush_all instruction is executed, all cached data on the server is deleted and returns: OK
Delete deletes the key key for data
Append appends data to the value (data value) that already has key (key).
Prepend is used to append data to the value (data value) that already exists with key (key).
CAS modifies content through tokens
Incr and decr commands
Memcached incr and decr: the command is used to increase or subtract the numeric value of an existing key (key).
Quit exits telnet mode
Test on 192.168.1.10 magent
Test on 192.168.1.30 memcached
Test drift address
168.1.10
168.1.20
168.1.10
168.1.20
Summary:
Advantages of memcache: it can be multi-master or multi-slave.
Disadvantage of memcache: when the main cache node is pawned and restored, the previously cached data will be lost
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.