Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Router not working on restarting docker container #4

Open
siddharth-chaudhery opened this issue Apr 24, 2020 · 7 comments
Open

Comments

@siddharth-chaudhery
Copy link

Everything runs fine when tried for the first time. Cluster got created and router working fine.
Then I stop the containers and when I tried restarting them I get following issue
mysql-router | Error: The provided server contains an unsupported InnoDB cluster metadata

@neumayer
Copy link
Owner

I think the example starts a new, temporary cluster only and state does not get carried over restarts.

@siddharth-chaudhery
Copy link
Author

Just wondering do you have idea how the state can be persisted. I tried mounting volume but still the same issue.

@neumayer
Copy link
Owner

I'm not an expert on mysql cluster myself. But if I recall correctly (it's been a while I was looking into this), removing all the nodes from the cluster (which happens when it is stopped with docker-compose, is too much for it to handle. Maybe (I'm almost guessing myself), some kind of staggered rollout can work, I mean only stop one at a time. Basically it's a question of mysql cluster recovery and how to apply the docker building blocks to it (restart, ordering, volume mounts).

If you discover anything that impacts the format of the docker images themselves, please let me know.

@bozoweed
Copy link

bozoweed commented Feb 12, 2023

by adding this u can save the router config

but after that we got an other error

mysql-router:
env_file:
- mysql-router.env
image: mysql/mysql-router:8.0.13
volumes:
- /root/docker/mysql-router/tmp:/tmp <-- path for saving the router cfg

  Error: The provided server is currently not an ONLINE member of a InnoDB cluster.

@bozoweed
Copy link

finaly found the trouble ,

you also need to to that in the setupScript.js

shell.connect('root@mysql-server-1:3306', dbPass)
try {
print('Setting up InnoDB cluster...\n');
var cluster = dba.createCluster(clusterName);
print('Adding instances to the cluster.');
cluster.addInstance({user: "root", host: "mysql-server-2", password: dbPass})
print('.');
cluster.addInstance({user: "root", host: "mysql-server-3", password: dbPass})
print('.');
cluster.addInstance({user: "root", host: "mysql-server-4", password: dbPass})
print('.');
cluster.addInstance({user: "root", host: "mysql-server-5", password: dbPass})
print('.\nInstances successfully added to the cluster.');
print('\nInnoDB cluster deployed successfully.\n');
} catch(e) {
setTimeout(()=>{ <<---- this is important thing
print('Try to rebooting cluster\n'); <<---- this is important thing
dba.rebootClusterFromCompleteOutage(); <<---- this is important thing
print('\nInnoDB cluster deployed successfully.\n'); <<---- this is important thing

},10000) <<---- this is important thing
print('\nThe InnoDB cluster could not be created.\n\nError: ' + e.message + '\n');
}

@chenling8523
Copy link

hello, when restart the mysql-router, the logs show that "Error: No result returned for metadata query"

while running mysql shell in a mysql5.7 server, I run "dba.getCluster()" and got this error:

No cluster change operations can be executed because the installed metadata version 1.0.1 is lower than the version required by Shell which is version 2.1.0.

i think it's because the version of the mysql-shell is too old, i will try create a cluster using the newer mysql shell, and check the result then.

@chenling8523
Copy link

after create cluster and add instance, connect to each mysql server container, and call "dba.configureLocalInstance()" to apply the newest config about group_replication_local_address and group_replication_group_seeds to my.cnf. then this problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants