I followed the steps mentioned for changing to Mysql but I am unable to log in. I think I am doing something basically wrong. Can I change to Mysql after using SQlite for some time ? Or it should be done on a fresh install before starting first time ?
Found the answer here.
It seems that oned thinks the database is uninitialized, but the rest of the setup (.one/sunstone_auth etc.) does already exist. You have two possibilities:
either dump the original sqlite db, convert the dump to the MySQL format, insert the result to MySQL, and finally run “onedb fsck”,
or create a fresh installation, without any locally set up data such as ~/.one/sunstone_auth.
For my ONe cloud, i went the first way, and it worked.
"For my ONe cloud, i went the first way, and it worked "
Could you elaborate on how you did this ?
I don’t remember exactly, but something like this:
- stop OpenNebula (especially oned)
- sqlite3 one.db .dump > one.sqlite
-
sqlite2mysql.pl < one.sqlite > one.mysql
(sqlite2mysql.pl taken from stackexchange or something like that - search for “SQLite to MySQL conversion” - create an empty database on your MySQL server
- verify that you can log into it from the host oned runs at
- mysql -h host -u user -p password < one.mysql
- edit oned.conf to reflect the new DB driver
- onedb fsck -S host -u user -p password
- rename one.db to something different just in case
- start oned
- profit!
Thanks.
Suppose for a fresh install with Mysql as backend … How do you prevent the default backend from kicking in ?
Comment it out in oned.conf?
It is worth noting that in OpenNebula 5.0 there will be a native way to do this:
$ onedb sqlite2mysql --help
## USAGE
sqlite2mysql
Migrates a SQLite OpenNebula Database to MySQL
valid options: backup
That will be great. It will be nice if you ask during install itself about the choice of DB like , sqlite , mysql , postgresql or whatever !