Database fails to initialize 2
-
@Tom-Elliott Hi Tom, here is a code fragment that will check /etc/my.cnf for the skip-networking flag and set ${snmysqlhost} appropriately. It may not always get it but I think my.cnf is pretty standard for mysql and MariaDB.
#!/bin/sh mysqlcfg=/etc/my.cnf snmysqlhost='127.0.0.1' if [ -f ${mysqlcfg} ]; then W=`grep skip-networking ${mysqlcfg} | sed "/^\s*\;/d;s/\s*\;[^\"']*$//" | sed "/^\s*#/d;s/\s*#[^\"']*$//"` if [ ! -z $W ]; then snmysqlhost='localhost' fi fi echo ${snmysqlhost} # ./installfog.sh -y
Tom, I think you can mark this one as solved.
-
@syschuck Because I always default to localhost, I think this can also be solved, however your issue brings up another potential downfall in that your patch only changes to snmysqlhost to localhost if skip-networking is on. However, if skip-networking is on, Storage Nodes won’t be able to communicate to the DB because we’ve essentially disabled networking access.
I propose this:
for mysqlconf in $(grep -rl '.*skip-networking' /etc); do sed -i '/.*skip-networking/ s/^#*/#/' -i $mysqlconf >>$workingdir/error_logs/fog_error_${version}.log 2>&1 done
This method, I think, is better in that I only comment the skip networking lines in any found mysql conf files (as I’m not aware of other configs having the skip-networking as a config). It means I don’t guess which files to edit as the return will only give us matching files.
I already do something similar to this for bind-address (at least for ARCH and have moved them both to happen on any system.
Hopefully this makes sense.
-
@Tom-Elliott That makes sense. I think there is also a /etc/my.cnf.d under ubuntu and mageia that skip-networking could be hidden under. So seems reasonable. Be aware, my.cnf has two comment characters, ‘#’ and ‘;’. That’s why my sed thing was so contorted.
-
@syschuck But I can guarantee the comment is done with a ‘#’ anyway.
Unless the files are not interchangable.