Question

I've setup replication and failover with MySQL Fabric, and everything it's working fine; now I need to give access to the personal that access the database, I'm trying to use MySQL Router, but in every documentation and manual I've found on internet so far, I need to start MySQL router with

  mysqlrouter --config=/path/to/file/my_router.ini

So my server prompts for the password of the admin user of Fabric; when I do that, it starts fine; but I can't figure out how to start it and leave it running in background, so I can disconnect the session and Router keeps running. I found in the Changelog of MySQL Router (https://dev.mysql.com/doc/relnotes/mysql-router/en/mysql-router-news-2-0-2.html):

The configuration file no longer accepts a password for the Fabric Cache plugin. Instead, MySQL Router prompts for the password at startup.

So I don't know if there is no way to keep it running... Has anyone managed to do this? Or is there another way to connect in a transparent form via MySQL Yog or DBeaver to MySQL Fabric?

Thanks

Was it helpful?

Solution

I would strongly encourage you to try out InnoDB clusters if you haven’t yet:

That being said, this is how I had previously setup MySQL Router 2.0 to run as a daemon on my test machines–which are systemd (EL7) based–so that you have a working reference implementation. In this test setup, the username:password combination for Fabric was admin:admin

[root@hanode1 ~]# cat /etc/mysqlrouter/mysqlrouter.ini
#
# MySQL Router configuration file
#
# Documentation is available at
# http://dev.mysql.com/doc/mysql-router/en/

[DEFAULT]
logging_folder = /var/log/mysqlrouter/
plugin_folder = /usr/lib64/mysqlrouter
runtime_folder = /var/run/mysqlrouter
config_folder = /etc/mysqlrouter

[fabric_cache:lab]
address = 192.168.1.91
user = admin

# Routing into my Fabric managed cluster
# route to the current READ_WRITE / PRIMARY node
[routing:lab]
bind_address = 127.0.0.1:6600
destinations = fabric+cache://lab/group/hagroup
mode = read-write

# Routing into my Group Replication cluster
# route to the first available node
[routing:grouprepl]
bind_address = 127.0.0.1:7700
destinations = 192.168.1.92:3306,192.168.1.93:3306,192.168.1.94:3306
mode = read-write

[logger]
level = debug

[root@hanode1 ~]# cat /usr/lib/systemd/system/mysqlrouter.service
[Unit]
Description=MySQL Router
After=syslog.target
After=network.target
After=mysqlfabric.service

[Service]
Type=simple
User=mysql
Group=mysql

PIDFile=/var/run/mysqlrouter/mysqlrouter.pid

ExecStart=/bin/bash -c "echo 'admin' | mysqlrouter --config=/etc/mysqlrouter/mysqlrouter.ini"

Restart=on-failure

RestartPreventExitStatus=1

PrivateTmp=true

[Install]
WantedBy=multi-user.target

[root@hanode1 ~]#

Best Regards,

Matt

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top