memceached server Building, Tomcat server Building

Source: Internet
Author: User

What is memceached?

Provide distributed cache service, let the client find the data in the query cache, speed up the query, reduce the number of data access, and improve the speed of the dynamic Web application.

Memceached using the Platform

Open source and cross-platform software
Linux
Freebsd
Solaris (memceached 1.2.5 or later)
Mac OS X
Windows

Memceached How to store data?
Dividing the allocated memory into blocks of various lengths (chunk) at a predetermined size, and dividing the same blocks into groups is the chunk collection

Page allocated to slab memory space, default is 1MB.
After assigning to slab, the slab is divided into chunk according to the size of the. Chunk the memory space used to cache records.
Slab Class-Specific size chunk group

Experiment (I.)
Experiment Purpose: Build memceached server

Lab Environment:

The Web server IP address is: 192.168.1.1 host name: localhost

The client IP address is: 192.168.1.20 host name: Fanxiaohui

Memceache Server IP address is 192.168.1.254 hostname: FANLJ

Experimental requirements:

When a client user accesses a Web server http://192.168.1.1/ test.html, the Web server connects to the Memcache server, checks to see if the Memcache server has a cache, and if so, gives the client a local directory on the memcache server if there is no Web server.

Package is the source package: Memceached-package.zip,libevent-2.0.15-stable.tar.gz is the environment package, MEMCACHED-1.4.5.TAR.GZ is the primary package, the environment package must be installed before the main package is installed.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/E1/wKiom1XvgoGzpQYgAACW5ZUv3HY481.jpg "title=" Qq20150909085320.png "alt=" Wkiom1xvgogzpqygaacw5zuv3hy481.jpg "/>

1. Install the package, the default installation is OK, before installing the source package must install the compilation environment "development Tool" and the compilation tool GCC gcc-c++ make.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/E1/wKiom1XvhIzjKVX-AADlSuzunKY271.jpg "title=" Qq20150909090206.png "alt=" Wkiom1xvhizjkvx-aadlsuzunky271.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/E1/wKiom1XvgvzigHSCAABkPqKXyx4518.jpg "title=" Qq20150909085527.png "alt=" Wkiom1xvgvzighscaabkpqkxyx4518.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/DE/wKioL1XvhUKx8WmFAABVoMt0iJ0003.jpg "title=" Qq20150909085552.png "alt=" Wkiol1xvhukx8wmfaabvomt0ij0003.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/DE/wKioL1XvhmXBuhM_AABebrVaNYQ535.jpg "title=" Qq20150909090039.png "alt=" Wkiol1xvhmxbuhm_aabebrvanyq535.jpg "/>

Installing the main package

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/DE/wKioL1XvhxeRqpL0AABj03Litlo967.jpg "title=" Qq20150909090340.png "alt=" Wkiol1xvhxerqpl0aabj03litlo967.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E1/wKiom1XvhQehrkP7AABJ4PWQ9J8030.jpg "title=" Qq20150909090410.png "alt=" Wkiom1xvhqehrkp7aabj4pwq9j8030.jpg "/>

See memcached Help for an error, no libevent file loaded

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E1/wKiom1XvinXBft_vAAD-GjgS3jU357.jpg "title=" Qq20150909092637.png "alt=" Wkiom1xvinxbft_vaad-gjgs3ju357.jpg "/>

Solution to write a library file where the profile is placed under the system's configuration file/etc/ld.so.conf.d/

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/E3/wKiom1XvkAWhZ4FCAADYQoDJdtg363.jpg "title=" Qq20150909095059.png "alt=" Wkiom1xvkawhz4fcaadyqodjdtg363.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/DF/wKioL1XvkNnS5K22AAA4FrWqEss521.jpg "title=" Qq20150909094518.png "alt=" Wkiol1xvknns5k22aaa4frwqess521.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E3/wKiom1XvkF3QUcWXAAIMm50qbog449.jpg "title=" Qq20150909095231.png "alt=" Wkiom1xvkf3qucwxaaimm50qbog449.jpg "/>

Start the parameters of the Memcached service-p Specify the port default 11211,-l specifies that the listening interface defaults to all interfaces,-m specifies how much physical memory to do cache defaults to 64MB,-n specifies that the smallest storage unit defaults to 48 bytes, and-f specifies that the growth factor that divides the small lattice defaults to the smallest 1.25 times times the unit,-u specifies the owner of the process run,-VVV View details,-d specifies that the daemon is running in the terminal background.

Start the memcached service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E1/wKioL1Xvor7DMuQPAADtsTeXnEo690.jpg "title=" Qq20150909110137.png "alt=" Wkiol1xvor7dmuqpaadtstexneo690.jpg "/>

View memcached Ports

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/E1/wKioL1Xvo0-iy0X0AAEJi0R2Vok496.jpg "title=" Qq20150909110406.png "alt=" Wkiol1xvo0-iy0x0aaeji0r2vok496.jpg "/>

Stop memcached Service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E1/wKioL1Xvo4ySP9f5AACpIaaVohk239.jpg "title=" Qq20150909110506.png "alt=" Wkiol1xvo4ysp9f5aacpiaavohk239.jpg "/>

Or

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/E1/wKioL1Xvo_mgGmpcAAC0nmZx8rQ050.jpg "title=" Qq20150909110655.png "alt=" Wkiol1xvo_mggmpcaac0nmzx8rq050.jpg "/>

Test on the client side (the client will provide the connection tool, the tool that holds the data, and the tool to fetch the data). Set is the data keyword, name is the name of the variable, 0 is the fixed code, 180 is the stored value in the memcached server for the length of the second, 3 for the name of the store 3 values. Get is the keyword that takes data, name is what it is.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/E1/wKioL1XvpafhKLCvAAFEv645n4w541.jpg "title=" Qq20150909111355.png "alt=" Wkiol1xvpafhklcvaafev645n4w541.jpg "/>

Summary: Advantages and disadvantages of memcached access data and how to store it

Memory storage data pros and cons?
Not permanent storage power outages are lost, storage space is limited, and the price is higher. Reading data is faster than reading data from the hard disk.


What data is suitable for storage in memory?
Data that is small, frequently accessed, and renewable.

How do I delete a cached database? Delete "least recently used" records

When memcached has insufficient memory space, it searches for records that have not been used recently, and deletes "least recently used" records, allocating their space to new records.

Experiment (II)

Experiment Purpose: Build Tomcat server

The Tomcat server is a free open source Web application server that supports Web pages developed in the Java language.

Lab Environment:

The Tomcat server IP address is: 192.168.1.1 host name: localhost

Package:

Jdk-6u27-linux-i586.bin Run Environment Package
Apache-tomcat-6.0.32.tar.gz Main Package
1. Install the Run environment package

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F0/wKiom1Xv-OSCVmPzAAFAZCZqIMg254.jpg "title=" Qq20150909171830.png "alt=" Wkiom1xv-oscvmpzaafazczqimg254.jpg "/>

The bin package is installed to the bin package and Execute permissions can be installed

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/ED/wKioL1Xv-4_znEM_AAFcYcjP4T8928.jpg "title=" Qq20150909172035.png "alt=" Wkiol1xv-4_znem_aafcycjp4t8928.jpg "/>

The following error occurred while installing the bin package, which shows that the/lib/ld-linux.so.2 database file was not found when installing the./install.sfx.6843.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/ED/wKioL1Xv_FLQFK66AAByedDoVEY948.jpg "title=" Qq20150909172351.png "alt=" Wkiol1xv_flqfk66aabyeddovey948.jpg "/>

/lib/ld-linux.so.2 is provided by the GLIBC software, the view glibc is installed, but the display is not found to indicate that there is a i686 package provided.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/ED/wKioL1Xv_OPiumqfAAC9VTldD5w032.jpg "title=" Qq20150909172616.png "alt=" Wkiol1xv_opiumqfaac9vtldd5w032.jpg "/>

