Thursday, January 27, 2011

Restart mysqld with a command line parameter on ubuntu 10.04

Hi,

Getting my hands dirty with a MySql slave setup, I ran into a puzzling question: how do I pass any of the myriad options to mysqld (--skip-slave-start in this particular case) when I am restarting it and it is installed as an Upstart job?

I can think of many ways to hack it, but I feel I must be missing something obvious.

TIA,

  • Consider specifying skip-slave-start in the cnf instead. Typically, flags are specified in the init script, which would be located in /etc/init.d.

    Richard Holloway : I agree with Warner. Set the options in the config file. If you do want to pass options to mysqld in the init script the file you need is actually /etc/init/mysql.conf and the options get added to line 27 on a standard 10.04 install. You can start mysqld from the command line without using init at all but it is not a good solution for production use.
    Jare : Right, both editing the cnf and starting it on the command line were in fact my "hack it" solutions. I probably should have been more specific - the option I want to pass to mysqld is not permanent, it's only a one-time option. Mysqld is already running, I just need to temporarily restart it with this option while I perform some administration (setup as a slave), after that I'd restart it again in production mode, i.e. without the option. Again it's not a blocker or anything, I'm just puzzled about the lack of this feature.
    Warner : Why would you restart when you can just `stop slave;`? `skip-slave-start` is to prevent it upon startup.
    Jare : Warner, that is correct. I was getting some errors after doing this via stop slave; and I thought they were caused by the threads having started then stopped, so I went off this tangent, but the same errors still happen. Thanks!
    From Warner

0 comments:

Post a Comment