Run multiple MYSQL servers _ MySQL

Source: Internet
Author: User
Running multiple MYSQL servers most people run a single MySQL server on a specified machine, but in some cases, running multiple servers is advantageous: you can test the new version of server when the finished server is running. In this case, different servers will run.

The operating system usually limits the total process on the number of opened file descriptors. If it is difficult for the system to increase the limit value, running multiple servers is a way to solve the limit (for example, to raise the limit, you may need to re-compile the kernel, and, if the machine is not under your jurisdiction, you may not be able to do so ). In this case, you may run multiple instances of the same server.

Internet services are often provided to customers with their own MySQL installation programs, which require separate servers. In this case, you may run multiple instances of the same server or different servers, if different customers need different MySQL versions.

Of course, running several servers at the same time is more complex than running only one server. If you want 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 parameters include the path name of the data directory, the TCP/IP port, and the socket path name of the UNIX domain where the server is installed, and the UNIX account used to run multiple servers (if not all servers are running under the same account ). If you decide to run multiple servers, you must maintain a good description of the parameters in use so that you do not lose the trace of running.

Configure and install multiple servers

If you want to run multiple instances of different versions of servers instead of the same server, you should install them in different locations. If binary (not r p m) distribution packages are installed, they will be installed under the directory containing the version number. If the package is installed from the source program distribution package, the easiest way to separate different distribution packages is to use the -- with-prefix option when running configure during MySQL installation of each version. This causes installation in a separate directory and connects the directory to the version number of the package. For example, you can configure a MySQL distribution package as follows. the version here is the MySQL version number:

%./Configure... with-prefix =/usr/local/mysql-version

The with-prefix option also determines the unique data directory of the server. You may add options to configure the proprietary values of other servers, for example, the TCP/IP port and socket path name (-- with-TCP-port and-w I t h-un I x-s o c k e t ).

If you want to run multiple instances of the same server, any server-specific options need to be specified at runtime.

Startup process of multiple servers

It is more complex to start multiple servers than to use a single server because both safe_mysqld and mysql. server work well on a single server. I suggest you carefully study safe_mysqld and use it as the basis for the startup process, unless you use a more detailed copy as needed.

One issue that must be addressed is how to specify options in the option file. For multiple servers, you cannot use/e t c/my. cnf for the settings changed on the basis of the total server. you can only use this file for the same settings on all servers. If each server has different data directory locations, you can specify server-specific parameters in the my. cnf file of each server data directory. In other words, use/e t c/my for the settings used by all servers. cnf, and use data d I R/my for server-specific settings. cnf. DATADIR varies with each server.

Another method for specifying server options is: use--d e f a ul t s-f I l e = p a t h _ name as the first option of the command line, to tell the server to read the option from the file specified by path_name. In this way, you can place the server options in the file to the server, and then tell the server to read the file at startup. Note that if this option is specified, no common option files (such as/e t c/my. cnf) will be used.

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.