Packages that provide glibc in the package are i686 and x86-64, installed i686

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F1/wKiom1Xv_E_CFiLTAAFXPBmxu9g358.jpg "title=" Qq20150909173305.png "alt=" Wkiom1xv_e_cfiltaafxpbmxu9g358.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F1/wKiom1Xv_CPBqRSRAABDOXrW8A4241.jpg "title=" Qq20150909173220.png "alt=" Wkiom1xv_cpbqrsraabdoxrw8a4241.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/F1/wKiom1Xv_ISj6lglAAAuxI9yiHM151.jpg "title=" Qq20150909173355.png "alt=" Wkiom1xv_isj6lglaaauxi9yihm151.jpg "/>

After the installation is complete, a folder will be generated as jdk1.6.0_27, and the folder is the installer.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/ED/wKioL1XwALvTNp_DAADApTBgRkU996.jpg "title=" Qq20150909174240.png "alt=" Wkiol1xwalvtnp_daadaptbgrku996.jpg "/>

For ease of administration, place the contents of the folder in/usr/local/jdk, view the version and information of the JDK, and indicate that the JDK is installed.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/EE/wKioL1XwAY6DjTN_AABO-nxL0hw873.jpg "title=" Qq20150909174611.png "alt=" Wkiol1xway6djtn_aabo-nxl0hw873.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/F1/wKiom1Xv_6LTCcJsAADCbmu8Z7E839.jpg "title=" Qq20150909174713.png "alt=" Wkiom1xv_6ltccjsaadcbmu8z7e839.jpg "/>

Define the system environment variables to invoke the contents of the installation directory, and the contents of the directory can be called every open terminal. Export definition keyword, jre_home specifies the installation directory of the JDK, Java_bin specifies the location where the JDK executable command is stored, path specifies the system environment variable, the path and name of the Classpath class file, Dt.jar and Tools.jar are commands written in Java, the program that Tomcat runs to invoke, and finally redefine the global variables. Source is the file that reloads the system environment variable.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/EE/wKioL1XwByfgBrYpAAGSo2SXvKQ326.jpg "title=" Qq20150909181002.png "alt=" Wkiol1xwbyfgbrypaagso2sxvkq326.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/EE/wKioL1XwCoPwF8Z_AACbo4TwXE0586.jpg "title=" Qq20150909182423.png "alt=" Wkiol1xwcopwf8z_aacbo4twxe0586.jpg "/>

2. Install the Tomcat Master package

Apache-tomcat-6.0.32.tar.gz is a free-to-install software extracted into the/usr/local directory.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/EE/wKioL1XwDHDixG-bAAA7aEyZefc797.jpg "title=" Qq20150909183237.png "alt=" Wkiol1xwdhdixg-baaa7aeyzefc797.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/F1/wKiom1XwCrOC2ICCAAArGMHgrgg719.jpg "title=" Qq20150909183428.png "alt=" Wkiom1xwcroc2iccaaargmhgrgg719.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/EE/wKioL1XwDQui9qbYAACAmvNOUj4038.jpg "title=" Qq20150909183509.png "alt=" Wkiol1xwdqui9qbyaacamvnouj4038.jpg "/>

webapps/root/Web Directory
Logs log directory
Conf configuration file storage Directory
Bin can execute commands

bin/shutdown.sh Stop Service
bin/startup.sh Start Service
3. Start the Tomcat service, the default Tomcat listener port is 8080

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F1/wKiom1XwDSrzHjjJAAEiMWcU-P4999.jpg "title=" Qq20150909184459.png "alt=" Wkiom1xwdsrzhjjjaaeimwcu-p4999.jpg "/>

4. Test, test in Tomcat native http://localhost:8080
When you enter the interface, the page is managed to enter a user name and password.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F1/wKiom1XwEX3Qn9IVAACn6TPsry8438.jpg "title=" Qq20150909190322.png "alt=" Wkiom1xwex3qn9ivaacn6tpsry8438.jpg "/>


This article is from the "Down to earth" blog, make sure to keep this source http://343614597.blog.51cto.com/7056394/1693235

memceached server Building, Tomcat server Building

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.