DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Multiple servers

Info Catalog (mysql.info.gz) Log Files (mysql.info.gz) MySQL Database Administration (mysql.info.gz) Query Cache
 
 5.10 Running Multiple MySQL Servers on the Same Machine
 =======================================================
 

Menu

 
* Multiple Windows servers    Running Multiple Servers on Windows
* Multiple Unix servers       Running Multiple Servers on Unix
* Multiple-server clients     Using Client Programs in a Multiple-Server Environment
 
 In some cases, you might want to run multiple `mysqld' servers on the
 same machine.  You might want to test a new MySQL release while leaving
 your existing production setup undisturbed.  Or you may want to give
 different users access to different `mysqld' servers that they manage
 themselves.  (For example, you might be an Internet Service Provider
 that wants to provide independent MySQL installations for different
 customers.)
 
 To run multiple servers on a single machine, each server must have
 unique values for several operating parameters. These can be set on the
 command line or in option files.   Program Options.
 
 At least the following options must be different for each server:
 
 `--port=PORT_NUM'
      `--port' controls the port number for TCP/IP connections.
 
 `--socket=PATH'
      `--socket' controls the Unix socket file path on Unix and the name
      of the named pipe on Windows. On Windows, it's necessary to
      specify distinct pipe names only for those servers that support
      named pipe connections.
 
 `--shared-memory-base-name=NAME'
      This option currently is used only on Windows.  It designates the
      shared memory name used by a Windows server to allow clients to
      connect via shared memory.  This option is new in MySQL 4.1.
 
 `--pid-file=PATH'
      This option is used only on Unix.  It indicates the name of the
      file in which the server writes its process ID.
 
 
 If you use the following log file options, they must be different for
 each server:
 
    * `--log=PATH'
 
    * `--log-bin=PATH'
 
    * `--log-update=PATH'
 
    * `--log-error=PATH'
 
    * `--log-isam=PATH'
 
    * `--bdb-logdir=PATH'
 
 Log file options are described in  Log file maintenance.
 
 If you want more performance, you can also specify the following options
 differently for each server, to spread the load between several
 physical disks:
 
    * `--tmpdir=PATH'
 
    * `--bdb-tmpdir=PATH'
 
 Having different temporary directories is also recommended, to make it
 easier to determine which MySQL server created any given temporary file.
 
 Generally, each server should also use a different data directory,
 which is specified using the `--datadir=path' option.
 
 *Warning:* Normally you should never have two servers that update data
 in the same databases!  This may lead to unpleasant surprises if your
 operating system doesn't support fault-free system locking!  If
 (despite this warning) you run multiple servers using the same data
 directory and they have logging enabled, you must use the appropriate
 options to specify log filenames that are unique to each server.
 Otherwise, the servers will try to log to the same files.  Please note
 that this kind of setup will only work with `ISAM', `MyISAM' and
 `MERGE' tables, and not with any of the other storage engines.
 
 The warning against sharing a data directory among servers also applies
 in an NFS environment.  Allowing multiple MySQL servers to access a
 common data directory over NFS is a _bad idea_!
 
    * The primary problem is that NFS will become the speed bottleneck.
      It is not meant for such use.
 
    * Another risk with NFS is that you will have to come up with a way
      to make sure that two or more servers do not interfere with each
      other.  Usually NFS file locking is handled by the `lockd' daemon,
      but at the moment there is no platform that will perform locking
      100% reliably in every situation.
 
 
 Make it easy for yourself: Forget about sharing a data directory among
 servers over NFS. A better solution is to have one computer that
 contains several CPUs and use an operating system that handles threads
 efficiently.
 
 If you have multiple MySQL installations in different locations,
 normally you can specify the base installation directory for each
 server with the `--basedir=path' option to cause each server to use a
 different data directory, log files, and PID file. (The defaults for
 all these values are determined relative to the base directory). In
 that case, the only other options you need to specify are the
 `--socket' and `--port' options.  For example, suppose that you install
 different versions of MySQL using `tar' file binary distributions.
 These will install in different locations, so you can start the server
 for each installation using the command `bin/mysqld_safe' under its
 corresponding base directory.  `mysqld_safe' will determine the proper
 `--basedir' option to pass to `mysqld', and you need specify only the
 `--socket' and `--port' options to `mysqld_safe'.  (For versions of
 MySQL older than 4.0, use `safe_mysqld' rather than `mysqld_safe'.)
 
 As discussed in the following sections, it is possible to start
 additional servers by setting environment variables or by specifying
 appropriate command-line options.  However, if you need to run multiple
 servers on a more permanent basis, it will be more convenient to use
 option files to specify for each server those option values that must
 be unique to it.
 
Info Catalog (mysql.info.gz) Log Files (mysql.info.gz) MySQL Database Administration (mysql.info.gz) Query Cache
automatically generated byinfo2html