Browser -> httpd -> Tomcat -> MySQL. Restarting.
I've just completed a course covering the installation and configuration of Apache httpd, Apache Tomcat and MySQL. Complete with a demonstration that has the newly installed systems visited from various browsers, talking to httpd, which talks on to Tomcat, which talks on in turn to MySQL. The MySQL responses are handled by the Servlets and JSPs running on Tomcat, and returned via the masking Apache httpd that's used for the majority of the web site on the chosen domain. This might all sound very complicated, but it's actually what happens on so many web sites which, no doubt, is why there's such a call for
our deployment course.
And what happens when the server is restarted? Well - you had better make sure that all the services start up properly, hadn't you?
On a Linux / Unix system, you can add scripts that are to be run during system startup, typically to start server processes known as daemons, to the directory /etc/init.d. These scripts should understand (as a minium) a command line parameter "start" to do everything needed to start the service, and "stop" to do everything needed to stop the service. And it's no coincidence that modern versions of apache httpd ship with a utility called
apachectl that accepts these argument, apache tomcat ships with
catalina.sh which also accepts these parameters, and there'a a utility script in mysql's
script directory that does the same thing for that daemon.
So it that all you need to know? Not quite! Just placing the scripts into /etc/init.d does NOT cause them to be run; on system startup, when entering full multi-user mode (run state 3) or multiuser mode with windows (run state 5), Linux / unix go through the directory /etc/rc3.d (or rc5.d, or /etc/init.d/rc3.d etc ... depending on the Linux flavour) and run every file starting with the letter
S in asciibetic order. Now -
you do not want to copy the scripts from init.d to those other directories so the whole thing is set up by filling the "rc" directories with a series of symbolic links back to /etc/init.d. That way, you can turn daemons on and off just by adding and removing links - a very neat scheme indeed.
Here's an example of such a link in /etc/init.d/rc3.d (on a SuSE system)
lrwxrwxrwx 1 root root 10 2006-10-27 14:38 S19apache2 -> ../apache2
and that could be set up by a command such as
ln -s ../apache2 apache2
of using the chkconfig utility that's provided to help with tasks such as this ... but that's an extended story for another day!
(written 2006-10-28, updated 2009-01-01)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S153 - Sourcing, Running and Configuring MySQL [192] Current MySQL and PHP paths and upgrades - (2005-01-28)
[334] Symbolic links and hard links - (2005-06-02)
[489] Which MySQL server am I using? - (2005-11-07)
[515] MySQL - an FAQ - (2005-12-03)
[535] MySQL permissions and privileges - (2005-12-20)
[591] Key facts - SQL and MySQL - (2006-02-04)
[1095] Apache httpd , browser, MySQL and MySQL client downloads - (2007-02-28)
[1123] mysqldump and mysqlrestore - (2007-03-30)
[1131] MySQL - Password security (authentication protocol) - (2007-04-02)
[1689] Some sideways thoughts on the news - (2008-06-27)
[1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
[1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
[1935] Summary of MySQL installation on a Linux system - (2008-12-11)
[2085] MySQL - licensing issues, even with using the name - (2009-03-16)
[2209] Monitoring and Tuning your MySQL installation - (2009-05-31)
[2426] Which version of MySQL am I running? - (2009-09-26)
[2444] Potted MySQL installation - (2009-10-09)
[2445] Securing MySQL on a production server - (2009-10-09)
[2458] Cant connect to local MySQL server through socket /tmp/mysql.sock - (2009-10-17)
[4390] Checking MySQL database backups have worked (not failed) - (2015-01-10)
[4406] Fixing damaged MySQL tables - Error 1712 and Error 2013 - (2015-01-25)
[4487] Starting MySQL. ERROR! The server quit without updating PID file - how we fixed it. - (2015-05-06)
A654 - Web Application Deployment - Configuring and Controlling Tomcat [837] Tomcat - Shutdown port - (2006-08-18)
[914] A practical example of roles - (2006-11-04)
[1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
[1370] Apache Tomcat Performance Tuning - (2007-09-29)
[1503] Web page (http) error status 405 - (2008-01-12)
[1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1943] Port and Glasses - (2008-12-14)
[1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
[2039] The Invoker - (2009-02-13)
[2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
[2163] CATALINA_OPTS v JAVA_OPTS - What is the difference? - (2009-05-09)
[2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
[3043] Gathering information - logging - with log4j. First steps. - (2010-11-12)
A602 - Web Application Deployment - Apache httpd - Sourcing, Installation, Testing [523] Apache httpd release 2.2 - (2005-12-10)
[526] Apache httpd - serving web documents from different directories - (2005-12-12)
[550] 2006 - Making business a pleasure - (2006-01-01)
[660] Stopping and restarting Apache httpd cleanly - (2006-03-29)
[982] Notes from the white board - (2006-12-14)
[1292] DHCP automatic IP address v Static IP - (2007-08-06)
[1449] Upgrade Mac OSX to Leopard, Web Server Apache httpd config lost - (2007-11-29)
[1455] Connecting to MySQL 5 from PHP on Mac OSX Leopard - (2007-12-03)
[1707] Configuring Apache httpd - (2008-07-12)
[1768] What is built in to this httpd and PHP? - (2008-08-23)
[1945] Summary - Apache httpd build on Linux - (2008-12-14)
[2080] Using ApacheBench and jconsole to test and monitor Tomcat - (2009-03-14)
[2096] Where is my new Apache httpd installed - (2009-03-22)
[2184] Choosing the right version of Java and Tomcat - (2009-05-16)
[2520] Global and Enable - two misused words! - (2009-11-30)
[3426] Automed web site testing scripted in Ruby using watir-webdriver - (2011-09-09)
[4437] Adding a PHP build option, rotating an image based on camera data, and a new look at thumbnails in PHP - (2015-02-22)
A164 - Web Application Deployment - Services and Regular Jobs [544] Repeating tasks with crontab - (2005-12-27)
[1028] Linux / Unix - process priority and nice - (2007-01-10)
[1288] Linux run states, shell special commands, and directory structures - (2007-08-03)
[1633] Changing a screen saver from a web page (PHP, Perl, OSX) - (2008-05-06)
[1700] FTP server on Fedora Linux - (2008-07-06)
[1733] memcached - overview, installation, example of use in PHP - (2008-08-02)
[1765] Dialects of English and Unix - (2008-08-21)
[1903] daemons - what is running on my Linux server? - (2008-11-23)
[2145] Using the internet to remotely check for power failure at home (PHP) - (2009-04-29)
[2182] What Linux run level am I in? - (2009-05-15)
[3011] What are .pid files? - (2010-10-23)
[3143] On time - (2011-01-23)
[3791] The Kernel, Shells and Daemons. Greek Gods in computing - (2012-07-01)
[3792] Managing daemons from a terminal session - (2012-07-01)
Some other Articles
Letter HomeHelping the miles passPython is like a narrowboatAnd so to InvernessBrowser -> httpd -> Tomcat -> MySQL. Restarting.A commitment we won't be makingNot proud to be BritishOf course I'll tell you by emailPieces of PythonBrand new hotel and training centre, Melksham