MARIADB and Apache Installation

Source: Internet
Author: User


Binary free compiler package official website address downloads.mariadb
Extract
Tar zvxf mariadb-10.2.6
Move and modify the name

Initialize user or MySQL database is mariadb

See if it's correct

Configuration file allocates cache according to different memory size

Copy the configuration file and rename it

Copy Startup scripts

Editing a configuration file

Edit Startup script

After defining conf
To start the command line and then define

Start the service

View Ps-ef|grep mariadb

Listening port

Default profile not defined DataDir automatically go to/etc/mysql inside to find
Configuration files can be modified

Define in config file

Apache Installation

Apr is a common library of functions
Yum installed APR and 2.4 Do not match so need to compile themselves
Download package

Unzip first install Apr

Check
echo $?

Installation

Installing Util

Specify APR

ENABLE-SO supports dynamic expansion modules
Enable-mod-shared most
Installing httpd
Error query requires installation package

Query Package

Content under the directory

startup files in, Bin/http
Config file love you, conf
Default site Htdcos storage location
Log logs
Dynamic module Modules
See which modules are loaded httpd

The static module is compiled into the binary file.

binary files

If the shared expansion module is a directory
File in Modoules directory

Command line Startup

viewing processes and port numbers

Three types of MPM introduction to Apache
Introduction of three MPM

The Apache 2.X supports a plug-in parallel processing module called a multi-Path processing module (MPM). When compiling Apache, you have to choose only one mpm, and there are several different MPM options for Unix-like systems that can affect the speed and scalability of Apache.
Prefork MPM: This multi-path processing module (MPM) implements a non-threaded, pre-derived Web server that works like Apache 1.3. It is suitable for systems that do not have a thread-safe library and need to avoid threading compatibility issues. It is the best mpm to require each request to be independent of each other, so that if a request has a problem it will not affect the other request.
This MPM has a strong self-tuning capability and requires very little adjustment of the configuration instructions. The most important thing is to set the maxclients to a value that is large enough to handle the potential request spikes, and not too large to use more memory than the size of the physical memory.

Worker MPM: This multi-processing module (MPM) enables a network server to support mixed multithreaded multi-process. Because a thread is used to process requests, a large amount of requests can be processed, while the overhead of system resources is less than the process-based MPM. However, it also uses a multi-process, with each process having multiple threads to obtain the stability of the process-based MPM.
The number of threads that each process can have is fixed. The server increases or decreases the number of processes depending on the load. A separate control process (parent process) is responsible for the creation of child processes. Each child process can establish a threadsperchild number of service threads and a listener thread that listens to the access request and passes it to the service thread for processing and answering.

Whether it's worker mode or prefork mode, Apache always tries to keep some spare (spare) or idle child processes (the free service thread pool) to meet the incoming requests. This way, the client does not need to wait for the child process to be generated before the service is received.

Event MPM: Both of these stable MPM methods are somewhat inadequate under very busy server applications. Although the keepalive way of HTTP can reduce the number of TCP connections and network load, keepalive needs to be bound to the service process or thread, which causes a busy server to consume all the threads. The Event MPM is a new model for solving this problem, which separates the service process from the connection. The event MPM approach is most effective when the server is processing fast and has a very high click-through rate, the number of threads available is the critical resource limit. A busy server that works as a worker mpm can withstand a good tens of thousands of visits per second (for example, at the peak of a large news Service site), and event MPM is used to handle higher loads. It is important to note that the Event MPM does not work under secure HTTP (HTTPS) access.
For the event mode, Apache gives the following warning:
This MPM was experimental, so it could or may not be work as expected.
This MPM is currently under trial, and he may not be able to work as expected.

How to configure three types of MPM

The prefork is the default MPM on the UNIX platform, and the pre-derived subprocess method used in Apache 1.3 is also used in the pattern. Prefork itself is not using the thread, version 2.0 uses it to maintain compatibility with version 1.3, and on the other hand, the process of handling different instructions with separate sub-processes is independent of each other, which makes it one of the most stable mpm.
How to view the three types of MPM currently installed on Apache.

[Email protected] apache]# httpd-l
Compiled in Modules:
Core.c
Prefork.c
Http_core.c
Mod_so.c

If you see PERFORK.C, the current perfork MPM mode is indicated. The WORKER.C is represented as the worker MPM mode.

So how do you set up Apache's MPM?
You need to specify the mode when the Apache configuration is installed:
[Email protected] httpd-2.4.1]#/configure--prefix=/usr/local/apache2worker--enable-so--with-mpm=worker
[[email protected] httpd-2.4.1]# make
[[email protected] httpd-2.4.1]# make install
Specifying the--WITH-MPM=NAME option specifies that Mpm,name is the name of the MPM you want to use. If you do not specify a pattern, the default is Prefork MPM.

So how do I configure it as an event MPM?
As with the method above, just add the following parameters to the installation:--enable-nonportable-atomics=yes
It is important to note that the event MPM may not be supported for older CPUs.

Analysis of three MPM parameters

