MySQL Forums
Forum List  »  Newbie

LINUX - Configuring multiple instance without using a standalone database.
Posted by: Jean-Claude DOLE
Date: January 21, 2015 12:50PM

Hello.
I would like to setup as many instance as necessary so I can stop only one database without stopping everything. So I have not configured [mysqld], and try to use only mysqld_multi.

Service File ( in /etc/systemd/system/mysqld@.service )
---------------
[Unit]
Description=MySQL Multi Server for instance %i
After=syslog.target
After=network.target

[Service]
User=mysql
Group=mysql
Type=forking
ExecStart=/usr/bin/mysqld_multi --defaults-file=/etc/mysql/cfg_%i.cnf --log=/var/log/mysql/mysql_multi.log start %i
ExecStop=/usr/bin/mysqld_multi --log=/var/log/mysql/mysql_multi.log stop %i
Restart=always
RestartSec=5
PrivateTmp=true

[Install]
WantedBy=multi-user.target

-----------------------------------------


I have put the configuration file in /etc/mysql/cfg_1.cnf for my first instance.
I have put the configuration file in /etc/mysql/cfg_2.cnf for my second instance.

Here config file for instance 2 :
-------------------------------------
[mysqld1]
port = 63332
socket = /bdd/bd_2/sock/postfix.sock
pid-file = /bdd/bd_2/sock/postfix.pid
user = postfix
general_log = 1
general_log_file = /var/log/mysql/postfix/postfix.log
log-error = /var/log/mysql/postfix/postfix_error.log
log-warnings = 6
datadir = /bdd/bd_2/postfix
symbolic-links = 0

-----------------------------------

here is the general configuration file ( /etc/my.cnf )

------------------------------------
[client]
port = 3306
socket = /bdd/bd_1/sock/mysql_cli.sock

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log = /var/log/mysql/mysqld_multi.log


!includedir /etc/my.cnf.d

---------------------------------------

here are screen logs :

---------------------------------------
linux-my-server-yast2:~ # systemctl start mysqld@1
linux-my-server-yast2:~ # systemctl status mysqld@1
mysqld@1.service - MySQL Multi Server for instance 1
Loaded: loaded (/etc/systemd/system/mysqld@.service; enabled)
Active: active (running) since Wed 2015-01-21 19:45:21 CET; 2s ago
Process: 5178 ExecStart=/usr/bin/mysqld_multi --defaults-file=/etc/mysql/cfg_%i.cnf --log=/var/log/mysql/mysql_multi.log --verbose start %i (code=exited, status=0/SUCCESS)
Main PID: 5184 (mysqld)
CGroup: /system.slice/system-mysqld.slice/mysqld@1.service
└─5184 /usr/sbin/mysqld --port=63331 --datadir=/bdd/bd_1/mysql --socket=/bdd/bd_1/sock/mysql.sock --pid-file=/bdd/bd_1/sock/mysql.pi...

Jan 21 19:45:21 linux-my-server-yast2 systemd[1]: Started MySQL Multi Server for instance 1.
linux-my-server-yast2:~ # systemctl start mysqld@2
linux-my-server-yast2:~ # systemctl status mysqld@2
mysqld@2.service - MySQL Multi Server for instance 2
Loaded: loaded (/etc/systemd/system/mysqld@.service; enabled)
Active: inactive (dead) since Wed 2015-01-21 19:45:31 CET; 3s ago
Process: 5216 ExecStop=/usr/bin/mysqld_multi --log=/var/log/mysql/mysql_multi.log stop %i (code=exited, status=0/SUCCESS)
Process: 5212 ExecStart=/usr/bin/mysqld_multi --defaults-file=/etc/mysql/cfg_%i.cnf --log=/var/log/mysql/mysql_multi.log --verbose start %i (code=exited, status=0/SUCCESS)

Jan 21 19:45:31 linux-my-server-yast2 systemd[1]: Started MySQL Multi Server for instance 2.
linux-my-server-yast2:~ #
----------------------------------------

Any help is welcome.

Thank you for helping
___________________________________________________________________________________________
SAMBA-LDAP PDC server - opensuse 12.3 KDE - MYSQL 5.6 -- asus R900V desktop 12.3 KDE & WINXP on Virtualbox -- HP DV9350 desktop 12.3 KDE -- acer aspire 7736g win 7 pro - scanner EPSON V500 - Brother HL2150N - Samsung CLP-325W

Options: ReplyQuote


Subject
Written By
Posted
LINUX - Configuring multiple instance without using a standalone database.
January 21, 2015 12:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.