MySQL Forums
Forum List  »  Install & Repo

multiple instance using systemd - need help
Posted by: Rene Paquin
Date: December 10, 2018 01:08PM

I am currently trying to install a multiple instance of MySQL 5.7 on Oracle Linux 7 server and I am having issues. Here is what I have done so far

Create mysqld@.service in /usr/lib/systemd/system with contents

[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 start %i
ExecStop=/usr/bin/mysqld_multi stop %i
Restart=always
PrivateTmp=true

[Install]
WantedBy=multi-user.target



Edited the /etc/my.cnf as below

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe --basedir=/usr

[mysqld1]
port=3307
datadir=/var/lib/mysql/1/
socket=/var/lib/mysql/1/mysql.sock
pid-file=/var/run/mysqld/mysqld1.pid
log-error=/var/log/mysqld1.log
symbolic-links=0

[mysqld2]
port=3308
datadir=/var/lib/mysql/2/
socket=/var/lib/mysql/2/mysql.sock
pid-file=/var/run/mysqld/mysqld2.pid
log-error=/var/log/mysqld2.log
symbolic-links=0



ran the following commands:
mkdir /var/lib/mysql/{1,2}
chown mysql:mysql /var/lib/mysql/1
chown mysql:mysql /var/lib/mysql/2
mysql_install_db --user=mysql --datadir=/var/lib/mysql/1/
mysql_install_db --user=mysql --datadir=/var/lib/mysql/2/
touch /var/log/mysqld{1,2}.log
chmod o-r /var/log/mysqld{1,2}.log
chcon --reference=/var/log/mysqld.log /var/log/mysqld{1,2}.log
systemctl daemon-reload

Then tried to start the mysqld1 service which fails:
mysqld@1.service - MySQL Multi Server for instance 1
Loaded: loaded (/usr/lib/systemd/system/mysqld@.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2018-12-10 14:02:42 EST; 56s ago
Process: 8790 ExecStart=/usr/bin/mysqld_multi start %i (code=exited, status=1/FAILURE)

Dec 10 14:02:41 ictmysql02 systemd[1]: Failed to start MySQL Multi Server for instance 1.
Dec 10 14:02:41 ictmysql02 systemd[1]: Unit mysqld@1.service entered failed state.
Dec 10 14:02:41 ictmysql02 systemd[1]: mysqld@1.service failed.
Dec 10 14:02:42 ictmysql02 systemd[1]: mysqld@1.service holdoff time over, scheduling restart.
Dec 10 14:02:42 ictmysql02 systemd[1]: Stopped MySQL Multi Server for instance 1.
Dec 10 14:02:42 ictmysql02 systemd[1]: start request repeated too quickly for mysqld@1.service
Dec 10 14:02:42 ictmysql02 systemd[1]: Failed to start MySQL Multi Server for instance 1.
Dec 10 14:02:42 ictmysql02 systemd[1]: Unit mysqld@1.service entered failed state.
Dec 10 14:02:42 ictmysql02 systemd[1]: mysqld@1.service failed.

I am not sure where I went wrong or what is missing. Any help is greatly appreciated.
Thank you,
Rene

Options: ReplyQuote


Subject
Written By
Posted
multiple instance using systemd - need help
December 10, 2018 01:08PM


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.