As 'root'...
firewall-cmd --zone=public --add-port=6446/tcp --permanent
firewall-cmd --zone=public --add-port=64460/tcp --permanent
firewall-cmd --zone=public --add-port=6647/tcp --permanent
firewall-cmd --zone=public --add-port=64470/tcp --permanent
systemctl restart firewalld
firewall-cmd --list-port
Check current status using one/both of these commands...
sestatus
getenforce
If your server has SELinux enabled, you have two choices. Disable SELinux (not recommended, but might be right for a test system), or configure SELinux to allow our configuration...Â
Note: if your process is running as root, then the root login is generally mapped to the unconfined_u user in SELinux, which means the following config may not be necessary.semanage port -a -t mysqld_port_t -p tcp 6446
semanage port -a -t mysqld_port_t -p tcp 64460
semanage port -a -t mysqld_port_t -p tcp 6447
semanage port -a -t mysqld_port_t -p tcp 64470
setenforce 0
getenforce
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
As 'root'...
cd /mysql
unzip ${ZIPFILE}
tar xvf ${TARFILE}.tar.gz
ln -s ${TARFILE} mysql-router
mv README.txt mysql-router
rm -f ${TARFILE}.tar.gzÂ
rm -f ${TARFILE}.tar.gz.asc
rm -f ${TARFILE}.tar.gz.md5Â
rm -f ${ZIPFILE}
export PATH=/mysql/mysql-router/bin:$PATH
Add this to the .bash_profile for the root userOn the target client (as 'root')...
mkdir /mysql/myrouter
groupadd -g 28 -o -r mysqlrouter
useradd -M -N -g mysqlrouter -o -r -d /mysql/myrouter -s /bin/false -c "MySQL Router" -u 28 mysqlrouter
Assumes commercial yum repository is available
yum install mysql-router-commercial.x86_64
mysqlrouter --bootstrap icadmin@node1:3306 --user mysqlrouter
The bootstrap process is a specific way of running MySQL Router, which does not start the usual routing and instead configures the mysqlrouter.conf file based on the metadata. (2)mysqlrouter --bootstrap icadmin@node1:3306 --user mysqlrouter --directory /mysql/myrouter
Use this if you are not using the default directory (i.e. you have installed using TAR rather than RPM or YUM)For the RPM/YUM install the auto generated mysqlrouter.conf looks like this..
touch /usr/lib/systemd/system/mysqlrouter.service
chmod 644 /usr/lib/systemd/system/mysqlrouter.service
Add the following lines to /usr/lib/systemd/system/mysqlrouter.service...
[Unit]
Description=MySQL Router
After=syslog.target
After=network.target
[Service]
Type=simple
User=mysqlrouter
Group=mysqlrouter
PIDFile=/mysql/myrouter/mysqlrouter.pid
ExecStart=/mysql/mysql-router/bin/mysqlrouter -c /mysql/myrouter/mysqlrouter.conf
Restart=on-failure
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Test
systemctl enable mysqlrouter
systemctl start mysqlrouter
systemctl status mysqlrouter
systemctl restart mysqlrouter
systemctl stop mysqlrouter
Paste following into /etc/logrotate.d/mysqlrouter...
/mysql/myrouter/log/*log {
# create 600 mysqlrouter mysqlrouter
notifempty
weekly
rotate 5
missingok
compress
}
For all files ending with log...
Create new files with 600 permissions
Don't rotate if log file is empty
Rotate weekly
Maximum of 5 versions of a file
If the logfile is missing, ignore and continue
Compress old versions with gzip