显示标签为“Internet and other miscellany”的博文。显示所有博文
显示标签为“Internet and other miscellany”的博文。显示所有博文

2013/03/25

Under Linux installation, start the MySQL

Three or four years is not installed mysql + apache + php environment, I used to do the the bank performance test outsourcing services in the the Party Development Center encountered such environment project is relatively small, mostly WebLogic / WebSphere + Oracle/DB2 architecture of large-scale systems. Get involved in the electricity supplier industry project, had to go to ponder those almost forgotten IIS, apache, MSsql, mysql environment.

An virtual centos4.7 of the platform: VMware

Host: windows

Install mysql preparation:

1, check whether the environment has been installed mysql, check: netstat-ano command to view the mysql port 3306 by default exists; execute mysql command line

2, download mysql installation package

Http://www.mysql.com/downloads/mysql/ # downloads download mysql installation package:

MySQL-server-5.5.28-1.linux2.6.i386.rpm

MySQL-client-5.5.28-1.linux2.6.i386.rpm

Rpm-ivh command to install mysql not say it here.

First take a look at some of the main directory of the default mysql database:

Database directory / var / lib / mysql /

2, the configuration file / usr / share / mysql (of the mysql.server command and configuration files)

Related command / usr / bin (mysqladmin mysqldump command)

4, the startup script / etc / rc.d / init.d / (startup script file mysql directory)

Default port 3306 netstat-ano command to view installed mysql start mysql service if it does not exist, according to the following method.

Start mysql service:


[Root @ localhostmysql] # pwd
/ Usr / share / mysql
[Root @ localhostmysql] #. / Mysql.server start
StartingMySQL ... [OK]
[Root @ localhostmysql] # netstat-ano
ActiveInternet connections (servers and established)
ProtoRecv-Q Send-Q Local Address Foreign Address State Timer
tcp 0 0 0.0.0.0:3306 0.0.0.0: * LISTEN off (0.00/0/0)
[Root @ localhostmysql] # mysql
Welcometo the MySQL monitor. Commands end with; or \ g.
YourMySQL connection id is 1
Serverversion: 5.5.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2012, Oracle and / or its affiliates. All rights reserved.
Oracle isa registered trademark of Oracle Corporation and / or its
affiliates.Other names may be trademarks of their respective
owners.
Type'help; 'or' \ h 'for help. Type' \ c 'to clear the current input statement.
mysql>
mysql>

Start and stop

1 to start
Mysql MySQL installation is complete, start-up file in the / etc / init.d directory, run the following command in the need to start.

[Root @ localhost mysql] # / etc / init.d / mysql start
2, stop

[Root @ localhost mysql] # / usr / bin / mysqladmin-u root-p shutdown
3, automatic start

1) back to mysql automatically start list

[Root @ localhost mysql] # / sbin / chkconfig-list
2) MySQL add to your system startup services group inside to

[Root @ localhost mysql] # / sbin / chkconfig - add mysql
3) to remove the MySQL service group from the start inside.

[Root @ localhost mysql] # / sbin / chkconfig - del mysql


2013/03/24

Control of the entire page cache and update dynamic pages as static pages




Static pages we all know, WEB server sends back the contents of the file comes with a Last-Modified header information, and static files last modification time stored inside, so that when the next time the browser requests the file will get Last -Modified header information exists with the If-Modified-Since sent to the server, telling the server's local cache last modification time, will first determine the end of the file when the server receives the time information of the If-Modified-Since request modify the time is later than this time, the late update, will retransmission of the contents of the file, along with the latest Last-Modified header information to the client, if the time is equal to or more than this time early, it shows no update cache fully synchronized, it will send back a 304 Not Modified status code, and to stop retransmission file content, and can save unnecessary data transmission.
Above is a static page cache and update the control mechanism, generally all this is by the WEB server directly arranged deal, all without user intervention. Dynamic pages are not so lucky, because of the dynamic page requests are forwarded by the WEB server to a specific page handler to complete their cache and update the strategic issues, and not arranged, so these controls must programmers to complete. Unfortunately, however, the dynamic page handler is unable to automatically handle cache is a whole page-level cache, we can cache a variable in the code so that at the next call, but still a lot of code to be executed, they can as static pages to the client a Last-Modified header information, determine the time and data updated when the next request, in order to decide whether to repeat the process and send data?

From the above analysis it is entirely feasible, but it needs to do special processing script, which is a logic to regulate this update detection, of course, this is not the focus on this. Because the the client to accept last modified time to completely rely on the Last-Modified header information, so dynamic scripting can be sent back to the content is also output a time as a basis to judge, then the next time the client requests the same page (accurately, should with a URL address), Last-Modified header information received will be appended to the If-Modified-Since request over. To a dynamic page here, we can get included with the request last modify time, then the first judgment point in time whether there is a new deal with the data, there is no new data, then, we are on the direct end of the current script, you can save server resources. Of course, before the end of the script, you need to play a 304 status code, because let clients sure to use the cache, must also be dependent on the status code, so just use dynamic script sends back a 304 Not Modified header information can not only saving server script execution resources, but also save the flow can be described as killing two birds with one stone, and the application form is more flexible and more controllable.