Running multiple MySQL servers

Source: Internet
Author: User
Tags command line mysql socket versions
mysql| servers Most people run a single MySQL server on a specified machine, but in some cases it is good to run multiple servers:
You can test the new version of the server in the state where the production server is running. In this case, a different server will run.
The operating system typically imposes a total process limit on the number of descriptors for open files. If the system has difficulty raising this limit, running multiple servers is the way to resolve the limit (for example, increasing the limit may require recompiling the kernel, and you may not be able to do so if the machine is not your jurisdiction). In this case, you might run multiple instances of the same server.
Internet services often provide customers with their own MySQL installer, which requires a separate server. In this case, you might run multiple instances of the same server or different servers, if different customers need different versions of MySQL.
Of course, running several servers at the same time is more complex than just running one. If you plan to install multiple versions, you cannot install them in the same location. When the server is running, some parameters must be unique for each server. Some of these parameters include the path name of the data directory, the socket pathname of the TCP/IP port and the UNIX domain, and the UNIX account used to run multiple servers (if all servers are not running under the same account). If you decide to run multiple servers, you must maintain a good description of the parameters you are using so that you do not lose track of running.

Configuring and installing multiple servers

If you plan to run different versions of the server rather than multiple instances of the same server, you should install them in different locations. If you install the binary (not the R P M) distribution, they will be installed under the directory name containing the version number. If you install from the source program distribution package, the easiest way to separate the distribution packages is when in each version of MySQL Ann
Use the--WITH-PREFIX option when running configure in the load process. This will cause installation in a separate directory, and you can connect the directory to the version number of the distribution package. For example, you can configure a MySQL distribution as follows, where version is the MySQL edition number:
%./configure. With-prefix=/usr/local/mysql-version
--The With-prefix option will also determine the server's unique data directory. You may add options to configure additional server-specific values, such as TCP/IP ports and socket pathname (--with-tcp-port and-w i t h-un i x-s o C K e t).
If you plan to run multiple instances of the same server, any options that are private to the server will need to be specified at run time.

startup process for multiple servers

Starting multiple servers is more complex than using a single server because both Safe_mysqld and mysql.server work well on a single server. The author recommends that you study safe_mysqld and use it as a basis for the startup process, unless you are using a more granular copy of your own needs.
One problem that must be addressed is how to specify options in the options file. For multiple servers, you cannot use/E t c/my.cnf for settings that are changed on a total server basis, and you can use the file only for settings that are the same for all servers. If each server has a different data directory location, you can specify server-specific parameters in the My.cnf file for each server data directory. In other words, you should use/E T c/my.cnf for the settings used by all servers, and use data D I r/my.cnf for server-specific settings, where DataDir varies with each server.
Another way to specify server options is to use the-D E F a ul t s-f i l e =p a t h _ name as the first option on the command line to tell the server to read the options from the file specified by Path_name. This allows the server option in the file to be uniquely placed on that server, and then tells the server to read the file at startup. Note that if you specify this option, there are no usual option files (such as/e T c/my.cnf) to be used.

Related Article

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.