No matter what kind of mpm you're installing in Apache,
After the installation is complete, open the./apache/conf/extra/httpd-mpm.conf file and locate the following configuration:

Perfork MPM

<ifmodule mpm_prefork_module>
Startservers 5
Minspareservers 5
Maxspareservers 10
Maxrequestworkers 250
Maxconnectionsperchild 0
</IfModule>

Startservers: Number of server processes start Minspareservers: Minimum number of server processes, save standby Maxspareservers: Maximum number of server processes, save alternate maxrequestworkers: Maximum number of server processes allowed to start Maxconnectionsperchild: Maximum number of connections for a server process service

Prefork control process After initially establishing the "startservers" sub-process, in order to meet the needs of minspareservers settings to create a process, wait a second, continue to create two, wait a second, continue to create four ... This increases the number of processes created by the number of digits, up to 32 per second, until the value of the Minspareservers setting is met. This pattern eliminates the need to generate new processes when the request arrives, reducing overhead to increase performance. Maxspareservers sets the maximum number of idle processes, and if the number of idle processes is greater than this value, Apache will automatically kill some of the unwanted processes. This value should not be set too large, but if you set a value smaller than minspareservers, Apache will automatically adjust it to minspareservers+1. If the site load is large, consider increasing minspareservers and maxspareservers at the same time.
Maxrequestsperchild sets the number of requests that can be processed by each child process. Each child process is automatically destroyed after it has processed "maxrequestsperchild" requests. 0 means infinity, that is, the child process never destroys. Although the default setting of 0 enables each subprocess to process more requests, there are two important benefits if set to a value other than 0:
1. To prevent accidental memory leaks. 2. When the server load drops, the number of child processes will be automatically reduced.
Therefore, this value can be adjusted according to the load of the server.
The maxrequestworkers instruction set limits the number of service requests at the same time. Any connection attempts at Maxrequestworkerslimit will normally be queued, up to several based on the Listenbacklog directive.
Prior to apache2.3.13 version maxrequestworkers was called MaxClients.
(MaxClients is the most important of these directives, setting the request that Apache can process at the same time, which is the most influential parameter to Apache performance.) Its default value of 150 is far from enough, if the total number of requests has reached this value (can be confirmed by Ps-ef|grep Http|wc-l), then the subsequent request will be queued until a processed request is complete. This is the main reason why the system resources are still a lot left and HTTP access is slow. Although theoretically the larger the value, the more requests can be processed, but the Apache default limit cannot be greater than 256. )

Worker MPM

<ifmodule mpm_worker_module>
Startservers 3
Minsparethreads 75
Maxsparethreads 250
Threadsperchild 25
Maxrequestworkers 400
Maxconnectionsperchild 0
</IfModule>

Startservers: Initial number of server processes start Minsparethreads: Minimum number of worker threads, save alternate Maxsparethreads: Maximum number of worker threads, save alternate Threadsperchild: A fixed number of worker threads in each server process maxrequestworkers: Maximum number of worker threads Maxconnectionsperchild: One server process service for maximum number of connections

The Worker generates a "startservers" sub-process by the master control process, each of which contains a fixed number of threadsperchild threads, and each thread processes the request independently. Similarly, minsparethreads and maxsparethreads set the minimum and maximum number of idle threads in order not to generate threads when the request arrives;
The maxrequestworkers sets the maximum number of clients that are simultaneously connected. If the total number of threads in an existing child process does not meet the load, the control process will derive the new child process
The maximum default values for Minsparethreads and Maxsparethreads are 75 and 250, respectively. These two parameters have little effect on Apache performance, and can be adjusted according to the actual situation.
Threadsperchild is the most performance-related instruction in the worker mpm. The maximum default value for Threadsperchild is 64, and 64 is not enough if the load is large. At this point, to explicitly use the THREADLIMIT directive, its maximum default value is 20000.
The total number of requests that can be processed concurrently in worker mode is determined by multiplying the total number of child processes by the Threadsperchild value, which should be greater than or equal to maxrequestworkers. If the load is large and the number of existing child processes is not met, the control process derives the new child process. The default maximum number of child processes is 16, and you need to explicitly declare serverlimit (the maximum value is 20000) when you increase it. It is important to note that if Serverlimit is explicitly declared, then it must be multiplied by the value of threadsperchild to be greater than or equal to maxrequestworkers. And maxrequestworkers must be an integer multiple of threadsperchild, otherwise Apache will automatically adjust to a corresponding value.

Event MPM

<ifmodule mpm_event_module>
Startservers 3
Minsparethreads 75
Maxsparethreads 250
Threadsperchild 25
Maxrequestworkers 400
Maxconnectionsperchild 0
</IfModule>

Startservers: Initial number of server processes start Minsparethreads: Minimum number of worker threads, save alternate Maxsparethreads: Maximum number of worker threads, save alternate Threadsperchild: A fixed number of worker threads in each server process maxrequestworkers: Maximum number of worker threads Maxconnectionsperchild: One server process service for maximum number of connections

MARIADB and Apache Installation

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.